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
c114da63
Commit
c114da63
authored
Jul 25, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
家族送礼排行
parent
25f747e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
52 deletions
+81
-52
group_power.go
route/group_power_r/group_power.go
+63
-0
group_rank.go
route/group_power_r/group_rank.go
+17
-52
router.go
route/router.go
+1
-0
No files found.
route/group_power_r/group_power.go
View file @
c114da63
...
...
@@ -1624,3 +1624,66 @@ func GroupPowerSetInfo(c *gin.Context) (*mycontext.MyContext, error) {
resp
.
ResponseOk
(
c
,
info
)
return
myContext
,
nil
}
// @Tags 国家势力
// @Summary 搜索家族
// @Success 200 {object} group_power_cv.CvGroupPowerRankMontAct
// @Router /v1/h5/groupPower/rank/month [get]
func
GroupPowerMonthRankAct
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
if
err
!=
nil
{
return
myContext
,
err
}
var
model
=
domain
.
CreateModelContext
(
myContext
)
// 国家区域
var
area
int
// 我的家族
myGroupPower
,
err
:=
groupPower_m
.
GetGroupPowerUserOrNil
(
model
,
userId
)
if
err
!=
nil
{
return
myContext
,
err
}
if
myGroupPower
!=
nil
&&
myGroupPower
.
GroupPowerId
>
0
{
//获取势力主
mgrUserId
,
err
:=
groupPower_m
.
GetGroupPowerMgr
(
model
,
myGroupPower
.
GroupPowerId
)
if
err
!=
nil
{
return
myContext
,
err
}
_
,
area
,
err
=
user_m
.
GetUserCountryArea
(
model
,
mgrUserId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v"
,
userId
,
err
)
return
myContext
,
err
}
}
if
area
==
0
{
_
,
area
,
err
=
user_m
.
GetUserCountryArea
(
model
,
userId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v"
,
userId
,
err
)
return
myContext
,
err
}
}
// 这个月
beginDate
,
endDate
:=
now
.
BeginningOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
),
now
.
EndOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
)
response
,
err
:=
GroupPowerMonthRankActByMonth
(
model
,
userId
,
beginDate
,
endDate
,
time
.
Now
()
.
Format
(
utils
.
COMPACT_MONTH_FORMAT
),
area
)
if
err
!=
nil
{
return
myContext
,
err
}
// 上月
lastMonthStart
:=
utils
.
GetLastMonthStart
(
time
.
Now
())
lastTime
:=
now
.
New
(
lastMonthStart
)
beginDateLast
,
endDateLast
:=
lastTime
.
BeginningOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
),
lastTime
.
EndOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
)
responseLast
,
err
:=
GroupPowerMonthRankActByMonth
(
model
,
userId
,
beginDateLast
,
endDateLast
,
lastMonthStart
.
Format
(
utils
.
COMPACT_MONTH_FORMAT
),
area
)
if
err
!=
nil
{
return
myContext
,
err
}
res
:=
&
group_power_cv
.
CvGroupPowerRankMontAct
{
MyGroupPower
:
response
.
MyGroupPower
,
Items
:
response
.
Items
,
MyGroupPowerLast
:
responseLast
.
MyGroupPower
,
ItemsLast
:
responseLast
.
Items
,
LeftSecond
:
now
.
EndOfMonth
()
.
Unix
()
-
time
.
Now
()
.
Unix
(),
}
resp
.
ResponseOk
(
c
,
res
)
return
myContext
,
nil
}
route/group_power_r/group_rank.go
View file @
c114da63
...
...
@@ -56,65 +56,30 @@ func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) {
}
// @Tags 国家势力
// @Summary 家族榜单-活动
// @Success 200 {object} group_power_cv.CvGroupPowerRankMontAct
// @Router /v1/h5/groupPower/rank/month [get]
func
GroupPowerMonthRankAct
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
// @Summary 搜索家族
// @Param id query int true "家族id"
// @Success 200
// @Router /v1/h5/groupPower/info [get]
func
H5GetGroupPowerInfo
(
c
*
gin
.
Context
)
(
*
mycontext
.
MyContext
,
error
)
{
myContext
:=
mycontext
.
CreateMyContext
(
c
.
Keys
)
userId
,
err
:=
req
.
GetUserId
(
c
)
if
err
!=
nil
{
return
myContext
,
err
}
var
model
=
domain
.
CreateModelContext
(
myContext
)
// 国家区域
var
area
int
// 我的家族
myGroupPower
,
err
:=
groupPower_m
.
GetGroupPowerUserOrNil
(
model
,
userId
)
if
err
!=
nil
{
return
myContext
,
err
}
if
myGroupPower
!=
nil
&&
myGroupPower
.
GroupPowerId
>
0
{
//获取势力主
mgrUserId
,
err
:=
groupPower_m
.
GetGroupPowerMgr
(
model
,
myGroupPower
.
GroupPowerId
)
if
err
!=
nil
{
return
myContext
,
err
}
_
,
area
,
err
=
user_m
.
GetUserCountryArea
(
model
,
mgrUserId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v"
,
userId
,
err
)
return
myContext
,
err
}
}
if
area
==
0
{
_
,
area
,
err
=
user_m
.
GetUserCountryArea
(
model
,
userId
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GroupPowerMonthRankAct 获取国家资源错误 userId:%d, err:%v"
,
userId
,
err
)
return
myContext
,
err
}
familyId
,
err
:=
strconv
.
ParseUint
(
c
.
Query
(
"id"
),
10
,
64
)
if
err
!=
nil
||
familyId
<=
0
{
return
myContext
,
bizerr
.
InvalidParameter
}
// 这个月
beginDate
,
endDate
:=
now
.
BeginningOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
),
now
.
EndOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
)
response
,
err
:=
GroupPowerMonthRankActByMonth
(
model
,
userId
,
beginDate
,
endDate
,
time
.
Now
()
.
Format
(
utils
.
COMPACT_MONTH_FORMAT
),
area
)
model
:=
domain
.
CreateModelContext
(
myContext
)
info
,
err
:=
groupPower_m
.
GetGroupPower
(
model
,
familyId
)
if
err
!=
nil
{
return
myContext
,
err
}
// 上月
lastMonthStart
:=
utils
.
GetLastMonthStart
(
time
.
Now
())
lastTime
:=
now
.
New
(
lastMonthStart
)
beginDateLast
,
endDateLast
:=
lastTime
.
BeginningOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
),
lastTime
.
EndOfMonth
()
.
Format
(
utils
.
DATE_FORMAT
)
responseLast
,
err
:=
GroupPowerMonthRankActByMonth
(
model
,
userId
,
beginDateLast
,
endDateLast
,
lastMonthStart
.
Format
(
utils
.
COMPACT_MONTH_FORMAT
),
area
)
if
err
!=
nil
{
return
myContext
,
err
type
Family
struct
{
Id
uint64
`json:"id,omitempty"`
Avatar
string
`json:"avatar"`
Nick
string
`json:"nick"`
}
res
:=
&
group_power_cv
.
CvGroupPowerRankMontAct
{
MyGroupPower
:
response
.
MyGroupPower
,
Items
:
response
.
Items
,
MyGroupPowerLast
:
responseLast
.
MyGroupPower
,
ItemsLast
:
responseLast
.
Items
,
LeftSecond
:
now
.
EndOfMonth
()
.
Unix
()
-
time
.
Now
()
.
Unix
(),
}
resp
.
ResponseOk
(
c
,
res
)
resp
.
ResponseOk
(
c
,
Family
{
Id
:
info
.
ID
,
Avatar
:
info
.
Icon
,
Nick
:
info
.
Name
})
return
myContext
,
nil
}
...
...
route/router.go
View file @
c114da63
...
...
@@ -147,6 +147,7 @@ func InitRouter() *gin.Engine {
{
h5GroupPower
.
GET
(
"/grade/detail"
,
wrapper
(
group_power_r
.
GroupPowerGradeDetail
))
h5GroupPower
.
GET
(
"/rank/month"
,
wrapper
(
group_power_r
.
GroupPowerMonthRankAct
))
h5GroupPower
.
GET
(
"/info"
,
wrapper
(
group_power_r
.
H5GetGroupPowerInfo
))
}
charge
:=
v1
.
Group
(
"/charge"
)
...
...
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