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
016a61f5
Commit
016a61f5
authored
Aug 28, 2023
by
chenweijian
Committed by
hujiebin
Aug 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix/group country
parent
cb4a4fad
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
7 deletions
+59
-7
support.go
domain/model/group_m/support.go
+18
-0
group.go
domain/service/group_s/group.go
+34
-0
group_list.go
domain/service/group_s/group_list.go
+5
-5
group_list.go
route/group_r/group_list.go
+1
-1
router.go
route/router.go
+1
-1
No files found.
domain/model/group_m/support.go
View file @
016a61f5
...
@@ -57,6 +57,24 @@ func GetAllGroupSupportResult(db *gorm.DB, period string) (map[string]uint8, err
...
@@ -57,6 +57,24 @@ func GetAllGroupSupportResult(db *gorm.DB, period string) (map[string]uint8, err
return
result
,
nil
return
result
,
nil
}
}
func
GetGroupSupportResult
(
db
*
gorm
.
DB
,
period
string
,
groupIds
[]
string
)
(
map
[
string
]
uint8
,
error
)
{
if
len
(
period
)
<=
0
{
return
nil
,
nil
}
gsr
:=
GroupSupportResult
{
Period
:
period
,
}
rows
:=
make
([]
GroupSupportResult
,
0
)
if
err
:=
db
.
Where
(
gsr
)
.
Where
(
"group_uid in (?)"
,
groupIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
return
nil
,
err
}
result
:=
make
(
map
[
string
]
uint8
)
for
_
,
i
:=
range
rows
{
result
[
i
.
GroupUid
]
=
i
.
Grade
}
return
result
,
nil
}
//群组扶持奖励,利益分配者
//群组扶持奖励,利益分配者
type
GroupSupportAwardAdmin
struct
{
type
GroupSupportAwardAdmin
struct
{
mysql
.
Entity
mysql
.
Entity
...
...
domain/service/group_s/group.go
View file @
016a61f5
...
@@ -65,6 +65,40 @@ func (s *GroupService) GetSupportLevelMap(now time.Time) (map[string]uint8, erro
...
@@ -65,6 +65,40 @@ func (s *GroupService) GetSupportLevelMap(now time.Time) (map[string]uint8, erro
return
result
,
nil
return
result
,
nil
}
}
// 取本周最高的扶持等级
func
(
s
*
GroupService
)
GetWeekMaxSupportLevelMapByIds
(
groupIds
[]
string
)
(
map
[
string
]
uint8
,
error
)
{
return
s
.
GetSupportLevelMapByIds
(
groupIds
,
time
.
Now
()
.
AddDate
(
0
,
0
,
-
group_e
.
SUPPORT_LEVEL_PERIOD_DAY
))
}
func
(
s
*
GroupService
)
GetSupportLevelMapByIds
(
groupIds
[]
string
,
now
time
.
Time
)
(
map
[
string
]
uint8
,
error
)
{
model
:=
domain
.
CreateModel
(
s
.
svc
.
CtxAndDb
)
_
,
_
,
period
:=
group_m
.
GetSupportLevelTime
(
now
)
levels
,
err
:=
GetAllSupportLevel
(
model
,
period
)
if
err
!=
nil
{
return
nil
,
err
}
model
.
Log
.
Debugf
(
"GetSupportLevelMapByIds, GET %s: %v"
,
period
,
levels
)
result
:=
make
(
map
[
string
]
uint8
,
0
)
if
len
(
levels
)
>
0
{
for
g
,
l
:=
range
levels
{
le
,
err
:=
strconv
.
ParseUint
(
l
,
10
,
8
)
if
err
==
nil
{
result
[
g
]
=
uint8
(
le
)
}
}
}
else
{
result
,
err
=
group_m
.
GetGroupSupportResult
(
model
.
DB
(),
period
,
groupIds
)
if
err
==
nil
{
ret
,
err
:=
SaveAllSupportLevel
(
model
,
period
,
result
)
model
.
Log
.
Infof
(
"GetSupportLevelMapByIds SAVE ret = %d, err: %v"
,
ret
,
err
)
}
}
return
result
,
nil
}
func
SaveAllSupportLevel
(
model
*
domain
.
Model
,
date
string
,
levels
map
[
string
]
uint8
)
(
int64
,
error
)
{
func
SaveAllSupportLevel
(
model
*
domain
.
Model
,
date
string
,
levels
map
[
string
]
uint8
)
(
int64
,
error
)
{
values
:=
make
(
map
[
string
]
interface
{},
0
)
values
:=
make
(
map
[
string
]
interface
{},
0
)
for
g
,
l
:=
range
levels
{
for
g
,
l
:=
range
levels
{
...
...
domain/service/group_s/group_list.go
View file @
016a61f5
...
@@ -129,11 +129,11 @@ func GetGroupSortList(model *domain.Model, country string) ([]string, error) {
...
@@ -129,11 +129,11 @@ func GetGroupSortList(model *domain.Model, country string) ([]string, error) {
model
.
Log
.
Infof
(
"GroupCountryListSort, diamonds in 30 mins: %v"
,
diamonds
)
model
.
Log
.
Infof
(
"GroupCountryListSort, diamonds in 30 mins: %v"
,
diamonds
)
model
.
Log
.
Infof
(
"GroupCountryListSort cost3:%v"
,
time
.
Now
()
.
Sub
(
beginTime
))
model
.
Log
.
Infof
(
"GroupCountryListSort cost3:%v"
,
time
.
Now
()
.
Sub
(
beginTime
))
supportLevels
,
err
:=
NewGroupService
(
model
.
MyContext
)
.
GetWeekMaxSupportLevelMap
()
//
supportLevels, err := NewGroupService(model.MyContext).GetWeekMaxSupportLevelMap()
if
err
!=
nil
{
//
if err != nil {
return
nil
,
err
//
return nil, err
}
//
}
model
.
Log
.
Infof
(
"GroupCountryListSort, supportLevels : %v"
,
supportLevels
)
//
model.Log.Infof("GroupCountryListSort, supportLevels : %v", supportLevels)
model
.
Log
.
Infof
(
"GroupCountryListSort cost4:%v"
,
time
.
Now
()
.
Sub
(
beginTime
))
model
.
Log
.
Infof
(
"GroupCountryListSort cost4:%v"
,
time
.
Now
()
.
Sub
(
beginTime
))
// 排序优先级2022-07-25
// 排序优先级2022-07-25
...
...
route/group_r/group_list.go
View file @
016a61f5
...
@@ -1555,7 +1555,7 @@ func GetGroupByCountryV2(c *gin.Context) (*mycontext.MyContext, error) {
...
@@ -1555,7 +1555,7 @@ func GetGroupByCountryV2(c *gin.Context) (*mycontext.MyContext, error) {
// 正在进行的游戏
// 正在进行的游戏
games
:=
game_m
.
GetNotEndGamesMap
(
model
)
games
:=
game_m
.
GetNotEndGamesMap
(
model
)
// 扶持等级
// 扶持等级
supportLevels
,
err
:=
group_s
.
NewGroupService
(
myContext
)
.
GetWeekMaxSupportLevelMap
(
)
supportLevels
,
err
:=
group_s
.
NewGroupService
(
myContext
)
.
GetWeekMaxSupportLevelMap
ByIds
(
groupIds
)
if
err
!=
nil
{
if
err
!=
nil
{
return
myContext
,
err
return
myContext
,
err
}
}
...
...
route/router.go
View file @
016a61f5
...
@@ -106,7 +106,7 @@ func InitRouter() *gin.Engine {
...
@@ -106,7 +106,7 @@ func InitRouter() *gin.Engine {
imGroup
.
POST
(
"/mgr/clearScreen"
,
wrapper
(
group_r
.
GroupMgrClearScreen
))
imGroup
.
POST
(
"/mgr/clearScreen"
,
wrapper
(
group_r
.
GroupMgrClearScreen
))
imGroup
.
GET
(
"/online/users"
,
wrapper
(
group_r
.
GroupInUsers
))
imGroup
.
GET
(
"/online/users"
,
wrapper
(
group_r
.
GroupInUsers
))
imGroup
.
GET
(
"/online/users/new"
,
wrapper
(
group_r
.
GroupInUserNew
))
imGroup
.
GET
(
"/online/users/new"
,
wrapper
(
group_r
.
GroupInUserNew
))
imGroup
.
GET
(
"/country"
,
wrapper
(
group_r
.
GetGroupByCountry
))
imGroup
.
GET
(
"/country"
,
wrapper
(
group_r
.
GetGroupByCountry
V2
))
imGroup
.
GET
(
"/country/prior"
,
wrapper
(
group_r
.
GroupountryPrior
))
imGroup
.
GET
(
"/country/prior"
,
wrapper
(
group_r
.
GroupountryPrior
))
//
//
imGroup
.
POST
(
"/theme/custom"
,
wrapper
(
group_r
.
GroupThemeAdd
))
imGroup
.
POST
(
"/theme/custom"
,
wrapper
(
group_r
.
GroupThemeAdd
))
...
...
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