Selaa lähdekoodia

Merge remote-tracking branch 'origin/master'

order_statistics
huangjiajun 5 kuukautta sitten
vanhempi
commit
d2024bf435
10 muutettua tiedostoa jossa 181 lisäystä ja 82 poistoa
  1. +3
    -2
      app/db/dbs_map.go
  2. +11
    -10
      app/flexible_employment/db/model/flexible_employment_pupiao_basic.go
  3. +79
    -0
      app/flexible_employment/svc/svc_fin_withdraw_apply.go
  4. +9
    -4
      app/lib/flexible_employment/pupiao.go
  5. +42
    -42
      consume/init.go
  6. +5
    -4
      consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go
  7. +5
    -4
      consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go
  8. +2
    -1
      consume/one_circles_settlement_public_activity_coin_consume.go
  9. +20
    -11
      consume/withdraw_consume_pupiao.go
  10. +5
    -4
      go.mod

+ 3
- 2
app/db/dbs_map.go Näytä tiedosto

@@ -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)
}


+ 11
- 10
app/flexible_employment/db/model/flexible_employment_pupiao_basic.go Näytä tiedosto

@@ -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"`
}

+ 79
- 0
app/flexible_employment/svc/svc_fin_withdraw_apply.go Näytä tiedosto

@@ -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、修改提现单为成功


+ 9
- 4
app/lib/flexible_employment/pupiao.go Näytä tiedosto

@@ -1,9 +1,9 @@
package flexible_employment

import (
"applet/app/cfg"
"bytes"
"crypto/md5"
"crypto/tls"
"encoding/hex"
"encoding/json"
"fmt"
@@ -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 {
@@ -77,7 +77,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
@@ -107,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
}


+ 42
- 42
consume/init.go Näytä tiedosto

@@ -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

//

@@ -88,9 +88,9 @@ func initConsumes() {
////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 //一个圈圈虚拟币变化


+ 5
- 4
consume/one_circles_activity_coin_auto_exchange_green_energy_consume.go Näytä tiedosto

@@ -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"
@@ -31,7 +32,7 @@ func OneCirclesActivityCoinAutoExchangeGreenEnergyConsume(queue md.MqQueue) {
//1、将自己绑定到交换机上
ch.Bind(queue.Name, queue.ExchangeName, queue.RoutKey)
//2、取出数据进行消费
ch.Qos(1)
ch.Qos(40)
delivery := ch.Consume(queue.Name, false)

one_circles.Init(cfg.RedisAddr)
@@ -60,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(100) * time.Microsecond) //休眠0.1毫秒
//1、解析mq中queue的数据结构体
var msg *md2.OneCirclesStructForAutoExchangeGreenEnergy
err := json.Unmarshal(msgData, &msg)
@@ -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,


+ 5
- 4
consume/one_circles_activity_coin_auto_exchange_green_energy_for_team_consume.go Näytä tiedosto

@@ -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"
@@ -31,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)
@@ -60,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)
@@ -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,


+ 2
- 1
consume/one_circles_settlement_public_activity_coin_consume.go Näytä tiedosto

@@ -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,


+ 20
- 11
consume/withdraw_consume_pupiao.go Näytä tiedosto

@@ -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
}
@@ -124,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,
@@ -165,7 +174,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


+ 5
- 4
go.mod Näytä tiedosto

@@ -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.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
@@ -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,17 +34,18 @@ 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
)

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


Ladataan…
Peruuta
Tallenna