|
|
@@ -0,0 +1,53 @@ |
|
|
|
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 TestEggCanalEnergyExchangeAccountConsume(t *testing.T) { |
|
|
|
data := md.CanalEnergyExchangeAccount{ |
|
|
|
Id: "1", |
|
|
|
Uid: "16", |
|
|
|
Direction: "1", |
|
|
|
Amount: "4.88000000", |
|
|
|
BeforeAmount: "0", |
|
|
|
AfterAmount: "3.88000000", |
|
|
|
SysFee: "0", |
|
|
|
OrdId: "", |
|
|
|
Title: "蛋蛋能量兑换余额", |
|
|
|
Kind: "3", |
|
|
|
State: "0", |
|
|
|
Memo: "手动测试数据", |
|
|
|
CreateAt: "", |
|
|
|
UpdateAt: "", |
|
|
|
} |
|
|
|
|
|
|
|
message := md.CanalEnergyExchangeAccountMessage[md.CanalEnergyExchangeAccount]{ |
|
|
|
Data: []md.CanalEnergyExchangeAccount{data}, |
|
|
|
Database: "test_db", |
|
|
|
ES: time.Now().UnixNano(), |
|
|
|
ID: 1, |
|
|
|
IsDdl: false, |
|
|
|
Old: nil, |
|
|
|
PkNames: []string{"id"}, |
|
|
|
Table: "egg_canal_user_wallet_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_wallet_flow") |
|
|
|
|
|
|
|
} |