@@ -63,8 +63,13 @@ func EggEnergyDealFundDataConsume(queue md.MqQueue) { | |||||
func handleEggEnergyDealFundDataConsume(msgData []byte) error { | func handleEggEnergyDealFundDataConsume(msgData []byte) error { | ||||
time.Sleep(time.Duration(100) * time.Millisecond) //休眠100毫秒 | time.Sleep(time.Duration(100) * time.Millisecond) //休眠100毫秒 | ||||
// 1.解析mq中queue的数据结构体 | // 1.解析mq中queue的数据结构体 | ||||
var msgStr string | |||||
err := json.Unmarshal(msgData, &msgStr) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
var msg *md2.EggEnergyStructForEggEnergyFundData | var msg *md2.EggEnergyStructForEggEnergyFundData | ||||
err := json.Unmarshal(msgData, &msg) | |||||
err = json.Unmarshal([]byte(msgStr), &msg) | |||||
if err != nil { | if err != nil { | ||||
return err | return err | ||||
} | } | ||||
@@ -65,8 +65,9 @@ func handleEggEnergyTeamAssistanceDataConsume(msgData []byte) error { | |||||
} | } | ||||
// 2.查询用户是否已经助力过 | // 2.查询用户是否已经助力过 | ||||
typesPrefix := "incentive_eggSmash" | |||||
callbackDb := implement.NewAdvertisingCallbackDb(db.Db) | callbackDb := implement.NewAdvertisingCallbackDb(db.Db) | ||||
count, err := callbackDb.AdvertisingCallbackCount(utils2.Int64ToStr(msg.AssistanceUid), msg.SignStart, msg.SignEnd, "") | |||||
count, err := callbackDb.AdvertisingCallbackCount(utils2.Int64ToStr(msg.AssistanceUid), msg.SignStart, msg.SignEnd, typesPrefix) | |||||
if err != nil { | if err != nil { | ||||
return err | return err | ||||
} | } | ||||
@@ -33,10 +33,10 @@ func TestEggEnergyTeamAssistanceConsume(t *testing.T) { | |||||
} | } | ||||
defer ch.Release() | defer ch.Release() | ||||
ch.Publish(md2.EggEnergyExchange, md2.EggEnergyTeamAssistanceReq{ | ch.Publish(md2.EggEnergyExchange, md2.EggEnergyTeamAssistanceReq{ | ||||
AssistanceUid: 16, | |||||
AssistanceUid: 17, | |||||
Uid: 2, | Uid: 2, | ||||
AssistanceValue: 100, | AssistanceValue: 100, | ||||
SignStart: "2024-12-19 08:00:00", | |||||
SignEnd: "2024-12-20 08:00:00", | |||||
SignStart: "2024-12-20 08:00:00", | |||||
SignEnd: "2024-12-21 08:00:00", | |||||
}, md2.EggEnergyTeamAssistance) | }, md2.EggEnergyTeamAssistance) | ||||
} | } |
@@ -2,9 +2,12 @@ package consume | |||||
import ( | import ( | ||||
"applet/app/cfg" | "applet/app/cfg" | ||||
"applet/app/db" | |||||
utils2 "applet/app/utils" | utils2 "applet/app/utils" | ||||
"applet/app/utils/logx" | "applet/app/utils/logx" | ||||
"applet/consume/md" | "applet/consume/md" | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/implement" | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git" | "code.fnuoos.com/EggPlanet/egg_system_rules.git" | ||||
"code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy" | "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy" | ||||
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" | ||||
@@ -68,5 +71,32 @@ func handleEggEnergyNewUserRegisterDataConsume(msgData []byte) error { | |||||
return err | return err | ||||
} | } | ||||
// 3. 更新新增人数 | |||||
now := time.Now().Format("2006-01-02") | |||||
growDataDb := implement.NewPlatformGrowDataDb(db.Db) | |||||
growData, err := growDataDb.PlatformGrowDataGetOneByParams(map[string]interface{}{ | |||||
"key": "date", | |||||
"value": now, | |||||
}) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
if growData != nil { | |||||
growData.UserGrowCount++ | |||||
_, err = growDataDb.PlatformGrowDataUpdate(growData, "user_grow_count") | |||||
if err != nil { | |||||
return err | |||||
} | |||||
} else { | |||||
m := model.PlatformGrowData{ | |||||
UserGrowCount: 1, | |||||
Date: now, | |||||
} | |||||
_, err = growDataDb.PlatformGrowDataInsert(&m) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
} | |||||
return nil | return nil | ||||
} | } |
@@ -7,7 +7,7 @@ go 1.19 | |||||
//replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules | //replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules | ||||
require ( | require ( | ||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241219072808-f579b7f54bab | |||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241220062624-0d8e6dd68add | |||||
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241220034019-4253067309b5 | code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241220034019-4253067309b5 | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.1-0.20241118083738-0f22da9ba0be | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 | ||||