@@ -77,6 +77,7 @@ func initConsumes() { | |||||
//////////////////////////////////////// oneCircles ///////////////////////////////////////////////////// | //////////////////////////////////////// oneCircles ///////////////////////////////////////////////////// | ||||
jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume | jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume | ||||
//jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume | |||||
} | } | ||||
func Run() { | func Run() { | ||||
@@ -398,6 +398,15 @@ var RabbitMqQueueKeyList = []*MqQueue{ | |||||
BindKey: "", | BindKey: "", | ||||
ConsumeFunName: "OneCirclesSignInGreenEnergyConsume", | ConsumeFunName: "OneCirclesSignInGreenEnergyConsume", | ||||
}, | }, | ||||
{ | |||||
ExchangeName: "one.circles", | |||||
Name: "one_circles_sign_in_green_energy_copy", | |||||
Type: TopicQueueType, | |||||
IsPersistent: false, | |||||
RoutKey: "sign_in_copy", | |||||
BindKey: "", | |||||
ConsumeFunName: "OneCirclesSignInCopyGreenEnergyConsume", | |||||
}, | |||||
} | } | ||||
const ( | const ( | ||||
@@ -444,4 +453,5 @@ const ( | |||||
MallAddSupplyGoodsFunName = "MallAddSupplyGoodsConsume" | MallAddSupplyGoodsFunName = "MallAddSupplyGoodsConsume" | ||||
CanalUserVirtualCcoinFlowFunName = "CanalUserVirtualCoinFlowConsume" | CanalUserVirtualCcoinFlowFunName = "CanalUserVirtualCoinFlowConsume" | ||||
OneCirclesSignInGreenEnergyFunName = "OneCirclesSignInGreenEnergyConsume" | OneCirclesSignInGreenEnergyFunName = "OneCirclesSignInGreenEnergyConsume" | ||||
OneCirclesSignInCopyGreenEnergyFunName = "OneCirclesSignInCopyGreenEnergyConsume" | |||||
) | ) |
@@ -0,0 +1,66 @@ | |||||
package consume | |||||
import ( | |||||
"applet/app/cfg" | |||||
"applet/app/db" | |||||
"applet/app/utils/logx" | |||||
"applet/consume/md" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" | |||||
"code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles" | |||||
"encoding/json" | |||||
"errors" | |||||
"fmt" | |||||
"github.com/streadway/amqp" | |||||
) | |||||
func OneCirclesSignInCopyGreenEnergyConsume(queue md.MqQueue) { | |||||
fmt.Println(">>>>>>>>>>>>OneCirclesSignInCopyGreenEnergyConsume>>>>>>>>>>>>") | |||||
ch, err := rabbit.Cfg.Pool.GetChannel() | |||||
if err != nil { | |||||
logx.Error(err) | |||||
return | |||||
} | |||||
defer ch.Release() | |||||
//1、将自己绑定到交换机上 | |||||
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) | |||||
//2、取出数据进行消费 | |||||
ch.Qos(1) | |||||
delivery := ch.Consume(queue.Name, false) | |||||
one_circles.Init(cfg.RedisAddr) | |||||
var res amqp.Delivery | |||||
var ok bool | |||||
for { | |||||
res, ok = <-delivery | |||||
if ok == true { | |||||
err = handleOneCirclesSignInCopyGreenEnergy(res.Body) | |||||
if err != nil { | |||||
fmt.Println("OneCirclesSignInCopyGreenEnergyConsume_ERR:::::", err.Error()) | |||||
} | |||||
//_ = res.Reject(false) | |||||
err = res.Ack(true) | |||||
fmt.Println("err ::: ", err) | |||||
} else { | |||||
panic(errors.New("error getting message")) | |||||
} | |||||
} | |||||
fmt.Println("get msg done") | |||||
} | |||||
func handleOneCirclesSignInCopyGreenEnergy(msgData []byte) error { | |||||
//1、解析mq中queue的数据结构体 | |||||
var msg *md.OneCirclesStructForSignIn | |||||
err := json.Unmarshal(msgData, &msg) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
engine := db.DBs[msg.MasterId] | |||||
err = one_circles.HandleSettlementSignInGreenEnergy(engine, msg.MasterId, msg.Id, msg.Uid) | |||||
fmt.Println("err::::", err) | |||||
if err != nil { | |||||
return err | |||||
} | |||||
return nil | |||||
} |
@@ -6,7 +6,7 @@ require ( | |||||
code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240222023917-c31b53f7e8cb | code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240222023917-c31b53f7e8cb | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.0 | code.fnuoos.com/go_rely_warehouse/zyos_go_es.git v1.0.0 | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.4 | code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.4 | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240228103137-25bbc2fa494f | |||||
code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240229073153-b243a6bc836c | |||||
code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git v1.6.2-0.20231116085701-9ba6e19f877b | code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git v1.6.2-0.20231116085701-9ba6e19f877b | ||||
code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240126015516-38ca248db2fd | code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git v1.1.21-0.20240126015516-38ca248db2fd | ||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 | ||||