Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-group
Commits
d40ac5ea
Commit
d40ac5ea
authored
Mar 15, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分页
parent
44f76c14
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
15 deletions
+17
-15
utils.go
common/utils.go
+2
-2
family.go
domain/model/groupPower_m/family.go
+2
-2
group_power_apply.go
domain/model/groupPower_m/group_power_apply.go
+1
-1
groupInfo.go
domain/model/group_m/groupInfo.go
+3
-7
group_power.go
route/group_power_r/group_power.go
+9
-3
No files found.
common/utils.go
View file @
d40ac5ea
...
@@ -34,9 +34,9 @@ func MakeFullUrl(url string) string {
...
@@ -34,9 +34,9 @@ func MakeFullUrl(url string) string {
func
PageNext
(
total
int64
,
pageIndex
,
pageSize
int
)
(
int
,
bool
)
{
func
PageNext
(
total
int64
,
pageIndex
,
pageSize
int
)
(
int
,
bool
)
{
var
nextIdx
int
var
nextIdx
int
var
hasNext
bool
var
hasNext
bool
if
total
>
int64
(
pageIndex
*
pageSize
)
{
if
total
>
=
int64
(
pageIndex
+
pageSize
)
{
hasNext
=
true
hasNext
=
true
nextIdx
=
pageIndex
+
1
nextIdx
=
pageIndex
+
pageSize
}
}
return
nextIdx
,
hasNext
return
nextIdx
,
hasNext
}
}
domain/model/groupPower_m/family.go
View file @
d40ac5ea
...
@@ -57,7 +57,7 @@ func (gpu *GroupPowerUser) GetBy(model *domain.Model, pageSize, pageIndex int) (
...
@@ -57,7 +57,7 @@ func (gpu *GroupPowerUser) GetBy(model *domain.Model, pageSize, pageIndex int) (
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
0
,
false
,
err
return
nil
,
0
,
0
,
false
,
err
}
}
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
-
1
)
.
Find
(
&
rows
)
.
Error
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
)
.
Find
(
&
rows
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
0
,
false
,
err
return
nil
,
0
,
0
,
false
,
err
}
}
...
@@ -99,7 +99,7 @@ func GroupPowerQuitList(model *domain.Model, familyId uint64, pageSize, pageInde
...
@@ -99,7 +99,7 @@ func GroupPowerQuitList(model *domain.Model, familyId uint64, pageSize, pageInde
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
false
,
err
return
nil
,
0
,
false
,
err
}
}
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
-
1
)
.
Find
(
&
rows
)
.
Error
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
)
.
Find
(
&
rows
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
false
,
err
return
nil
,
0
,
false
,
err
}
}
...
...
domain/model/groupPower_m/group_power_apply.go
View file @
d40ac5ea
...
@@ -73,7 +73,7 @@ func OptGroupPowerApplyList(model *domain.Model, familyId uint64, pageSize, page
...
@@ -73,7 +73,7 @@ func OptGroupPowerApplyList(model *domain.Model, familyId uint64, pageSize, page
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
false
,
err
return
nil
,
0
,
false
,
err
}
}
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
-
1
)
.
Find
(
&
rows
)
.
Error
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
)
.
Find
(
&
rows
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
false
,
err
return
nil
,
0
,
false
,
err
}
}
...
...
domain/model/group_m/groupInfo.go
View file @
d40ac5ea
...
@@ -8,6 +8,7 @@ import (
...
@@ -8,6 +8,7 @@ import (
"github.com/bluele/gcache"
"github.com/bluele/gcache"
"gorm.io/gorm"
"gorm.io/gorm"
"hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/group_e"
"hilo-group/common"
"hilo-group/myerr"
"hilo-group/myerr"
"hilo-group/myerr/bizerr"
"hilo-group/myerr/bizerr"
"math/rand"
"math/rand"
...
@@ -523,15 +524,10 @@ func GetFamilyRooms(model *domain.Model, familyId uint64, pageSize, pageIndex in
...
@@ -523,15 +524,10 @@ func GetFamilyRooms(model *domain.Model, familyId uint64, pageSize, pageIndex in
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
false
,
err
return
nil
,
0
,
false
,
err
}
}
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
(
pageIndex
-
1
)
*
pageSize
)
.
Find
(
&
rows
)
.
Error
err
=
db
.
Limit
(
pageSize
)
.
Offset
(
pageIndex
)
.
Find
(
&
rows
)
.
Error
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
0
,
false
,
err
return
nil
,
0
,
false
,
err
}
}
var
nextIdx
int
nextIdx
,
hasNext
:=
common
.
PageNext
(
count
,
pageIndex
,
pageSize
)
var
hasNext
bool
if
count
>
int64
(
pageIndex
*
pageSize
)
{
hasNext
=
true
nextIdx
=
pageIndex
+
1
}
return
rows
,
nextIdx
,
hasNext
,
nil
return
rows
,
nextIdx
,
hasNext
,
nil
}
}
route/group_power_r/group_power.go
View file @
d40ac5ea
...
@@ -798,7 +798,7 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -798,7 +798,7 @@ func GroupPowerInfo(c *gin.Context) (*mycontext.MyContext, error) {
// @Summary 获取某个家族房间列表
// @Summary 获取某个家族房间列表
// @Param id query int true "家族id"
// @Param id query int true "家族id"
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageIndex query int true "
第几个分页,从1开始 默认:1
" default(1)
// @Param pageIndex query int true "
分页开始索引,偏移量
" default(1)
// @Success 200 {object} []group_cv.PopularGroupInfo
// @Success 200 {object} []group_cv.PopularGroupInfo
// @Router /v1/groupPower/rooms [get]
// @Router /v1/groupPower/rooms [get]
func
GroupPowerRooms
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
func
GroupPowerRooms
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
...
@@ -819,6 +819,9 @@ func GroupPowerRooms(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -819,6 +819,9 @@ func GroupPowerRooms(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
if
pageIndex
==
1
{
pageIndex
=
0
}
model
:=
domain
.
CreateModelContext
(
myContext
)
model
:=
domain
.
CreateModelContext
(
myContext
)
rooms
,
nextPageIndex
,
hasNextPage
,
err
:=
group_m
.
GetFamilyRooms
(
model
,
familyId
,
pageSize
,
pageIndex
)
rooms
,
nextPageIndex
,
hasNextPage
,
err
:=
group_m
.
GetFamilyRooms
(
model
,
familyId
,
pageSize
,
pageIndex
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -838,7 +841,7 @@ func GroupPowerRooms(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -838,7 +841,7 @@ func GroupPowerRooms(c *gin.Context) (*mycontext.MyContext, error) {
// @Param userExtId query string false "用户extId,搜索时输入"
// @Param userExtId query string false "用户extId,搜索时输入"
// @Param id query int true "家族id"
// @Param id query int true "家族id"
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageIndex query int true "
第几个分页,从1开始 默认:1
" default(1)
// @Param pageIndex query int true "
分页开始索引,偏移量
" default(1)
// @Success 200 {object} []group_power_cv.FamilyMemberDetail
// @Success 200 {object} []group_power_cv.FamilyMemberDetail
// @Router /v1/groupPower/members [get]
// @Router /v1/groupPower/members [get]
func
GroupPowerMembers
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
func
GroupPowerMembers
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
...
@@ -859,6 +862,9 @@ func GroupPowerMembers(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -859,6 +862,9 @@ func GroupPowerMembers(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
if
pageIndex
==
1
{
pageIndex
=
0
}
model
:=
domain
.
CreateModelContext
(
myContext
)
model
:=
domain
.
CreateModelContext
(
myContext
)
userExtId
:=
c
.
Query
(
"userExtId"
)
userExtId
:=
c
.
Query
(
"userExtId"
)
...
@@ -1036,7 +1042,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1036,7 +1042,7 @@ func GroupPowerApplyPass(c *gin.Context) (*mycontext.MyContext, error) {
// @Tags 家族
// @Tags 家族
// @Summary 申请加入列表
// @Summary 申请加入列表
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageSize query int true "分页大小 默认:10" default(10)
// @Param pageIndex query int true "
第几个分页,从1开始 默认:1
" default(1)
// @Param pageIndex query int true "
分页开始索引,偏移量
" default(1)
// @Success 200
// @Success 200
// @Router /v1/groupPower/apply/list [get]
// @Router /v1/groupPower/apply/list [get]
func
GroupPowerApplyList
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
func
GroupPowerApplyList
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment