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
06790632
Commit
06790632
authored
Mar 21, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:补全myGroupOPwer
parent
fdf023a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
14 deletions
+36
-14
group_rank.go
domain/model/groupPower_m/group_rank.go
+15
-0
group_rank.go
route/group_power_r/group_rank.go
+21
-14
No files found.
domain/model/groupPower_m/group_rank.go
View file @
06790632
...
...
@@ -3,6 +3,7 @@ package groupPower_m
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/mysql"
"gorm.io/gorm"
)
type
GroupPowerExpRank
struct
{
...
...
@@ -26,6 +27,20 @@ func GetGroupPowerExpRank(model *domain.Model, beginDate, endDate string, limit
return
res
,
nil
}
// 获取我的家族经验排行榜
func
GetMyGroupPowerExpRank
(
model
*
domain
.
Model
,
beginDate
,
endDate
string
,
groupPowerId
uint64
)
(
GroupPowerExpRank
,
error
)
{
var
res
GroupPowerExpRank
if
err
:=
model
.
DB
()
.
Table
(
"group_power_day_exp"
)
.
Select
(
"group_power_id,SUM(exp) as exp"
)
.
Where
(
"date BETWEEN ? AND ? AND group_power_id = ?"
,
beginDate
,
endDate
,
groupPowerId
)
.
Group
(
"group_power_id"
)
.
First
(
&
res
)
.
Error
;
err
!=
nil
{
if
err
!=
gorm
.
ErrRecordNotFound
{
model
.
Log
.
Errorf
(
"GetMyGroupPowerExpRank fail:%v"
,
err
)
return
res
,
err
}
return
res
,
nil
}
return
res
,
nil
}
// 获取我的家族月排名是多少,超过30则返回31
func
GetGroupPowerExpRankById
(
model
*
domain
.
Model
,
beginDate
,
endDate
string
,
limit
int
,
groupPowerId
uint64
)
(
int
,
error
)
{
var
res
[]
GroupPowerExpRank
...
...
route/group_power_r/group_rank.go
View file @
06790632
...
...
@@ -70,21 +70,28 @@ func GroupPowerRank(c *gin.Context) (*mycontext.MyContext, error) {
if
err
!=
nil
{
return
myContext
,
err
}
if
myGroupPower
!=
nil
&&
myGroupPower
.
Role
==
groupPower_e
.
GroupPowerUserRoleMgr
{
myGroupPowerRank
,
err
:=
groupPower_m
.
GetMyGroupPowerExpRank
(
model
,
beginDate
,
endDate
,
myGroupPower
.
GroupPowerId
)
if
err
!=
nil
{
return
myContext
,
err
}
response
.
MyGroupPower
=
&
group_power_cv
.
CvGroupPowerRankData
{
CvGroupPowerBase
:
group_power_cv
.
CvGroupPowerBase
{
Id
:
myGroupPower
.
GroupPowerId
,
Icon
:
groupPowers
[
myGroupPower
.
GroupPowerId
]
.
Icon
,
Name
:
groupPowers
[
myGroupPower
.
GroupPowerId
]
.
Name
,
Nameplate
:
groupPowers
[
myGroupPower
.
GroupPowerId
]
.
Nameplate
,
},
CvGroupPowerGrade
:
group_power_cv
.
CvGroupPowerGrade
{
Grade
:
grades
[
myGroupPower
.
GroupPowerId
]
.
Grade
,
Exp
:
myGroupPowerRank
.
Exp
,
},
Rank
:
0
,
}
}
for
_
,
v
:=
range
rank
{
if
myGroupPower
!=
nil
&&
v
.
GroupPowerId
==
myGroupPower
.
GroupPowerId
&&
myGroupPower
.
Role
==
groupPower_e
.
GroupPowerUserRoleMgr
{
response
.
MyGroupPower
=
&
group_power_cv
.
CvGroupPowerRankData
{
CvGroupPowerBase
:
group_power_cv
.
CvGroupPowerBase
{
Id
:
myGroupPower
.
GroupPowerId
,
Icon
:
groupPowers
[
myGroupPower
.
GroupPowerId
]
.
Icon
,
Name
:
groupPowers
[
myGroupPower
.
GroupPowerId
]
.
Name
,
Nameplate
:
groupPowers
[
myGroupPower
.
GroupPowerId
]
.
Nameplate
,
},
CvGroupPowerGrade
:
group_power_cv
.
CvGroupPowerGrade
{
Grade
:
grades
[
myGroupPower
.
GroupPowerId
]
.
Grade
,
Exp
:
v
.
Exp
,
},
Rank
:
v
.
Rank
,
}
if
response
.
MyGroupPower
!=
nil
&&
v
.
GroupPowerId
==
response
.
MyGroupPower
.
Id
{
response
.
MyGroupPower
.
Rank
=
v
.
Rank
}
response
.
Items
=
append
(
response
.
Items
,
group_power_cv
.
CvGroupPowerRankData
{
CvGroupPowerBase
:
group_power_cv
.
CvGroupPowerBase
{
...
...
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