From 108bc843c7cbf9663ec7b01608e552513423eda2 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 22 May 2024 15:57:38 +0800 Subject: [PATCH 01/11] update --- consume/init.go | 88 ++++++++++++++++++++++++------------------------- go.mod | 8 ++--- 2 files changed, 48 insertions(+), 48 deletions(-) diff --git a/consume/init.go b/consume/init.go index 46da7b8..aba3d6a 100644 --- a/consume/init.go +++ b/consume/init.go @@ -19,47 +19,47 @@ func Init() { func initConsumes() { //jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder - jobs[consumeMd.ZhiosIntegralProxyRechargeFunName] = ZhiosIntegralProxyRecharge - jobs[consumeMd.ZhiosUserUpLvFunName] = ZhiosUserUpLv - jobs[consumeMd.CanalGuideOrderByUserUpLvConsume] = CanalGuideOrderByUserUpLvConsume - jobs[consumeMd.ZhiosOrderFreeFunName] = ZhiosOrderFree - jobs[consumeMd.ZhiosOrderTotalFunName] = ZhiosOrderTotal - jobs[consumeMd.ZhiosOrderTotalSecondFunName] = ZhiosOrderTotalSecond + //jobs[consumeMd.ZhiosIntegralProxyRechargeFunName] = ZhiosIntegralProxyRecharge + //jobs[consumeMd.ZhiosUserUpLvFunName] = ZhiosUserUpLv + //jobs[consumeMd.CanalGuideOrderByUserUpLvConsume] = CanalGuideOrderByUserUpLvConsume + //jobs[consumeMd.ZhiosOrderFreeFunName] = ZhiosOrderFree + //jobs[consumeMd.ZhiosOrderTotalFunName] = ZhiosOrderTotal + //jobs[consumeMd.ZhiosOrderTotalSecondFunName] = ZhiosOrderTotalSecond + //// + //jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal + //jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy + //jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle + //// + //jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder // - jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal - jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy - jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle + //jobs[consumeMd.ZhiosAppreciationFunName] = ZhiosAppreciation + //jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser // - jobs[consumeMd.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder - - jobs[consumeMd.ZhiosAppreciationFunName] = ZhiosAppreciation - jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser - - jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition - - jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial - jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter - jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender - jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans - jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv - - jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay - jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess - jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund - jobs[consumeMd.ZhiosFastReturnOrderRefundSecondFunName] = ZhiosFastReturnOrderRefundSecond - - jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore - - jobs[consumeMd.ZhiosRechargeOrderFailFunName] = ZhiosRechargeOrderFail - - jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume - jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate - jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate - - jobs[consumeMd.ZhiosCapitalPoolOrderTotalFunName] = ZhiosCapitalPoolOrderTotal - jobs[consumeMd.ZhiosExpressOrderFail] = ZhiosExpressOrderFail - jobs[consumeMd.ZhiosWithdrawReward] = ZhiosWithdrawReward - jobs[consumeMd.ZhiosTaskTotal] = ZhiosTaskTotal + //jobs[consumeMd.ZhiosAcquisitionConditionFunName] = ZhiosAcquisitionCondition + // + //jobs[consumeMd.DouShenUserRegisterConsumeForOfficialFunName] = DouShenUserRegisterConsumeForOfficial + //jobs[consumeMd.DouShenUserRegisterConsumeForOperationCenterFunName] = DouShenUserRegisterConsumeForOperationCenter + //jobs[consumeMd.DouShenUserRegisterConsumeForMyRecommenderFunName] = DouShenUserRegisterConsumeForMyRecommender + //jobs[consumeMd.DouShenUserRegisterConsumeForMyFansFunName] = DouShenUserRegisterConsumeForMyFans + //jobs[consumeMd.DouShenUserRegisterConsumeForUserRegisterUpLvFunName] = DouShenUserRegisterConsumeForUserRegisterUpLv + // + //jobs[consumeMd.ZhiosFastReturnOrderPayFunName] = ZhiosFastReturnOrderPay + //jobs[consumeMd.ZhiosFastReturnOrderSuccessFunName] = ZhiosFastReturnOrderSuccess + //jobs[consumeMd.ZhiosFastReturnOrderRefundFunName] = ZhiosFastReturnOrderRefund + //jobs[consumeMd.ZhiosFastReturnOrderRefundSecondFunName] = ZhiosFastReturnOrderRefundSecond + // + //jobs[consumeMd.YoumishangExchangeStoreFunName] = YoumishangExchangeStore + // + //jobs[consumeMd.ZhiosRechargeOrderFailFunName] = ZhiosRechargeOrderFail + // + //jobs[consumeMd.CloudIssuanceAsyncMLoginFunName] = CloudIssuanceAsyncMLoginConsume + //jobs[consumeMd.ZhiosTikTokUpdateFunName] = ZhiosTikTokUpdate + //jobs[consumeMd.ZhiosTikTokAllUpdateFunName] = ZhiosTikTokAllUpdate + // + //jobs[consumeMd.ZhiosCapitalPoolOrderTotalFunName] = ZhiosCapitalPoolOrderTotal + //jobs[consumeMd.ZhiosExpressOrderFail] = ZhiosExpressOrderFail + //jobs[consumeMd.ZhiosWithdrawReward] = ZhiosWithdrawReward + //jobs[consumeMd.ZhiosTaskTotal] = ZhiosTaskTotal // @@ -80,11 +80,11 @@ func initConsumes() { //////////////////////////////////////// oneCircles ///////////////////////////////////////////////////// - //jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume - //jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume - //jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume - //jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume - //jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume + jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume + jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume + jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume + jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume + jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume ////jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume //////////////////////////////////////// withdraw ///////////////////////////////////////////////////// diff --git a/go.mod b/go.mod index d69ad82..4302e75 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240517075745-b0c157acd0ae 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_order_relate_rule.git v1.9.10-0.20240511075833-e9b3fce2f763 + code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240522073635-5c8f98db547f 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 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 @@ -22,7 +22,7 @@ require ( github.com/go-playground/universal-translator v0.18.1 github.com/go-playground/validator/v10 v10.19.0 github.com/go-redis/redis v6.15.9+incompatible - github.com/go-sql-driver/mysql v1.6.0 + github.com/go-sql-driver/mysql v1.8.1 github.com/gomodule/redigo v2.0.0+incompatible github.com/iGoogle-ink/gopay v1.5.36 github.com/jinzhu/copier v0.3.5 @@ -34,12 +34,12 @@ require ( github.com/sony/sonyflake v1.0.0 github.com/streadway/amqp v1.0.0 github.com/swaggo/swag v1.7.0 - github.com/syyongx/php2go v0.9.7 + github.com/syyongx/php2go v0.9.8 github.com/tidwall/gjson v1.14.1 go.uber.org/zap v1.16.0 google.golang.org/grpc v1.32.0 google.golang.org/protobuf v1.33.0 - gopkg.in/natefinch/lumberjack.v2 v2.0.0 + gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/yaml.v2 v2.4.0 xorm.io/xorm v1.3.2 ) From 7ec6d81b026279fc10ae041c2a196a489428f637 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 22 May 2024 16:22:54 +0800 Subject: [PATCH 02/11] update --- ...rcles_activity_coin_auto_exchange_green_energy_consume.go | 5 +++-- ...ivity_coin_auto_exchange_green_energy_for_team_consume.go | 5 +++-- .../one_circles_settlement_public_activity_coin_consume.go | 3 ++- go.mod | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go index 1c01f0e..471222e 100644 --- a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go +++ b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go @@ -10,6 +10,7 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" db2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db" md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule" "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/one_circles/enum" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/svc" @@ -102,7 +103,7 @@ func handleOneCirclesActivityCoinAutoExchangeGreenEnergyConsume(msgData []byte) return err1 } //3.2给相应的用户加上个人的绿色积分(可用数量) - err = one_circles.DealUserCoin(session, md2.DealUserCoinReq{ + err = rule.DealUserCoin(session, md2.DealUserCoinReq{ Kind: "add", Mid: msg.MasterId, Title: md2.OneCirclesPersonalActiveCoinExchangeGreenEnergy, @@ -119,7 +120,7 @@ func handleOneCirclesActivityCoinAutoExchangeGreenEnergyConsume(msgData []byte) } //4.1给相应的用户减去个人活跃积分 - err = one_circles.DealUserCoin(session, md2.DealUserCoinReq{ + err = rule.DealUserCoin(session, md2.DealUserCoinReq{ Kind: "sub", Mid: msg.MasterId, Title: md2.OneCirclesPersonalActiveCoinExchangeToBeGreenEnergy, diff --git a/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go b/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go index 277856b..6c5daa4 100644 --- a/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go +++ b/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go @@ -10,6 +10,7 @@ import ( "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" db2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/db" md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule" "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/one_circles/enum" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles/svc" @@ -103,7 +104,7 @@ func handleOneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume(msgData [ return err1 } //3.2给相应的用户加上个人的绿色积分(结算数量) - err = one_circles.DealUserCoin(session, md2.DealUserCoinReq{ + err = rule.DealUserCoin(session, md2.DealUserCoinReq{ Kind: "add", Mid: msg.MasterId, Title: md2.OneCirclesTeamActiveCoinExchangeGreenEnergy, @@ -120,7 +121,7 @@ func handleOneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume(msgData [ } //4.1给相应的用户减去团队活跃积分 - err = one_circles.DealUserCoin(session, md2.DealUserCoinReq{ + err = rule.DealUserCoin(session, md2.DealUserCoinReq{ Kind: "sub", Mid: msg.MasterId, Title: md2.OneCirclesTeamActiveCoinExchangeToBeGreenEnergy, diff --git a/consume/one_circles_settlement_public_activity_coin_consume.go b/consume/one_circles_settlement_public_activity_coin_consume.go index cb4e695..7cf7403 100644 --- a/consume/one_circles_settlement_public_activity_coin_consume.go +++ b/consume/one_circles_settlement_public_activity_coin_consume.go @@ -8,6 +8,7 @@ import ( "applet/consume/md" "code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git/rabbit" md2 "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/md" + "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule" "code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git/rule/one_circles" "encoding/json" "errors" @@ -74,7 +75,7 @@ func handleOneCirclesSettlementPublicGiveActivityCoinConsume(msgData []byte) err }() session.Begin() - err = one_circles.DealUserCoin(session, md2.DealUserCoinReq{ + err = rule.DealUserCoin(session, md2.DealUserCoinReq{ Kind: "add", Mid: msg.Mid, Title: msg.Title, diff --git a/go.mod b/go.mod index 4302e75..df5225e 100644 --- a/go.mod +++ b/go.mod @@ -45,6 +45,7 @@ require ( ) require ( + filippo.io/edwards25519 v1.1.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect github.com/PuerkitoBio/purell v1.1.1 // indirect github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect From 1cdff0a15ee2e7249dd9400d524d043d1ecb3761 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Wed, 22 May 2024 20:02:13 +0800 Subject: [PATCH 03/11] 1 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index df5225e..229f70b 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240517075745-b0c157acd0ae 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_order_relate_rule.git v1.9.10-0.20240522073635-5c8f98db547f + code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240522120056-18c608dfe80f 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 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 From f7739b3517c0cdf2252d8d9c8c69a1f9266ce8a0 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 23 May 2024 11:21:31 +0800 Subject: [PATCH 04/11] update --- ...ircles_activity_coin_auto_exchange_green_energy_consume.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go index 471222e..72bd8bf 100644 --- a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go +++ b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go @@ -32,7 +32,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyConsume(queue md.MqQueue) { //1、将自己绑定到交换机上 ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) //2、取出数据进行消费 - ch.Qos(1) + ch.Qos(50) delivery := ch.Consume(queue.Name, false) one_circles.Init(cfg.RedisAddr) @@ -61,7 +61,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyConsume(queue md.MqQueue) { } func handleOneCirclesActivityCoinAutoExchangeGreenEnergyConsume(msgData []byte) error { - time.Sleep(time.Duration(2) * time.Millisecond) //休眠2毫秒 + time.Sleep(time.Duration(1) * time.Millisecond) //休眠1毫秒 //1、解析mq中queue的数据结构体 var msg *md2.OneCirclesStructForAutoExchangeGreenEnergy err := json.Unmarshal(msgData, &msg) From 681b3157d3b25df78910a052f2854e528efa1b28 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 23 May 2024 11:54:12 +0800 Subject: [PATCH 05/11] update --- ...ircles_activity_coin_auto_exchange_green_energy_consume.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go index 72bd8bf..ce774ea 100644 --- a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go +++ b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go @@ -32,7 +32,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyConsume(queue md.MqQueue) { //1、将自己绑定到交换机上 ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) //2、取出数据进行消费 - ch.Qos(50) + ch.Qos(20) delivery := ch.Consume(queue.Name, false) one_circles.Init(cfg.RedisAddr) @@ -61,7 +61,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyConsume(queue md.MqQueue) { } func handleOneCirclesActivityCoinAutoExchangeGreenEnergyConsume(msgData []byte) error { - time.Sleep(time.Duration(1) * time.Millisecond) //休眠1毫秒 + time.Sleep(time.Duration(100) * time.Microsecond) //休眠0.1毫秒 //1、解析mq中queue的数据结构体 var msg *md2.OneCirclesStructForAutoExchangeGreenEnergy err := json.Unmarshal(msgData, &msg) From 63fe5a1881f3a46c07da54bc24bc8b7a107ccc3e Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 23 May 2024 15:45:42 +0800 Subject: [PATCH 06/11] update --- ...ircles_activity_coin_auto_exchange_green_energy_consume.go | 2 +- ...tivity_coin_auto_exchange_green_energy_for_team_consume.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go index ce774ea..4d5d4a9 100644 --- a/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go +++ b/consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go @@ -32,7 +32,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyConsume(queue md.MqQueue) { //1、将自己绑定到交换机上 ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) //2、取出数据进行消费 - ch.Qos(20) + ch.Qos(40) delivery := ch.Consume(queue.Name, false) one_circles.Init(cfg.RedisAddr) diff --git a/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go b/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go index 6c5daa4..7301a81 100644 --- a/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go +++ b/consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go @@ -32,7 +32,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume(queue md.MqQueu //1、将自己绑定到交换机上 ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey) //2、取出数据进行消费 - ch.Qos(1) + ch.Qos(20) delivery := ch.Consume(queue.Name, false) one_circles.Init(cfg.RedisAddr) @@ -61,7 +61,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume(queue md.MqQueu } func handleOneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume(msgData []byte) error { - time.Sleep(time.Duration(2) * time.Millisecond) //休眠2毫秒 + time.Sleep(time.Duration(200) * time.Microsecond) //休眠0.2毫秒 //1、解析mq中queue的数据结构体 var msg *md2.OneCirclesStructForAutoExchangeGreenEnergy err := json.Unmarshal(msgData, &msg) From 38f1a550dd086368ab338630bf81e71b6b6643dc Mon Sep 17 00:00:00 2001 From: dengbiao Date: Thu, 23 May 2024 15:50:57 +0800 Subject: [PATCH 07/11] update --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 229f70b..095f244 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( code.fnuoos.com/go_rely_warehouse/zyos_go_condition_statistics.git v1.1.2-0.20240517075745-b0c157acd0ae 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_order_relate_rule.git v1.9.10-0.20240522120056-18c608dfe80f + code.fnuoos.com/go_rely_warehouse/zyos_go_order_relate_rule.git v1.9.10-0.20240523074623-13904817c018 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 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 From 9e8898c768c63e7becffe652a9f3fcd4cea81545 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 25 May 2024 15:27:30 +0800 Subject: [PATCH 08/11] 1 --- app/db/dbs_map.go | 5 +- .../svc/svc_fin_withdraw_apply.go | 79 +++++++++++++++++++ app/lib/flexible_employment/pupiao.go | 2 +- consume/init.go | 16 ++-- consume/withdraw_consume_pupiao.go | 25 +++--- 5 files changed, 106 insertions(+), 21 deletions(-) diff --git a/app/db/dbs_map.go b/app/db/dbs_map.go index 5acfe9d..ceb1e16 100644 --- a/app/db/dbs_map.go +++ b/app/db/dbs_map.go @@ -109,8 +109,9 @@ func GetAllDatabaseDev() *[]model.DbMapping { var err error fmt.Println("cfg.Local is: ", cfg.Local) if cfg.Local { // 本地调试 加快速度 - fmt.Println("notice:LOCAL TEST, only masterId:** 99813608 ** available!") - err = Db.Where("deleted_at != ? AND db_master_id=?", 1, 31585332).Find(&m) + fmt.Println("notice:LOCAL TEST, only masterId:** 123456 ** available!") + err = Db.Where("deleted_at != ? AND is_dev = '1' AND db_master_id=?", 1, 123456). + Or("db_master_id = ?", 32053480).Find(&m) } else { err = Db.Where("deleted_at != ? AND is_dev = '1' ", 1).Find(&m) } diff --git a/app/flexible_employment/svc/svc_fin_withdraw_apply.go b/app/flexible_employment/svc/svc_fin_withdraw_apply.go index 414017f..92834c5 100644 --- a/app/flexible_employment/svc/svc_fin_withdraw_apply.go +++ b/app/flexible_employment/svc/svc_fin_withdraw_apply.go @@ -90,6 +90,85 @@ func DealFailResult(sess *xorm.Session, apply *model.FinWithdrawApply, masterId, } return nil } +func DealFailResultForPuPiao(sess *xorm.Session, apply *model.FinWithdrawApply, masterId, errMsg string) (err error) { + userProfile, err := db.UserFindByIDWithSession(sess, apply.Uid) + if err != nil { + return err + } + + //1、修改提现单为失败 + apply.State = 3 + apply.Memo = errMsg + updateAck, err := sess.Where("id=?", apply.Id).Cols("state", "memo").Update(apply) + if err != nil { + return err + } + if updateAck <= 0 { + return errors.New("更新提现单失败") + } + updateAck, err = sess.Where("request_id=?", apply.Id).Cols("state", "callback_data_for_trade_result").Update(model2.FlexibleEmploymentOrd{ + State: 3, + CallbackDataForTradeResult: errMsg, + }) + if err != nil { + return err + } + if updateAck <= 0 { + return errors.New("更新工猫记录失败") + } + + //2、判断类型 加回手续费 + var finUserFlow model.FinUserFlow + has, err := sess.Where("other_id = ?", apply.Id).Get(&finUserFlow) + if err != nil { + return + } + var sysFee = 0.00 + if has && apply.FeeType == 1 { + apply.Amount = utils.Float64ToStr(utils.StrToFloat64(apply.Amount) + utils.StrToFloat64(finUserFlow.SysFee)) + sysFee = utils.StrToFloat64(finUserFlow.SysFee) + } + + //3、退回余额 + cb, err := svc.HandleBalanceDistributedLock(masterId, utils.IntToStr(apply.Uid), "withdraw_consume") + if err != nil { + return + } + if cb != nil { + defer cb() + } + var beforeAmount = userProfile.FinValid + userProfile.FinValid = utils.Float64ToStrPrec4(utils.StrToFloat64(beforeAmount) + utils.StrToFloat64(apply.Amount)) + _, err = db.UserUpdateWithSession(sess, userProfile.Uid, userProfile, "fin_valid") + if err != nil { + return err + } + + //4、插入流水表 + newFinUserFlow := model.FinUserFlow{ + Type: 0, + Uid: userProfile.Uid, + Amount: apply.Amount, + BeforeAmount: beforeAmount, + AfterAmount: userProfile.FinValid, + OrdType: "withdraw", + OrdAction: 22, + PaymentType: 1, + SysFee: utils.Float64ToStrPrec4(sysFee), + OrdDetail: "", + OtherId: apply.Id, + OrdTitle: "提现退回", + State: 2, + OrdTime: int(apply.CreateAt.Unix()), + CreateAt: time.Now(), + UpdateAt: time.Now(), + } + _, err = db.InsertCommWithSession(sess, &newFinUserFlow) + if err != nil { + return err + } + return nil +} func DealSuccessResult(sess *xorm.Session, apply *model.FinWithdrawApply) (err error) { //1、修改提现单为成功 diff --git a/app/lib/flexible_employment/pupiao.go b/app/lib/flexible_employment/pupiao.go index 66f24d0..558fde3 100644 --- a/app/lib/flexible_employment/pupiao.go +++ b/app/lib/flexible_employment/pupiao.go @@ -23,7 +23,7 @@ type PuPiao struct { AppSecret string } -const urlForPrd = "https://openapi.gongmall.com" +const urlForPrd = "https://admin.linglong.net.cn" const urlForDev = "http://api.testlg.cn" func NewPuPiao(appId, appSecret string) *PuPiao { diff --git a/consume/init.go b/consume/init.go index aba3d6a..f4602d5 100644 --- a/consume/init.go +++ b/consume/init.go @@ -80,17 +80,17 @@ func initConsumes() { //////////////////////////////////////// oneCircles ///////////////////////////////////////////////////// - jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume - jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume - jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume - jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume - jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume + //jobs[consumeMd.OneCirclesSignInGreenEnergyFunName] = OneCirclesSignInGreenEnergyConsume + //jobs[consumeMd.OneCirclesStartLevelDividendFunName] = OneCirclesStartLevelDividendConsume + //jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyConsume + //jobs[consumeMd.OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamFunName] = OneCirclesActivityCoinAutoExchangeGreenEnergyForTeamConsume + //jobs[consumeMd.OneCirclesSettlementPublicGiveActivityCoinFunName] = OneCirclesSettlementPublicGiveActivityCoinConsume ////jobs[consumeMd.OneCirclesSignInCopyGreenEnergyFunName] = OneCirclesSignInCopyGreenEnergyConsume //////////////////////////////////////// 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.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分 //jobs[consumeMd.ZhiosOneCirclesCoinConsumeFunName] = ZhiosOneCirclesCoinConsume //一个圈圈虚拟币变化 diff --git a/consume/withdraw_consume_pupiao.go b/consume/withdraw_consume_pupiao.go index 2c2bb49..ac2bc86 100644 --- a/consume/withdraw_consume_pupiao.go +++ b/consume/withdraw_consume_pupiao.go @@ -68,19 +68,24 @@ func FlexibleEmploymentWithdrawForPupiaoConsume(queue md.MqQueue) { } func handleFlexibleEmploymentWithdrawForPupiaoConsume(msgData []byte) error { + var ms string + err := json.Unmarshal(msgData, &ms) + if err != nil { + return err + } time.Sleep(time.Microsecond * 200) // 等待200毫秒 //1、解析mq中queue的数据结构体 var msg struct { - Uid string `json:"uid"` - Nickname string `json:"nickname"` - MasterId string `json:"master_id"` - AppName string `json:"app_name"` - ApplyOrder string `json:"apply_order"` - ActualAmount string `json:"actual_amount"` - Oid string `json:"oid"` - MobCfg string `json:"mob_cfg"` + Uid string `json:"uid"` + Nickname string `json:"nickname"` + MasterId string `json:"master_id"` + AppName string `json:"app_name"` + ApplyOrder string `json:"apply_order"` + ActualAmount string `json:"actual_amount"` + Oid string `json:"oid"` + MobCfg interface{} `json:"mob_cfg"` } - err := json.Unmarshal(msgData, &msg) + err = json.Unmarshal([]byte(ms), &msg) if err != nil { return err } @@ -165,7 +170,7 @@ func handleFlexibleEmploymentWithdrawForPupiaoConsume(msgData []byte) error { session := engine.NewSession() defer session.Close() session.Begin() - err = svc.DealFailResult(session, finWithdrawApply, msg.MasterId, response.ErrorMsg) + err = svc.DealFailResultForPuPiao(session, finWithdrawApply, msg.MasterId, response.ErrorMsg) if err != nil { _ = session.Rollback() return err From 490e4c4161c7438acf34eb1717e6692286205c6a Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 25 May 2024 16:24:35 +0800 Subject: [PATCH 09/11] update --- .../model/flexible_employment_pupiao_basic.go | 21 ++++++++++--------- consume/withdraw_consume_pupiao.go | 6 +++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/flexible_employment/db/model/flexible_employment_pupiao_basic.go b/app/flexible_employment/db/model/flexible_employment_pupiao_basic.go index ef51385..0fa87bd 100644 --- a/app/flexible_employment/db/model/flexible_employment_pupiao_basic.go +++ b/app/flexible_employment/db/model/flexible_employment_pupiao_basic.go @@ -1,14 +1,15 @@ package model type FlexibleEmploymentPupiaoBasic struct { - Id int `json:"id" xorm:"not null pk autoincr INT(11)"` - MasterId int `json:"master_id" xorm:"not null default 0 comment('站长ID') INT(11)"` - AppId string `json:"app_id" xorm:"not null default '' comment('appId') VARCHAR(255)"` - AppSecret string `json:"app_secret" xorm:"not null default '' comment('appSecret') VARCHAR(255)"` - HrCompanyId string `json:"hr_company_id" xorm:"not null default '' comment('hrcompanyId') VARCHAR(255)"` - SettleAccountId string `json:"settle_account_id" xorm:"not null default '' comment('settleAccountId') VARCHAR(255)"` - CallbackUrl string `json:"callback_url" xorm:"not null default '' comment('回调地址') VARCHAR(255)"` - WithdrawalType int `json:"withdrawal_type" xorm:"not null default 1 comment('提现方式(1:支付宝 2:银行卡)') TINYINT(1)"` - CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` - UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + MasterId int `json:"master_id" xorm:"not null default 0 comment('站长ID') INT(11)"` + AppId string `json:"app_id" xorm:"not null default '' comment('appId') VARCHAR(255)"` + AppSecret string `json:"app_secret" xorm:"not null default '' comment('appSecret') VARCHAR(255)"` + HrCompanyId string `json:"hr_company_id" xorm:"not null default '' comment('hrcompanyId') VARCHAR(255)"` + SettleAccountId string `json:"settle_account_id" xorm:"not null default '' comment('settleAccountId') VARCHAR(255)"` + SettleAccountIdForAli string `json:"settle_account_id_for_ali" xorm:"not null default '' comment('settleAccountId') VARCHAR(255)"` + CallbackUrl string `json:"callback_url" xorm:"not null default '' comment('回调地址') VARCHAR(255)"` + WithdrawalType int `json:"withdrawal_type" xorm:"not null default 1 comment('提现方式(1:支付宝 2:银行卡)') TINYINT(1)"` + CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"` + UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"` } diff --git a/consume/withdraw_consume_pupiao.go b/consume/withdraw_consume_pupiao.go index ac2bc86..280adda 100644 --- a/consume/withdraw_consume_pupiao.go +++ b/consume/withdraw_consume_pupiao.go @@ -129,10 +129,14 @@ func handleFlexibleEmploymentWithdrawForPupiaoConsume(msgData []byte) error { } str, _ := json.Marshal(userAESData) itemAESContent, _ := aes.AesEncryptByECB([]byte(basic.AppSecret), string(str)) + settleAccountId := basic.SettleAccountId + if flexibleEmploymentPupiaoOrd.SettleType == "ALIPAY" { + settleAccountId = basic.SettleAccountIdForAli + } result, err := puPiao.Curl(enum.OpenApiPaymentReceiveOrder, map[string]interface{}{ "outBatchNo": flexibleEmploymentPupiaoOrd.OutBatchNo, "hrcompanyId": basic.HrCompanyId, - "settleAccountId": basic.SettleAccountId, + "settleAccountId": settleAccountId, "totalCount": "1", "totalAmount": flexibleEmploymentPupiaoOrd.TotalAmount, "itemAESContent": itemAESContent, From a5219d866f064d31f1592f2a197088dc5f8c05f9 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 25 May 2024 16:33:57 +0800 Subject: [PATCH 10/11] update --- app/lib/flexible_employment/pupiao.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/lib/flexible_employment/pupiao.go b/app/lib/flexible_employment/pupiao.go index 558fde3..a6cea82 100644 --- a/app/lib/flexible_employment/pupiao.go +++ b/app/lib/flexible_employment/pupiao.go @@ -1,7 +1,6 @@ package flexible_employment import ( - "applet/app/cfg" "bytes" "crypto/md5" "encoding/hex" @@ -23,7 +22,7 @@ type PuPiao struct { AppSecret string } -const urlForPrd = "https://admin.linglong.net.cn" +const urlForPrd = "http://admin.linglong.net.cn" const urlForDev = "http://api.testlg.cn" func NewPuPiao(appId, appSecret string) *PuPiao { @@ -77,7 +76,7 @@ func (gm *PuPiao) Curl(uri string, params map[string]interface{}) (result map[st // 构造请求 var url string - if cfg.Prd { + if true { url = urlForPrd + uri } else { url = urlForDev + uri From 043c03264e7242654e9dd2d7c107a404bed44f78 Mon Sep 17 00:00:00 2001 From: dengbiao Date: Sat, 25 May 2024 17:04:05 +0800 Subject: [PATCH 11/11] update --- app/lib/flexible_employment/pupiao.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/lib/flexible_employment/pupiao.go b/app/lib/flexible_employment/pupiao.go index a6cea82..c0b7193 100644 --- a/app/lib/flexible_employment/pupiao.go +++ b/app/lib/flexible_employment/pupiao.go @@ -3,6 +3,7 @@ package flexible_employment import ( "bytes" "crypto/md5" + "crypto/tls" "encoding/hex" "encoding/json" "fmt" @@ -22,7 +23,7 @@ type PuPiao struct { AppSecret string } -const urlForPrd = "http://admin.linglong.net.cn" +const urlForPrd = "https://admin.linglong.net.cn" const urlForDev = "http://api.testlg.cn" func NewPuPiao(appId, appSecret string) *PuPiao { @@ -106,7 +107,12 @@ func (gm *PuPiao) mergeMaps(map1, map2 map[string]interface{}) map[string]interf } func (gm *PuPiao) httpPostBody(url string, msg []byte) ([]byte, error) { - resp, err := http.Post(url, "application/json;charset=utf-8", bytes.NewBuffer(msg)) + client := &http.Client{ + Transport: &http.Transport{ + TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, + }, + } + resp, err := client.Post(url, "application/json;charset=utf-8", bytes.NewBuffer(msg)) if err != nil { return []byte(""), err }