Commit ff26e264 authored by chenweijian's avatar chenweijian

cp补偿分数

parent 49350b91
...@@ -2,6 +2,7 @@ package event_s ...@@ -2,6 +2,7 @@ package event_s
import ( import (
"git.hilo.cn/hilo-common/domain" "git.hilo.cn/hilo-common/domain"
"git.hilo.cn/hilo-common/resource/config"
"git.hilo.cn/hilo-common/resource/redisCli" "git.hilo.cn/hilo-common/resource/redisCli"
"github.com/jinzhu/now" "github.com/jinzhu/now"
"hilo-user/_const/enum/cp_e" "hilo-user/_const/enum/cp_e"
...@@ -76,8 +77,11 @@ func CpGiftEvent() { ...@@ -76,8 +77,11 @@ func CpGiftEvent() {
// 送礼增加cp等级 // 送礼增加cp等级
// 送礼增加cp排行榜 // 送礼增加cp排行榜
func CompensateCpScore() { func CompensateCpScore() {
if !config.IsMaster() {
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)
} }
...@@ -98,8 +102,11 @@ func CompensateCpScore() { ...@@ -98,8 +102,11 @@ func CompensateCpScore() {
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{}).Where("res_gift_id in (?)", err = model.DB().Model(GiftOperate{}).
[]int{3561, 3571, 3581, 3591, 3601, 3611, 3621, 3631, 3641, 3651, 3661, 3671, 3681, 3691, 3701, 3711}).Where("created_time < ?", "2023-06-22 11:20:15").Find(&rows).Error Where("created_time < ?", "2023-06-22 11:20:15").
Where("res_gift_id in (?)",
[]int{3561, 3571, 3581, 3591, 3601, 3611, 3621, 3631, 3641, 3651, 3661, 3671, 3681, 3691, 3701, 3711}).
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
......
...@@ -16,6 +16,7 @@ func EventInit() { ...@@ -16,6 +16,7 @@ func EventInit() {
UserBagSendEvent() UserBagSendEvent()
CpGiftEvent() CpGiftEvent()
CpSpaceVisitEvent() CpSpaceVisitEvent()
CompensateCpScore()
} }
func UserBagSendEvent() { func UserBagSendEvent() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment