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
31773288
Commit
31773288
authored
Aug 25, 2023
by
chenweijian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
group support
parent
dbaf767b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
53 deletions
+69
-53
gift.go
domain/model/gift_m/gift.go
+33
-33
group_support.go
domain/service/group_s/group_support.go
+20
-12
group_support.go
route/group_r/group_support.go
+16
-8
No files found.
domain/model/gift_m/gift.go
View file @
31773288
...
...
@@ -128,39 +128,39 @@ func (g *GiftOperate) GetConsumeByRange(beginTime, endTime time.Time) (uint32, u
return
0
,
0
,
nil
}
if
beginTime
.
Unix
()
>=
1691337600
&&
beginTime
.
Unix
()
<
1691942400
{
// 因为这周水果机被部分人刷币,所以这里做了特殊的处理
reduceMap
:=
map
[
string
]
uint64
{
"HTGS#a63226380"
:
20000000
,
//"HTGS#a42641278": 10000000,
"@TGS#3ZZ5GZLHA"
:
27141539
,
"HTGS#a81630128"
:
8955410
,
"HTGS#a42300598"
:
50211301
,
"HTGS#a40088696"
:
10000000
,
"HTGS#a21700997"
:
14352310
,
"HTGS#a83608384"
:
49644203
,
"@TGS#33GDXTSIH"
:
50000000
,
"HTGS#a50538513"
:
15000000
,
"HTGS#a77282385"
:
15000000
,
"HTGS#a59437326"
:
10000000
,
"HTGS#a16909405"
:
10000000
,
"HTGS#a44104431"
:
16861206
,
"HTGS#a56794634"
:
59591313
,
"HTGS#a11286025"
:
31232311
,
"HTGS#a17238550"
:
52309338
,
"HTGS#a83592361"
:
79545067
,
"HTGS#a39882521"
:
10255093
,
}
if
reduceNum
,
ok
:=
reduceMap
[
g
.
SceneUid
];
ok
{
if
g
.
Log
!=
nil
{
g
.
Log
.
Infof
(
"fruit diamond reduceMap,groupId:%v,reduceNum:%v"
,
g
.
SceneUid
,
reduceNum
)
}
if
rows
[
0
]
.
Consume
>=
reduceNum
{
rows
[
0
]
.
Consume
-=
reduceNum
}
else
{
rows
[
0
]
.
Consume
=
0
}
}
}
//
if beginTime.Unix() >= 1691337600 && beginTime.Unix() < 1691942400 { // 因为这周水果机被部分人刷币,所以这里做了特殊的处理
//
reduceMap := map[string]uint64{
//
"HTGS#a63226380": 20000000,
//
//"HTGS#a42641278": 10000000,
//
"@TGS#3ZZ5GZLHA": 27141539,
//
"HTGS#a81630128": 8955410,
//
"HTGS#a42300598": 50211301,
//
"HTGS#a40088696": 10000000,
//
"HTGS#a21700997": 14352310,
//
"HTGS#a83608384": 49644203,
//
"@TGS#33GDXTSIH": 50000000,
//
"HTGS#a50538513": 15000000,
//
"HTGS#a77282385": 15000000,
//
"HTGS#a59437326": 10000000,
//
"HTGS#a16909405": 10000000,
//
"HTGS#a44104431": 16861206,
//
"HTGS#a56794634": 59591313,
//
"HTGS#a11286025": 31232311,
//
"HTGS#a17238550": 52309338,
//
"HTGS#a83592361": 79545067,
//
"HTGS#a39882521": 10255093,
//
}
//
if reduceNum, ok := reduceMap[g.SceneUid]; ok {
//
if g.Log != nil {
//
g.Log.Infof("fruit diamond reduceMap,groupId:%v,reduceNum:%v", g.SceneUid, reduceNum)
//
}
//
if rows[0].Consume >= reduceNum {
//
rows[0].Consume -= reduceNum
//
} else {
//
rows[0].Consume = 0
//
}
//
}
//
}
return
rows
[
0
]
.
C
,
rows
[
0
]
.
Consume
,
nil
}
...
...
domain/service/group_s/group_support.go
View file @
31773288
...
...
@@ -206,22 +206,12 @@ func (s *GroupService) GetSupportLevelByRedis(groupId string) (*res_m.ResGroupSu
model
:=
domain
.
CreateModel
(
s
.
svc
.
CtxAndDb
)
_
,
_
,
period
:=
group_m
.
GetLastSupportPeriod
(
time
.
Now
())
// 流水
keyDiamond
:=
rediskey
.
GetGroupSupportConsumeSummary
(
period
)
consume
,
err
:=
model
.
RedisCluster
.
ZScore
(
context
.
Background
(),
keyDiamond
,
groupId
)
.
Result
()
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetSupportLevelByRedis key:%v, groupId:%v, err:%v"
,
keyDiamond
,
groupId
,
err
)
return
nil
,
0
,
err
}
// 支持者数量
keySupportNum
:=
rediskey
.
GetGroupSupportCountSupporter
(
period
,
groupId
)
count
,
err
:=
model
.
RedisCluster
.
SCard
(
context
.
Background
(),
keySupportNum
)
.
Result
()
consume
,
count
,
err
:=
GetGroupConsumeCount
(
model
,
groupId
,
period
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetSupportLevelByRedis key:%v, groupId:%v, err:%v"
,
keySupportNum
,
groupId
,
err
)
return
nil
,
0
,
err
}
rec
,
err
:=
res_m
.
GetResGroupSupportBy
(
model
,
uint32
(
count
),
uint64
(
consume
)
)
rec
,
err
:=
res_m
.
GetResGroupSupportBy
(
model
,
count
,
consume
)
if
err
!=
nil
{
return
nil
,
0
,
err
}
...
...
@@ -231,6 +221,24 @@ func (s *GroupService) GetSupportLevelByRedis(groupId string) (*res_m.ResGroupSu
return
rec
,
0
,
nil
}
func
GetGroupConsumeCount
(
model
*
domain
.
Model
,
imGroupId
,
period
string
)
(
uint64
,
uint32
,
error
)
{
// 流水
keyDiamond
:=
rediskey
.
GetGroupSupportConsumeSummary
(
period
)
consume
,
err
:=
model
.
RedisCluster
.
ZScore
(
context
.
Background
(),
keyDiamond
,
imGroupId
)
.
Result
()
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetSupportLevelByRedis key:%v, groupId:%v, err:%v"
,
keyDiamond
,
imGroupId
,
err
)
return
0
,
0
,
err
}
// 支持者数量
keySupportNum
:=
rediskey
.
GetGroupSupportCountSupporter
(
period
,
imGroupId
)
count
,
err
:=
model
.
RedisCluster
.
SCard
(
context
.
Background
(),
keySupportNum
)
.
Result
()
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetSupportLevelByRedis key:%v, groupId:%v, err:%v"
,
keySupportNum
,
imGroupId
,
err
)
return
0
,
0
,
err
}
return
uint64
(
consume
),
uint32
(
count
),
nil
}
//群组支持奖励
func
(
s
*
GroupService
)
GroupSupportAward
(
groupId
string
,
profitAllocator
uint64
,
userIds
[]
uint64
,
resSupport
*
res_m
.
ResGroupSupport
,
period
string
,
groupInfo
*
group_m
.
GroupInfo
)
error
{
...
...
route/group_r/group_support.go
View file @
31773288
...
...
@@ -6,13 +6,11 @@ import (
"git.hilo.cn/hilo-common/mycontext"
"git.hilo.cn/hilo-common/resource/mysql"
"github.com/gin-gonic/gin"
"hilo-group/_const/enum/gift_e"
"hilo-group/_const/enum/group_e"
"hilo-group/_const/enum/msg_e"
"hilo-group/cv/group_cv"
"hilo-group/cv/user_cv"
"hilo-group/domain/cache/group_c"
"hilo-group/domain/model/gift_m"
"hilo-group/domain/model/group_m"
"hilo-group/domain/model/res_m"
"hilo-group/domain/model/user_m"
...
...
@@ -111,18 +109,28 @@ func GetSupportDetail(c *gin.Context) (*mycontext.MyContext, error) {
result
:=
group_cv
.
SupportPageDetail
{
GroupId
:
txGroupId
}
now
:=
time
.
Now
()
beginTime
,
endTime
,
_
:=
group_m
.
GetSupportLevelTime
(
now
)
_
,
endTime
,
period
:=
group_m
.
GetSupportLevelTime
(
now
)
result
.
RemainSecond
=
endTime
.
Unix
()
-
now
.
Unix
()
g
:=
gift_m
.
GiftOperate
{
SceneType
:
gift_e
.
GroupSceneType
,
SceneUid
:
groupId
,
Model
:
model
}
result
.
CurrentCount
,
result
.
CurrentConsume
,
err
=
g
.
GetConsumeByRange
(
beginTime
,
endTime
)
//g := gift_m.GiftOperate{SceneType: gift_e.GroupSceneType, SceneUid: groupId, Model: model}
//result.CurrentCount, result.CurrentConsume, err = g.GetConsumeByRange(beginTime, endTime)
//if err != nil {
// return myContext, err
//}
result
.
CurrentConsume
,
result
.
CurrentCount
,
err
=
group_s
.
GetGroupConsumeCount
(
model
,
groupId
,
period
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetSupportDetail groupId:%s, err:%v"
,
groupId
,
err
)
return
myContext
,
err
}
beginTime
,
endTime
,
_
=
group_m
.
GetSupportLevelTime
(
now
.
AddDate
(
0
,
0
,
-
group_e
.
SUPPORT_LEVEL_PERIOD_DAY
))
result
.
LastCount
,
result
.
LastConsume
,
err
=
g
.
GetConsumeByRange
(
beginTime
,
endTime
)
_
,
_
,
periodLast
:=
group_m
.
GetSupportLevelTime
(
now
.
AddDate
(
0
,
0
,
-
group_e
.
SUPPORT_LEVEL_PERIOD_DAY
))
//result.LastCount, result.LastConsume, err = g.GetConsumeByRange(beginTimeLast, endTimeLast)
//if err != nil {
// return myContext, err
//}
result
.
LastConsume
,
result
.
LastCount
,
err
=
group_s
.
GetGroupConsumeCount
(
model
,
groupId
,
periodLast
)
if
err
!=
nil
{
model
.
Log
.
Errorf
(
"GetSupportDetail groupId:%s, err:%v"
,
groupId
,
err
)
return
myContext
,
err
}
...
...
@@ -152,7 +160,7 @@ func GetSupportDetail(c *gin.Context) (*mycontext.MyContext, error) {
}
// 判断这个周期这个群的奖金是否已经发过
_
,
_
,
period
:
=
group_m
.
GetLastSupportPeriod
(
now
)
_
,
_
,
period
=
group_m
.
GetLastSupportPeriod
(
now
)
gsaa
:=
group_m
.
GroupSupportAwardAdmin
{
Period
:
period
,
GroupUid
:
groupId
}
rows
,
err
:=
gsaa
.
Get
(
model
.
Db
)
if
err
!=
nil
{
...
...
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