dengbiao 4 months ago
parent
commit
74c9de26b9
2 changed files with 68 additions and 65 deletions
  1. +45
    -45
      consume/init.go
  2. +23
    -20
      consume/zhios_order_total_second.go

+ 45
- 45
consume/init.go View File

@@ -19,49 +19,49 @@ 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.ZhiosOrderSettleTotalFunName] = ZhiosSettleTotal
//jobs[consumeMd.ZhiosOrderHjyFunName] = ZhiosOrderHjy
//jobs[consumeMd.ZhiosOrderBuckleFunName] = ZhiosOrderBuckle
//
//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.ZhiosAutoUnFreeze] = ZhiosAutoUnFreeze
////jobs[consumeMd.ZhiosUserProfileInviteCode] = ZhiosUserProfileInviteCode
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.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.ZhiosAutoUnFreeze] = ZhiosAutoUnFreeze
//jobs[consumeMd.ZhiosUserProfileInviteCode] = ZhiosUserProfileInviteCode

//

@@ -108,8 +108,8 @@ func initConsumes() {
//jobs[consumeMd.InstallmentPaymentAutoRepaidConsumeFunName] = InstallmentPaymentAutoRepaidConsume //分期付 - 自动扣款

////////////////////////////////////// SuperCloudIssuance /////////////////////////////////////////////////////
jobs[consumeMd.SuperCloudIssuanceMsgCallBackFunName] = SuperCloudIssuanceMsgCallBackConsume
jobs[consumeMd.SuperCloudIssuanceAsyncMLoginFunName] = SuperCloudIssuanceAsyncMLoginConsume
//jobs[consumeMd.SuperCloudIssuanceMsgCallBackFunName] = SuperCloudIssuanceMsgCallBackConsume
//jobs[consumeMd.SuperCloudIssuanceAsyncMLoginFunName] = SuperCloudIssuanceAsyncMLoginConsume

////////////////////////////////////// DMS /////////////////////////////////////////////////////
//jobs[consumeMd.CanalGimMessageConsumeFunName] = CanalGimMessageConsume


+ 23
- 20
consume/zhios_order_total_second.go View File

@@ -38,6 +38,7 @@ func ZhiosOrderTotalSecond(queue md.MqQueue) {
err = handleZhiosOrderTotalSecond(res.Body)
//_ = res.Reject(false)
if err != nil {
fmt.Println("===================统计", err.Error())
_ = res.Reject(false)
//TODO::重新推回队列末尾,避免造成队列堵塞
var msg *md.ZhiosOrderBuckle
@@ -73,7 +74,6 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
fmt.Println("===with", err.Error())
return err
}
fmt.Println(tmpString)
err = json.Unmarshal([]byte(tmpString), &canalMsg)
if err != nil {
fmt.Println("===with", err.Error())
@@ -130,19 +130,20 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if has == 0 {
sess.Rollback()
return errors.New("失败")
return errors.New("失败1")
}
}
isupdate := 0
before := userStatistics.Amount
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)
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 6)
}
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)
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 6)
}
update, err := sess.Where("id=?", userStatistics.Id).Cols("amount").Update(&userStatistics)
if err != nil {
@@ -151,7 +152,9 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if update == 0 && isupdate == 1 {
sess.Rollback()
return errors.New("失败")
fmt.Println("================zhe", before, utils.SerializeStr(userStatistics))
fmt.Println("================zhe", utils.SerializeStr(ordData))
return errors.New("失败2")
}
if v.CreateAt > 1711086661 {
var userStatistics1 model.UserDayAmount
@@ -168,17 +171,17 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if has == 0 {
sess.Rollback()
return errors.New("失败")
return errors.New("失败3")
}
}
isupdate1 := 0
if ordData.State == 4 && ordData.IsTotal == 1 {
isupdate1 = 1
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 6)
}
if ordData.State != 4 && ordData.IsTotal == 0 {
isupdate1 = 1
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 6)
}
update1, err1 := sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics1)
if err1 != nil {
@@ -187,7 +190,7 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if update1 == 0 && isupdate1 == 1 {
sess.Rollback()
return errors.New("失败")
return errors.New("失败4")
}
}
var userStatistics1 model.UserWaitAmount
@@ -203,17 +206,17 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if has == 0 {
sess.Rollback()
return errors.New("失败")
return errors.New("失败5")
}
}
isupdate1 := 0
if ordData.State == 4 && ordData.IsTotal == 1 {
isupdate1 = 1
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-v.Amount-utils.StrToFloat64(v.AdditionalSubsidy), 6)
}
if ordData.State != 4 && ordData.IsTotal == 0 {
isupdate1 = 1
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+v.Amount+utils.StrToFloat64(v.AdditionalSubsidy), 6)
}
update1, err1 := sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics1)
if err1 != nil {
@@ -222,7 +225,7 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if update1 == 0 && isupdate1 == 1 {
sess.Rollback()
return errors.New("失败")
return errors.New("失败6")
}
}
}
@@ -257,15 +260,15 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if ordData.State == 4 && (ordData.IsTotal == 1 || ordData.IsTotal == 3) {
isTotal = 2
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-utils.StrToFloat64(v.AfterAmount), 4)
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-utils.StrToFloat64(v.AfterAmount), 6)
}
if ordData.State != 4 && (ordData.IsTotal == 0) {
isTotal = 3
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)+utils.StrToFloat64(v.AfterAmount), 4)
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)+utils.StrToFloat64(v.AfterAmount), 6)
}
if ordData.State != 4 && (ordData.IsTotal == 1) {
isTotal = 3
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-utils.StrToFloat64(v.Amount), 4)
userStatistics.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics.Amount)-utils.StrToFloat64(v.Amount), 6)
}
_, err := sess.Where("id=?", userStatistics.Id).Cols("amount").Update(&userStatistics)
if err != nil {
@@ -285,20 +288,20 @@ func handleZhiosOrderTotalSecond(msg []byte) error {
}
if has == 0 {
sess.Rollback()
return errors.New("失败")
return errors.New("失败a")
}
}
if ordData.State == 4 && (ordData.IsTotal == 1 || ordData.IsTotal == 3) {
isTotal = 2
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.AfterAmount), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.AfterAmount), 6)
}
if ordData.State != 4 && (ordData.IsTotal == 0) {
isTotal = 3
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+utils.StrToFloat64(v.AfterAmount), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)+utils.StrToFloat64(v.AfterAmount), 6)
}
if ordData.State != 4 && (ordData.IsTotal == 1) {
isTotal = 3
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.Amount), 4)
userStatistics1.Amount = utils.Float64ToStrByPrec(utils.StrToFloat64(userStatistics1.Amount)-utils.StrToFloat64(v.Amount), 6)
}
_, err = sess.Where("id=?", userStatistics1.Id).Cols("amount").Update(&userStatistics)
if err != nil {


Loading…
Cancel
Save