@@ -91,7 +91,7 @@ func handleEggCanalPersonAddActivityValueConsume(msg []byte) error { | |||||
// 3. 增加个人活跃积分 | // 3. 增加个人活跃积分 | ||||
amount := utils2.StrToFloat64(item.Amount) | 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(). | updateDoc, err := es.EsClient.Update(). | ||||
Index(index). | Index(index). | ||||
Id(id). | Id(id). | ||||
@@ -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") | |||||
} |
@@ -73,8 +73,10 @@ func handleEggEnergyDealUserECPMConsume(msgData []byte) error { | |||||
weekStr := utils2.IntToStr(week) | weekStr := utils2.IntToStr(week) | ||||
index := es2.GetAppointIndexFromAlias(yearStr, weekStr) | index := es2.GetAppointIndexFromAlias(yearStr, weekStr) | ||||
id := fmt.Sprintf("%d%d_%d", year, week, msg.Uid) | 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(). | updateDocRet, err := es.EsClient.Update(). | ||||
Index(index). | Index(index). | ||||
Id(id). | Id(id). | ||||
@@ -92,6 +94,6 @@ func handleEggEnergyDealUserECPMConsume(msgData []byte) error { | |||||
} | } | ||||
return err | return err | ||||
} | } | ||||
fmt.Printf("UpdateCreateDoc ==> %+v \n\n", updateDocRet) | |||||
fmt.Printf("UpdateDoc ==> %+v \n\n", updateDocRet) | |||||
return err | return err | ||||
} | } |
@@ -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 | |||||
} | |||||
} |
@@ -14,7 +14,7 @@ type GetPredictReq struct { | |||||
CollegeLearningNums int `json:"college_learning_nums"` | CollegeLearningNums int `json:"college_learning_nums"` | ||||
ViolateNums int `json:"violate_nums"` | ViolateNums int `json:"violate_nums"` | ||||
BrowseInterfaceNums int `json:"browse_interface_nums"` | BrowseInterfaceNums int `json:"browse_interface_nums"` | ||||
PersonAddActivityValue int `json:"person_add_activity_value"` | |||||
PersonAddActivityValue float64 `json:"person_add_activity_value"` | |||||
} | } | ||||
type GetPredictResp struct { | type GetPredictResp struct { | ||||
@@ -8,7 +8,7 @@ go 1.19 | |||||
require ( | require ( | ||||
code.fnuoos.com/EggPlanet/egg_models.git v0.2.1-0.20241224090637-89a57f7fbb1e | 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_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 | ||||
github.com/boombuler/barcode v1.0.1 | github.com/boombuler/barcode v1.0.1 | ||||