Quellcode durchsuchen

fix: update ecpm and PersonAddActivityValue es struct

master
shenjiachi vor 1 Woche
Ursprung
Commit
a85c480052
6 geänderte Dateien mit 80 neuen und 5 gelöschten Zeilen
  1. +1
    -1
      consume/egg_canal_person_add_activity_value_consume.go
  2. +49
    -0
      consume/egg_canal_person_add_activity_value_consume_test.go
  3. +4
    -2
      consume/egg_energy_deal_user_ecpm.go
  4. +24
    -0
      consume/egg_energy_deal_user_ecpm_test.go
  5. +1
    -1
      consume/md/md_egg_energy_auto_score_consume.go
  6. +1
    -1
      go.mod

+ 1
- 1
consume/egg_canal_person_add_activity_value_consume.go Datei anzeigen

@@ -91,7 +91,7 @@ func handleEggCanalPersonAddActivityValueConsume(msg []byte) error {

// 3. 增加个人活跃积分
amount := utils2.StrToFloat64(item.Amount)
script := elastic.NewScript("ctx._source.person_add_activity_value += params.inc").Param("inc", int(amount))
script := elastic.NewScript("ctx._source.person_add_activity_value += params.inc").Param("inc", amount)
updateDoc, err := es.EsClient.Update().
Index(index).
Id(id).


+ 49
- 0
consume/egg_canal_person_add_activity_value_consume_test.go Datei anzeigen

@@ -0,0 +1,49 @@
package consume

import (
"applet/consume/md"
md2 "code.fnuoos.com/EggPlanet/egg_system_rules.git/rule/egg_energy/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit"
"testing"
"time"
)

func TestHandleEggCanalPersonAddActivityValueConsume(t *testing.T) {
data := md.CanalUserVirtualCoinFlow{
Id: "1",
Uid: "16",
CoinId: "3",
Direction: "1",
Title: "测试",
Amount: "40",
BeforeAmount: "0",
AfterAmount: "80",
SysFee: "0",
TransferType: "6",
}

message := md.CanalUserVirtualCoinFlowMessage[md.CanalUserVirtualCoinFlow]{
Data: []md.CanalUserVirtualCoinFlow{data},
Database: "test_db",
ES: time.Now().UnixNano(),
ID: 1,
IsDdl: false,
Old: nil,
PkNames: []string{"id"},
Table: "user_virtual_coin_flow",
TS: time.Now().Unix(),
Type: "INSERT",
}

err := rabbit.Init("120.77.153.180", "5672", "guest", "guest")
if err != nil {
return
}
ch, err := rabbit.Cfg.Pool.GetChannel()
if err != nil {
return
}
defer ch.Release()
ch.Publish(md2.EggCanalExchange, message, "egg_canal_user_virtual_coin_flow")

}

+ 4
- 2
consume/egg_energy_deal_user_ecpm.go Datei anzeigen

@@ -73,8 +73,10 @@ func handleEggEnergyDealUserECPMConsume(msgData []byte) error {
weekStr := utils2.IntToStr(week)
index := es2.GetAppointIndexFromAlias(yearStr, weekStr)
id := fmt.Sprintf("%d%d_%d", year, week, msg.Uid)
id = "202453_16"
index = "egg_energy_user_egg_score_202453"

script := elastic.NewScript("ctx._source.ecpm += params.inc").Param("inc", utils2.StrToInt64(msg.Ecpm))
script := elastic.NewScript("ctx._source.ecpm += params.inc").Param("inc", utils2.StrToFloat64(msg.Ecpm))
updateDocRet, err := es.EsClient.Update().
Index(index).
Id(id).
@@ -92,6 +94,6 @@ func handleEggEnergyDealUserECPMConsume(msgData []byte) error {
}
return err
}
fmt.Printf("UpdateCreateDoc ==> %+v \n\n", updateDocRet)
fmt.Printf("UpdateDoc ==> %+v \n\n", updateDocRet)
return err
}

+ 24
- 0
consume/egg_energy_deal_user_ecpm_test.go Datei anzeigen

@@ -0,0 +1,24 @@
package consume

import (
"code.fnuoos.com/EggPlanet/egg_system_rules.git/md"
"code.fnuoos.com/go_rely_warehouse/zyos_go_es.git/es"
"encoding/json"
"fmt"
"testing"
)

func TestHandleEggEnergyDealUserECPMConsume(t *testing.T) {

es.Init("http://123.57.140.192:9200", "elastic", "fnuo123")
m := md.DealUserEcpmReq{
Uid: 16,
Ecpm: "694.704000",
}
bytes, err := json.Marshal(m)
err = handleEggEnergyDealUserECPMConsume(bytes)
if err != nil {
fmt.Println(err)
return
}
}

+ 1
- 1
consume/md/md_egg_energy_auto_score_consume.go Datei anzeigen

@@ -14,7 +14,7 @@ type GetPredictReq struct {
CollegeLearningNums int `json:"college_learning_nums"`
ViolateNums int `json:"violate_nums"`
BrowseInterfaceNums int `json:"browse_interface_nums"`
PersonAddActivityValue int `json:"person_add_activity_value"`
PersonAddActivityValue float64 `json:"person_add_activity_value"`
}

type GetPredictResp struct {


+ 1
- 1
go.mod Datei anzeigen

@@ -8,7 +8,7 @@ go 1.19

require (
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241224090637-89a57f7fbb1e
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241226101642-a072d33f3449
code.fnuoos.com/EggPlanet/egg_system_rules.git v0.0.4-0.20241227073118-a441564375e2
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
github.com/boombuler/barcode v1.0.1


Laden…
Abbrechen
Speichern