Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-user
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
chenweijian
hilo-user
Commits
ba6d7beb
Commit
ba6d7beb
authored
Aug 21, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Feature/gift queue
parent
0d71184f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
263 additions
and
161 deletions
+263
-161
cron.go
cron/cron.go
+3
-2
send_gift_redis.go
cron/gift_cron/send_gift_redis.go
+79
-0
gift_event.go
domain/cache/gift_c/gift_event.go
+34
-0
cp_level.go
domain/service/event_s/cp_level.go
+146
-158
event_init.go
domain/service/event_s/event_init.go
+1
-1
No files found.
cron/cron.go
View file @
ba6d7beb
...
@@ -12,8 +12,9 @@ func Init() {
...
@@ -12,8 +12,9 @@ func Init() {
if
!
config
.
IsMaster
()
{
if
!
config
.
IsMaster
()
{
return
return
}
}
gift_cron
.
SendGiftEventInit
()
// 礼物消息
//gift_cron.SendGiftEventInit() // 礼物消息
gift_cron
.
GiftRemark
()
// 礼物消息补偿
//gift_cron.GiftRemark() // 礼物消息补偿
gift_cron
.
SendGiftEvent
()
// 送礼事件
cp_cron
.
ClearCpExpire
()
// 清理过期cp
cp_cron
.
ClearCpExpire
()
// 清理过期cp
cp_cron
.
CpAnniversaryNotice
()
// cp纪念日
cp_cron
.
CpAnniversaryNotice
()
// cp纪念日
cp_cron
.
CpInviteCancelInit
()
// cp邀请、解除到期结算
cp_cron
.
CpInviteCancelInit
()
// cp邀请、解除到期结算
...
...
cron/gift_cron/send_gift_redis.go
0 → 100644
View file @
ba6d7beb
package
gift_cron
import
(
"git.hilo.cn/hilo-common/domain"
"github.com/jinzhu/now"
"hilo-user/_const/enum/cp_e"
"hilo-user/domain/cache/gift_c"
"hilo-user/domain/event/gift_ev"
"hilo-user/domain/model/cp_m"
"time"
)
// 送礼事件
func
SendGiftEvent
()
{
//if !config.IsMaster() {
// return
//}
go
func
()
{
for
true
{
model
:=
domain
.
CreateModelNil
()
if
sendGiftEvent
:=
gift_c
.
BLPopQueueSendGift
(
model
);
sendGiftEvent
!=
nil
{
cpGiftEvent
(
model
,
sendGiftEvent
)
// cp送礼
}
}
}()
}
// 送礼增加cp等级
// 送礼增加cp排行榜
func
cpGiftEvent
(
model
*
domain
.
Model
,
sendGiftEvent
*
gift_ev
.
SendGiftEvent
)
{
// 只处理cp礼物
if
!
sendGiftEvent
.
ResGift
.
Cp
{
return
}
for
_
,
receiverUid
:=
range
sendGiftEvent
.
ReceiveUserIds
{
diamonds
:=
sendGiftEvent
.
GiftN
*
sendGiftEvent
.
ResGift
.
DiamondNum
// 有cp关系
if
cpRelation
,
exits
:=
cp_m
.
GetCpRelationPair
(
model
,
sendGiftEvent
.
SendUserId
,
receiverUid
);
exits
{
if
err
:=
cp_m
.
AddCpLevelPoints
(
model
,
cpRelation
,
diamonds
,
sendGiftEvent
.
SceneType
,
sendGiftEvent
.
SceneUid
);
err
!=
nil
{
model
.
Log
.
Errorf
(
"AddCpLevelPoints fail:%v"
,
err
)
}
if
err
:=
cp_m
.
AddCpDayRank
(
model
,
cpRelation
,
diamonds
);
err
!=
nil
{
model
.
Log
.
Errorf
(
"AddCpDayRank fail:%v"
,
err
)
}
// 检查最新的等级
if
cpLevel
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
Id
);
cpLevel
.
CpId
>=
0
{
points
:=
cpLevel
.
Points
+
cp_e
.
CpLevelPoints
[
cpLevel
.
Level
]
if
err
:=
cp_m
.
UpdateCpAchievement
(
model
,
cpLevel
.
CpId
,
cpRelation
.
UserId1
,
cpRelation
.
UserId2
,
cp_e
.
CpAchievementLevel
,
points
);
err
!=
nil
{
model
.
Log
.
Errorf
(
"UpdateCpAchievement fail:%v"
,
err
)
}
}
// 检查最高的分数
for
_
,
queryType
:=
range
[]
string
{
"day"
,
"week"
,
"month"
}
{
var
beginDate
,
endDate
string
var
cpAchievementType
cp_e
.
CpAchievement
switch
queryType
{
case
"day"
:
beginDate
,
endDate
=
time
.
Now
()
.
Format
(
"2006-01-02"
),
time
.
Now
()
.
Format
(
"2006-01-02"
)
cpAchievementType
=
cp_e
.
CpAchievementDayRank
case
"week"
:
beginDate
=
now
.
BeginningOfWeek
()
.
Format
(
"2006-01-02"
)
endDate
=
now
.
EndOfWeek
()
.
Format
(
"2006-01-02"
)
cpAchievementType
=
cp_e
.
CpAchievementWeekRank
case
"month"
:
beginDate
=
now
.
BeginningOfMonth
()
.
Format
(
"2006-01-02"
)
endDate
=
now
.
EndOfMonth
()
.
Format
(
"2006-01-02"
)
cpAchievementType
=
cp_e
.
CpAchievementMonthRank
}
if
data
:=
cp_m
.
GetCpDayRank
(
model
,
beginDate
,
endDate
,
cpRelation
.
Id
);
data
.
Score
>
0
{
if
err
:=
cp_m
.
UpdateCpAchievement
(
model
,
cpRelation
.
Id
,
cpRelation
.
UserId1
,
cpRelation
.
UserId2
,
cpAchievementType
,
data
.
Score
);
err
!=
nil
{
model
.
Log
.
Errorf
(
"UpdateCpAchievement fail:%v"
,
err
)
}
}
}
// 检查最新日周月榜单
return
// 业务场景允许提前break(cp是唯一的)
}
}
}
domain/cache/gift_c/gift_event.go
0 → 100644
View file @
ba6d7beb
package
gift_c
import
(
"encoding/json"
"git.hilo.cn/hilo-common/domain"
"github.com/go-redis/redis/v8"
"hilo-user/domain/event/gift_ev"
"time"
)
const
EventSendGiftHiloUserQueue
=
"send:gift:queue:hilo_user"
// redis pop event sendGift
func
BLPopQueueSendGift
(
model
*
domain
.
Model
)
*
gift_ev
.
SendGiftEvent
{
var
res
*
gift_ev
.
SendGiftEvent
queue
:=
EventSendGiftHiloUserQueue
strs
,
err
:=
model
.
Redis
.
BLPop
(
model
,
time
.
Second
,
queue
)
.
Result
()
if
err
!=
nil
{
if
err
!=
redis
.
Nil
{
model
.
Log
.
Errorf
(
"BLPopQueueSendGift fail:%v"
,
err
)
}
return
nil
}
if
len
(
strs
)
>=
2
{
content
:=
strs
[
1
]
res
=
new
(
gift_ev
.
SendGiftEvent
)
if
err
:=
json
.
Unmarshal
([]
byte
(
content
),
res
);
err
!=
nil
{
model
.
Log
.
Errorf
(
"BLPopQueueSendGift json fail:%v"
,
err
)
return
nil
}
return
res
}
return
nil
}
domain/service/event_s/cp_level.go
View file @
ba6d7beb
package
event_s
package
event_s
import
(
"git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/resource/redisCli"
"github.com/jinzhu/now"
"hilo-user/_const/enum/cp_e"
"hilo-user/_const/enum/gift_e"
"hilo-user/domain/event/gift_ev"
"hilo-user/domain/model/cp_m"
"time"
)
// 送礼增加cp等级
// 送礼增加cp等级
// 送礼增加cp排行榜
// 送礼增加cp排行榜
func
CpGiftEvent
()
{
//
func CpGiftEvent() {
gift_ev
.
AddSendGiftEventSync
(
func
(
model
*
domain
.
Model
,
event
interface
{})
error
{
//
gift_ev.AddSendGiftEventSync(func(model *domain.Model, event interface{}) error {
sendGiftEvent
,
ok
:=
event
.
(
*
gift_ev
.
SendGiftEvent
)
//
sendGiftEvent, ok := event.(*gift_ev.SendGiftEvent)
if
!
ok
{
//
if !ok {
model
.
Log
.
Errorf
(
"AddSendGiftEventAsync event type err"
)
//
model.Log.Errorf("AddSendGiftEventAsync event type err")
return
nil
//
return nil
}
//
}
// 只处理cp礼物
//
// 只处理cp礼物
if
!
sendGiftEvent
.
ResGift
.
Cp
{
//
if !sendGiftEvent.ResGift.Cp {
return
nil
//
return nil
}
//
}
for
_
,
receiverUid
:=
range
sendGiftEvent
.
ReceiveUserIds
{
//
for _, receiverUid := range sendGiftEvent.ReceiveUserIds {
diamonds
:=
sendGiftEvent
.
GiftN
*
sendGiftEvent
.
ResGift
.
DiamondNum
//
diamonds := sendGiftEvent.GiftN * sendGiftEvent.ResGift.DiamondNum
// 有cp关系
//
// 有cp关系
if
cpRelation
,
exits
:=
cp_m
.
GetCpRelationPair
(
model
,
sendGiftEvent
.
SendUserId
,
receiverUid
);
exits
{
//
if cpRelation, exits := cp_m.GetCpRelationPair(model, sendGiftEvent.SendUserId, receiverUid); exits {
if
err
:=
cp_m
.
AddCpLevelPoints
(
model
,
cpRelation
,
diamonds
,
sendGiftEvent
.
SceneType
,
sendGiftEvent
.
SceneUid
);
err
!=
nil
{
//
if err := cp_m.AddCpLevelPoints(model, cpRelation, diamonds, sendGiftEvent.SceneType, sendGiftEvent.SceneUid); err != nil {
model
.
Log
.
Errorf
(
"AddCpLevelPoints fail:%v"
,
err
)
//
model.Log.Errorf("AddCpLevelPoints fail:%v", err)
}
//
}
if
err
:=
cp_m
.
AddCpDayRank
(
model
,
cpRelation
,
diamonds
);
err
!=
nil
{
//
if err := cp_m.AddCpDayRank(model, cpRelation, diamonds); err != nil {
model
.
Log
.
Errorf
(
"AddCpDayRank fail:%v"
,
err
)
//
model.Log.Errorf("AddCpDayRank fail:%v", err)
}
//
}
// 检查最新的等级
//
// 检查最新的等级
if
cpLevel
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
Id
);
cpLevel
.
CpId
>=
0
{
//
if cpLevel := cp_m.GetCpLevel(model, cpRelation.Id); cpLevel.CpId >= 0 {
points
:=
cpLevel
.
Points
+
cp_e
.
CpLevelPoints
[
cpLevel
.
Level
]
//
points := cpLevel.Points + cp_e.CpLevelPoints[cpLevel.Level]
if
err
:=
cp_m
.
UpdateCpAchievement
(
model
,
cpLevel
.
CpId
,
cpRelation
.
UserId1
,
cpRelation
.
UserId2
,
cp_e
.
CpAchievementLevel
,
points
);
err
!=
nil
{
//
if err := cp_m.UpdateCpAchievement(model, cpLevel.CpId, cpRelation.UserId1, cpRelation.UserId2, cp_e.CpAchievementLevel, points); err != nil {
model
.
Log
.
Errorf
(
"UpdateCpAchievement fail:%v"
,
err
)
//
model.Log.Errorf("UpdateCpAchievement fail:%v", err)
}
//
}
}
//
}
// 检查最高的分数
//
// 检查最高的分数
for
_
,
queryType
:=
range
[]
string
{
"day"
,
"week"
,
"month"
}
{
//
for _, queryType := range []string{"day", "week", "month"} {
var
beginDate
,
endDate
string
//
var beginDate, endDate string
var
cpAchievementType
cp_e
.
CpAchievement
//
var cpAchievementType cp_e.CpAchievement
switch
queryType
{
//
switch queryType {
case
"day"
:
//
case "day":
beginDate
,
endDate
=
time
.
Now
()
.
Format
(
"2006-01-02"
),
time
.
Now
()
.
Format
(
"2006-01-02"
)
//
beginDate, endDate = time.Now().Format("2006-01-02"), time.Now().Format("2006-01-02")
cpAchievementType
=
cp_e
.
CpAchievementDayRank
//
cpAchievementType = cp_e.CpAchievementDayRank
case
"week"
:
//
case "week":
beginDate
=
now
.
BeginningOfWeek
()
.
Format
(
"2006-01-02"
)
//
beginDate = now.BeginningOfWeek().Format("2006-01-02")
endDate
=
now
.
EndOfWeek
()
.
Format
(
"2006-01-02"
)
//
endDate = now.EndOfWeek().Format("2006-01-02")
cpAchievementType
=
cp_e
.
CpAchievementWeekRank
//
cpAchievementType = cp_e.CpAchievementWeekRank
case
"month"
:
//
case "month":
beginDate
=
now
.
BeginningOfMonth
()
.
Format
(
"2006-01-02"
)
//
beginDate = now.BeginningOfMonth().Format("2006-01-02")
endDate
=
now
.
EndOfMonth
()
.
Format
(
"2006-01-02"
)
//
endDate = now.EndOfMonth().Format("2006-01-02")
cpAchievementType
=
cp_e
.
CpAchievementMonthRank
//
cpAchievementType = cp_e.CpAchievementMonthRank
}
//
}
if
data
:=
cp_m
.
GetCpDayRank
(
model
,
beginDate
,
endDate
,
cpRelation
.
Id
);
data
.
Score
>
0
{
//
if data := cp_m.GetCpDayRank(model, beginDate, endDate, cpRelation.Id); data.Score > 0 {
if
err
:=
cp_m
.
UpdateCpAchievement
(
model
,
cpRelation
.
Id
,
cpRelation
.
UserId1
,
cpRelation
.
UserId2
,
cpAchievementType
,
data
.
Score
);
err
!=
nil
{
//
if err := cp_m.UpdateCpAchievement(model, cpRelation.Id, cpRelation.UserId1, cpRelation.UserId2, cpAchievementType, data.Score); err != nil {
model
.
Log
.
Errorf
(
"UpdateCpAchievement fail:%v"
,
err
)
//
model.Log.Errorf("UpdateCpAchievement fail:%v", err)
}
//
}
}
//
}
}
//
}
// 检查最新日周月榜单
//
// 检查最新日周月榜单
return
nil
// 业务场景允许提前break(cp是唯一的)
//
return nil // 业务场景允许提前break(cp是唯一的)
}
//
}
}
//
}
return
nil
//
return nil
})
//
})
}
//
}
// 漏掉加分数的送礼记录,补上cp增加分数
// 漏掉加分数的送礼记录,补上cp增加分数
// 送礼增加cp等级
// 送礼增加cp等级
// 送礼增加cp排行榜
// 送礼增加cp排行榜
func
CompensateCpScore
()
{
//
func CompensateCpScore() {
if
!
config
.
IsMaster
()
{
//
if !config.IsMaster() {
return
//
return
}
//
}
model
:=
domain
.
CreateModelNil
()
//
model := domain.CreateModelNil()
num
,
err
:=
redisCli
.
IncrNumExpire
(
"scirpt:compensateCpScore"
,
1
,
time
.
Hour
*
999
)
//
num, err := redisCli.IncrNumExpire("scirpt:compensateCpScore", 1, time.Hour*999)
if
err
!=
nil
{
//
if err != nil {
model
.
Log
.
Errorf
(
"CompensateCpScore err:%v"
,
err
)
//
model.Log.Errorf("CompensateCpScore err:%v", err)
}
//
}
if
num
>
1
{
//
if num > 1 {
model
.
Log
.
Errorf
(
"CompensateCpScore 执行过了,退出"
)
//
model.Log.Errorf("CompensateCpScore 执行过了,退出")
return
//
return
}
//
}
// 查找需要补分的送礼记录
//
// 查找需要补分的送礼记录
type
GiftOperate
struct
{
//
type GiftOperate struct {
Id
uint64
`json:"id"`
//
Id uint64 `json:"id"`
ResGiftId
uint64
`json:"res_gift_id"`
//
ResGiftId uint64 `json:"res_gift_id"`
GiftN
int32
`json:"gift_n"`
//
GiftN int32 `json:"gift_n"`
SendUserId
uint64
`json:"send_user_id"`
//
SendUserId uint64 `json:"send_user_id"`
ReceiveUserId
uint64
`json:"receive_user_id"`
//
ReceiveUserId uint64 `json:"receive_user_id"`
SendUserDiamond
uint32
`json:"send_user_diamond"`
//
SendUserDiamond uint32 `json:"send_user_diamond"`
SceneType
int8
`json:"scene_type"`
//
SceneType int8 `json:"scene_type"`
SceneUid
string
`json:"scene_uid"`
//
SceneUid string `json:"scene_uid"`
CreatedTime
time
.
Time
`json:"created_time"`
//
CreatedTime time.Time `json:"created_time"`
}
//
}
rows
:=
make
([]
*
GiftOperate
,
0
)
//
rows := make([]*GiftOperate, 0)
err
=
model
.
DB
()
.
Model
(
GiftOperate
{})
.
//
err = model.DB().Model(GiftOperate{}).
Where
(
"created_time < ?"
,
"2023-06-22 11:20:15"
)
.
//
Where("created_time < ?", "2023-06-22 11:20:15").
Where
(
"res_gift_id in (?)"
,
//
Where("res_gift_id in (?)",
[]
int
{
3561
,
3571
,
3581
,
3591
,
3601
,
3611
,
3621
,
3631
,
3641
,
3651
,
3661
,
3671
,
3681
,
3691
,
3701
,
3711
})
.
//
[]int{3561, 3571, 3581, 3591, 3601, 3611, 3621, 3631, 3641, 3651, 3661, 3671, 3681, 3691, 3701, 3711}).
Find
(
&
rows
)
.
Error
//
Find(&rows).Error
if
err
!=
nil
{
//
if err != nil {
model
.
Log
.
Errorf
(
"CompensateCpScore err:%v"
,
err
)
//
model.Log.Errorf("CompensateCpScore err:%v", err)
return
//
return
}
//
}
model
.
Log
.
Infof
(
"CompensateCpScore len(rows):%v"
,
len
(
rows
))
//
model.Log.Infof("CompensateCpScore len(rows):%v", len(rows))
//
for
idx
,
r
:=
range
rows
{
//
for idx, r := range rows {
diamonds
:=
r
.
SendUserDiamond
//
diamonds := r.SendUserDiamond
// 有cp关系
//
// 有cp关系
if
cpRelation
,
exits
:=
cp_m
.
GetCpRelationPair
(
model
,
r
.
SendUserId
,
r
.
ReceiveUserId
);
exits
{
//
if cpRelation, exits := cp_m.GetCpRelationPair(model, r.SendUserId, r.ReceiveUserId); exits {
if
err
:=
cp_m
.
AddCpLevelPoints
(
model
,
cpRelation
,
diamonds
,
gift_e
.
GiftOperateSceneType
(
r
.
SceneType
),
r
.
SceneUid
);
err
!=
nil
{
//
if err := cp_m.AddCpLevelPoints(model, cpRelation, diamonds, gift_e.GiftOperateSceneType(r.SceneType), r.SceneUid); err != nil {
model
.
Log
.
Errorf
(
"CompensateCpScore AddCpLevelPoints fail:%v"
,
err
)
//
model.Log.Errorf("CompensateCpScore AddCpLevelPoints fail:%v", err)
return
//
return
}
//
}
if
err
:=
cp_m
.
AddCpDayRank
(
model
,
cpRelation
,
diamonds
);
err
!=
nil
{
//
if err := cp_m.AddCpDayRank(model, cpRelation, diamonds); err != nil {
model
.
Log
.
Errorf
(
"CompensateCpScore AddCpDayRank fail:%v"
,
err
)
//
model.Log.Errorf("CompensateCpScore AddCpDayRank fail:%v", err)
return
//
return
}
//
}
// 检查最新的等级
//
// 检查最新的等级
if
cpLevel
:=
cp_m
.
GetCpLevel
(
model
,
cpRelation
.
Id
);
cpLevel
.
CpId
>=
0
{
//
if cpLevel := cp_m.GetCpLevel(model, cpRelation.Id); cpLevel.CpId >= 0 {
points
:=
cpLevel
.
Points
+
cp_e
.
CpLevelPoints
[
cpLevel
.
Level
]
//
points := cpLevel.Points + cp_e.CpLevelPoints[cpLevel.Level]
if
err
:=
cp_m
.
UpdateCpAchievement
(
model
,
cpLevel
.
CpId
,
cpRelation
.
UserId1
,
cpRelation
.
UserId2
,
cp_e
.
CpAchievementLevel
,
points
);
err
!=
nil
{
//
if err := cp_m.UpdateCpAchievement(model, cpLevel.CpId, cpRelation.UserId1, cpRelation.UserId2, cp_e.CpAchievementLevel, points); err != nil {
model
.
Log
.
Errorf
(
"CompensateCpScore UpdateCpAchievement fail:%v"
,
err
)
//
model.Log.Errorf("CompensateCpScore UpdateCpAchievement fail:%v", err)
}
//
}
}
//
}
// 检查最高的分数
//
// 检查最高的分数
for
_
,
queryType
:=
range
[]
string
{
"day"
,
"week"
,
"month"
}
{
//
for _, queryType := range []string{"day", "week", "month"} {
var
beginDate
,
endDate
string
//
var beginDate, endDate string
var
cpAchievementType
cp_e
.
CpAchievement
//
var cpAchievementType cp_e.CpAchievement
switch
queryType
{
//
switch queryType {
case
"day"
:
//
case "day":
beginDate
,
endDate
=
r
.
CreatedTime
.
Format
(
"2006-01-02"
),
r
.
CreatedTime
.
Format
(
"2006-01-02"
)
//
beginDate, endDate = r.CreatedTime.Format("2006-01-02"), r.CreatedTime.Format("2006-01-02")
cpAchievementType
=
cp_e
.
CpAchievementDayRank
//
cpAchievementType = cp_e.CpAchievementDayRank
case
"week"
:
//
case "week":
beginDate
=
now
.
With
(
r
.
CreatedTime
)
.
BeginningOfWeek
()
.
Format
(
"2006-01-02"
)
//
beginDate = now.With(r.CreatedTime).BeginningOfWeek().Format("2006-01-02")
endDate
=
now
.
With
(
r
.
CreatedTime
)
.
EndOfWeek
()
.
Format
(
"2006-01-02"
)
//
endDate = now.With(r.CreatedTime).EndOfWeek().Format("2006-01-02")
cpAchievementType
=
cp_e
.
CpAchievementWeekRank
//
cpAchievementType = cp_e.CpAchievementWeekRank
case
"month"
:
//
case "month":
beginDate
=
now
.
BeginningOfMonth
()
.
Format
(
"2006-01-02"
)
//
beginDate = now.BeginningOfMonth().Format("2006-01-02")
endDate
=
now
.
EndOfMonth
()
.
Format
(
"2006-01-02"
)
//
endDate = now.EndOfMonth().Format("2006-01-02")
cpAchievementType
=
cp_e
.
CpAchievementMonthRank
//
cpAchievementType = cp_e.CpAchievementMonthRank
}
//
}
if
data
:=
cp_m
.
GetCpDayRank
(
model
,
beginDate
,
endDate
,
cpRelation
.
Id
);
data
.
Score
>
0
{
//
if data := cp_m.GetCpDayRank(model, beginDate, endDate, cpRelation.Id); data.Score > 0 {
if
err
:=
cp_m
.
UpdateCpAchievement
(
model
,
cpRelation
.
Id
,
cpRelation
.
UserId1
,
cpRelation
.
UserId2
,
cpAchievementType
,
data
.
Score
);
err
!=
nil
{
//
if err := cp_m.UpdateCpAchievement(model, cpRelation.Id, cpRelation.UserId1, cpRelation.UserId2, cpAchievementType, data.Score); err != nil {
model
.
Log
.
Errorf
(
"CompensateCpScore UpdateCpAchievement fail:%v"
,
err
)
//
model.Log.Errorf("CompensateCpScore UpdateCpAchievement fail:%v", err)
}
//
}
}
//
}
}
//
}
}
//
}
model
.
Log
.
Infof
(
"CompensateCpScore idx:%v"
,
idx
)
//
model.Log.Infof("CompensateCpScore idx:%v", idx)
if
idx
%
1000
==
0
{
//
if idx%1000 == 0 {
time
.
Sleep
(
time
.
Millisecond
*
100
)
//
time.Sleep(time.Millisecond * 100)
}
//
}
}
//
}
//
model
.
Log
.
Infof
(
"CompensateCpScore 补偿完毕"
)
//
model.Log.Infof("CompensateCpScore 补偿完毕")
}
//
}
domain/service/event_s/event_init.go
View file @
ba6d7beb
...
@@ -14,7 +14,7 @@ import (
...
@@ -14,7 +14,7 @@ import (
func
EventInit
()
{
func
EventInit
()
{
UserBagSendEvent
()
UserBagSendEvent
()
CpGiftEvent
()
//
CpGiftEvent()
CpSpaceVisitEvent
()
CpSpaceVisitEvent
()
}
}
...
...
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