diff --git a/consume/init.go b/consume/init.go index f84bd16..8de9a6a 100644 --- a/consume/init.go +++ b/consume/init.go @@ -75,15 +75,15 @@ func initConsumes() { //jobs[consumeMd.MallAddSupplyGoodsFunName] = MallAddSupplyGoodsConsume //////////////////////////////////////// bigData ///////////////////////////////////////////////////// - jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume - jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume - jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume - jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume - jobs[consumeMd.CanalGuideOrderForNumericalStatementConsumeFunName] = CanalGuideOrderForNumericalStatementConsume - jobs[consumeMd.CanalMallOrderForNumericalStatementConsumeFunName] = CanalMallOrderForNumericalStatementConsume - jobs[consumeMd.CanalO2oOrderForNumericalStatementConsumeFunName] = CanalO2oOrderForNumericalStatementConsume - jobs[consumeMd.CanalO2oPayOrderForNumericalStatementConsumeFunName] = CanalO2oPayOrderForNumericalStatementConsume - jobs[consumeMd.CanalB2cOrderForNumericalStatementConsumeFunName] = CanalB2cOrderForNumericalStatementConsume + //jobs[consumeMd.CanalOrderConsumeFunName] = CanalOrderConsume + //jobs[consumeMd.CanalGuideOrderConsumeFunName] = CanalGuideOrderConsume + //jobs[consumeMd.ZhiOsUserVisitIpAddressConsumeFunName] = ZhiOsUserVisitIpAddressConsume + //jobs[consumeMd.CanalUserVirtualCcoinFlowFunName] = CanalUserVirtualCoinFlowConsume + //jobs[consumeMd.CanalGuideOrderForNumericalStatementConsumeFunName] = CanalGuideOrderForNumericalStatementConsume + //jobs[consumeMd.CanalMallOrderForNumericalStatementConsumeFunName] = CanalMallOrderForNumericalStatementConsume + //jobs[consumeMd.CanalO2oOrderForNumericalStatementConsumeFunName] = CanalO2oOrderForNumericalStatementConsume + //jobs[consumeMd.CanalO2oPayOrderForNumericalStatementConsumeFunName] = CanalO2oPayOrderForNumericalStatementConsume + //jobs[consumeMd.CanalB2cOrderForNumericalStatementConsumeFunName] = CanalB2cOrderForNumericalStatementConsume //////////////////////////////////////// oneCircles-v1 ///////////////////////////////////////////////////// //jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume @@ -97,9 +97,10 @@ func initConsumes() { //jobs[consumeMd.OneCirclesDealUserCoinConsumeFunName] = OneCirclesDealUserCoinConsume //////////////////////////////////////// withdraw ///////////////////////////////////////////////////// - //jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume - //jobs[consumeMd.FlexibleEmploymentWithdrawForGongMaoConsumeFunName] = FlexibleEmploymentWithdrawForGongMaoConsume - //jobs[consumeMd.FlexibleEmploymentWithdrawForPupiaoConsumeFunName] = FlexibleEmploymentWithdrawForPupiaoConsume + jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume + jobs[consumeMd.FlexibleEmploymentWithdrawForGongMaoConsumeFunName] = FlexibleEmploymentWithdrawForGongMaoConsume + jobs[consumeMd.FlexibleEmploymentWithdrawForPupiaoConsumeFunName] = FlexibleEmploymentWithdrawForPupiaoConsume + jobs[consumeMd.ServiceAwardDividendRelationConsumeFunName] = ServiceAwardDividendRelationConsume //jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分 //jobs[consumeMd.ZhiosOneCirclesCoinConsumeFunName] = ZhiosOneCirclesCoinConsume //一个圈圈虚拟币变化 @@ -109,7 +110,6 @@ func initConsumes() { ////////////////////////////////////// SuperCloudIssuance ///////////////////////////////////////////////////// //jobs[consumeMd.SuperCloudIssuanceMsgCallBackFunName] = SuperCloudIssuanceMsgCallBackConsume - //jobs[consumeMd.SuperCloudIssuanceAsyncMLoginFunName] = SuperCloudIssuanceAsyncMLoginConsume ////////////////////////////////////// DMS ///////////////////////////////////////////////////// //jobs[consumeMd.CanalGimMessageConsumeFunName] = CanalGimMessageConsume diff --git a/consume/md/consume_key.go b/consume/md/consume_key.go index 9231e2a..a4b47c9 100644 --- a/consume/md/consume_key.go +++ b/consume/md/consume_key.go @@ -605,6 +605,15 @@ var RabbitMqQueueKeyList = []*MqQueue{ BindKey: "", ConsumeFunName: "InstallmentPaymentAutoRepaidConsume", }, + { + ExchangeName: "service.award.dividend", + Name: "service_award_dividend_relation", + Type: DirectQueueType, + IsPersistent: false, + RoutKey: "", + BindKey: "", + ConsumeFunName: "ServiceAwardDividendRelationConsume", + }, } const ( @@ -675,4 +684,5 @@ const ( ZhiosAutoUnFreeze = "ZhiosAutoUnFreeze" InstallmentPaymentAutoRepaidConsumeFunName = "InstallmentPaymentAutoRepaidConsume" CanalGimMessageConsumeFunName = "CanalGimMessageConsume" + ServiceAwardDividendRelationConsumeFunName = "ServiceAwardDividendRelationConsume" ) diff --git a/consume/service_award_dividend_relation_consume.go b/consume/service_award_dividend_relation_consume.go new file mode 100644 index 0000000..633c0bc --- /dev/null +++ b/consume/service_award_dividend_relation_consume.go @@ -0,0 +1,70 @@ +package consume + +import ( + "applet/app/cfg" + "applet/app/db" + "applet/app/utils" + "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" + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/service_award_dividend" + md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/service_award_dividend/md" + "encoding/json" + "errors" + "fmt" + "github.com/streadway/amqp" +) + +func ServiceAwardDividendRelationConsume(queue md.MqQueue) { + fmt.Println(">>>>>>>>>>>>ServiceAwardDividendRelationConsume>>>>>>>>>>>>") + 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 = handleServiceAwardDividendRelationConsume(res.Body) + if err != nil { + fmt.Println("err ::: ", err) + utils.FilePutContents("ServiceAwardDividendRelationConsume_ERR", "[err]:"+err.Error()) + _ = res.Reject(true) //TODO::拒绝 Ack + } else { + _ = res.Ack(true) + } + } else { + panic(errors.New("error getting message")) + } + } + fmt.Println("get msg done") +} + +func handleServiceAwardDividendRelationConsume(msgData []byte) error { + //1、解析mq中queue的数据结构体 + var msg *md2.JoinServiceAwardDividendRelationReq + err := json.Unmarshal(msgData, &msg) + if err != nil { + return err + } + + engine := db.DBs[msg.MasterId] + err = service_award_dividend.JoinServiceAwardDividendRelation(engine, *msg) + fmt.Println("err::::", err) + if err != nil { + return err + } + return nil +} diff --git a/go.mod b/go.mod index b690d37..1a190d5 100644 --- a/go.mod +++ b/go.mod @@ -9,10 +9,10 @@ require ( code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240607091816-3df1433a2f0d 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.5 - code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240727115614-da7c2fc02dd7 + code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240805104025-400b3fbc3065 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.20240730013105-a13176f971e9 - code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240726093338-fed880ca12ce + code.fnuoos.com/go_rely_warehouse/zyos_model.git v0.0.4-0.20240805085726-a0042fa1ed3c github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/boombuler/barcode v1.0.1