diff --git a/consume/egg_energy_fund_data_consume.go b/consume/egg_energy_fund_data_consume.go index 8df9c4d..b1d8980 100644 --- a/consume/egg_energy_fund_data_consume.go +++ b/consume/egg_energy_fund_data_consume.go @@ -63,8 +63,13 @@ func EggEnergyDealFundDataConsume(queue md.MqQueue) { func handleEggEnergyDealFundDataConsume(msgData []byte) error { time.Sleep(time.Duration(100) * time.Millisecond) //休眠100毫秒 // 1.解析mq中queue的数据结构体 + var msgStr string + err := json.Unmarshal(msgData, &msgStr) + if err != nil { + return err + } var msg *md2.EggEnergyStructForEggEnergyFundData - err := json.Unmarshal(msgData, &msg) + err = json.Unmarshal([]byte(msgStr), &msg) if err != nil { return err } diff --git a/consume/egg_energy_team_assistance_consume.go b/consume/egg_energy_team_assistance_consume.go index e4cfd86..3e5faac 100644 --- a/consume/egg_energy_team_assistance_consume.go +++ b/consume/egg_energy_team_assistance_consume.go @@ -65,8 +65,9 @@ func handleEggEnergyTeamAssistanceDataConsume(msgData []byte) error { } // 2.查询用户是否已经助力过 + typesPrefix := "incentive_eggSmash" 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 { return err } diff --git a/consume/egg_energy_team_assistance_consume_test.go b/consume/egg_energy_team_assistance_consume_test.go index 9376c16..a7822ed 100644 --- a/consume/egg_energy_team_assistance_consume_test.go +++ b/consume/egg_energy_team_assistance_consume_test.go @@ -33,10 +33,10 @@ func TestEggEnergyTeamAssistanceConsume(t *testing.T) { } defer ch.Release() ch.Publish(md2.EggEnergyExchange, md2.EggEnergyTeamAssistanceReq{ - AssistanceUid: 16, + AssistanceUid: 17, Uid: 2, 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) } diff --git a/consume/egg_new_user_register_consume.go b/consume/egg_new_user_register_consume.go index 24d178d..2c767bb 100644 --- a/consume/egg_new_user_register_consume.go +++ b/consume/egg_new_user_register_consume.go @@ -2,9 +2,12 @@ package consume import ( "applet/app/cfg" + "applet/app/db" utils2 "applet/app/utils" "applet/app/utils/logx" "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/rule/egg_energy" md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md" @@ -68,5 +71,32 @@ func handleEggEnergyNewUserRegisterDataConsume(msgData []byte) error { 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 } diff --git a/go.mod b/go.mod index 874bbbb..831be2b 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ go 1.19 //replace code.fnuoos.com/EggPlanet/egg_system_rules.git => E:/company/Egg/egg_system_rules 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/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