Przeglądaj źródła

update ad callback count by type prefix and add update table platform_grow_data

master
shenjiachi 2 dni temu
rodzic
commit
72ec526a74
5 zmienionych plików z 42 dodań i 6 usunięć
  1. +6
    -1
      consume/egg_energy_fund_data_consume.go
  2. +2
    -1
      consume/egg_energy_team_assistance_consume.go
  3. +3
    -3
      consume/egg_energy_team_assistance_consume_test.go
  4. +30
    -0
      consume/egg_new_user_register_consume.go
  5. +1
    -1
      go.mod

+ 6
- 1
consume/egg_energy_fund_data_consume.go Wyświetl plik

@@ -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
}


+ 2
- 1
consume/egg_energy_team_assistance_consume.go Wyświetl plik

@@ -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
}


+ 3
- 3
consume/egg_energy_team_assistance_consume_test.go Wyświetl plik

@@ -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)
}

+ 30
- 0
consume/egg_new_user_register_consume.go Wyświetl plik

@@ -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
}

+ 1
- 1
go.mod Wyświetl plik

@@ -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


Ładowanie…
Anuluj
Zapisz