From 16a815a1219e7488d6eeab16688c8af48d8b48ad Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 11 Mar 2024 08:56:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- consume/init.go | 80 ++++++++++++++--------------- consume/zhios_order_total_second.go | 15 +++++- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/consume/init.go b/consume/init.go index 51c6704..fb19f3e 100644 --- a/consume/init.go +++ b/consume/init.go @@ -18,47 +18,47 @@ func Init() { // 增加消费任务队列 func initConsumes() { // - //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.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.ZhiosAppreciationFunName] = ZhiosAppreciation - //jobs[consumeMd.ZhiosValidUserFunName] = ZhiosValidUser + jobs[consumeMd.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal + jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy + jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle // - //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.ZhiosSupplierAfterOrderFunName] = ZhiosSupplierAfterOrder + jobs[consumeMd.ZhiosGuideStoreOrderFunName] = ZhiosGuideStoreOrder + + 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 // @@ -84,7 +84,7 @@ func initConsumes() { //////////////////////////////////////// withdraw ///////////////////////////////////////////////////// //jobs[consumeMd.WithdrawConsumeFunName] = WithdrawConsume - jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分 + //jobs[consumeMd.ZhiosMallGreenCoinConsumeFunName] = ZhiosMallGreenCoinConsume //绿色双链积分 } func Run() { diff --git a/consume/zhios_order_total_second.go b/consume/zhios_order_total_second.go index 59cda15..a4d0b0a 100644 --- a/consume/zhios_order_total_second.go +++ b/consume/zhios_order_total_second.go @@ -119,25 +119,36 @@ func handleZhiosOrderTotalSecond(msg []byte) error { Date: utils.StrToInt(now), Uid: v.Uid, } - _, err := sess.Insert(&userStatistics) + has, err := sess.Insert(&userStatistics) if err != nil { sess.Rollback() return err } + if has == 0 { + sess.Rollback() + return errors.New("失败") + } } + isupdate := 0 if ordData.State == 4 && ordData.IsTotal == 1 { + isupdate = 1 isTotal = 2 userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4) } if ordData.State != 4 && ordData.IsTotal == 0 { + isupdate = 1 isTotal = 1 userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4) } - _, err := sess.Where("id=?", userStatistics.Id).Cols("amount").Update(&userStatistics) + update, err := sess.Where("id=?", userStatistics.Id).Cols("amount").Update(&userStatistics) if err != nil { sess.Rollback() return err } + if update == 0 && isupdate == 1 { + sess.Rollback() + return errors.New("失败") + } } } } else {