by Robin at 20240628

This commit is contained in:
Leufolium 2024-06-28 23:13:21 +08:00
parent 213cc36149
commit 3a83ade89f
3 changed files with 46 additions and 29 deletions

View File

@ -1,8 +1,9 @@
package errs
import (
"github.com/pkg/errors"
"service/api/errcode"
"github.com/pkg/errors"
)
func DealVasErr(err error) (errcode.ErrCode, error) {
@ -42,23 +43,24 @@ var ErrEcMap = map[error]errcode.ErrCode{
}
var (
ErrVasProductNotExists = errors.New("vas product not exists")
ErrVasNotMoneyProduct = errors.New("not money product")
ErrVasWalletNotExist = errors.New("vas wallet not exists")
ErrVasInvalidContactProduct = errors.New("invalid contact product")
ErrVasUserVasNotExist = errors.New("user vas not exists")
ErrVasNoEnoughCoin = errors.New("no enough coin")
ErrVasInvalidCoinPrice = errors.New("invalid coin price")
ErrVasInvalidOrder = errors.New("invalid order")
ErrVasOrderNotMatch = errors.New("order not match")
ErrVasOrderNotExists = errors.New("order not exists")
ErrVasNotUnlock = errors.New("not unlock")
ErrVasAlreadyUnlock = errors.New("already unlock")
ErrVasRepeatDeal = errors.New("repeat deal")
ErrVasInvalidCalcPrice = errors.New("invalid calc price")
ErrVasInvalidParam = errors.New("invalid param")
ErrVasNoEnoughWithdrawDias = errors.New("no enough withdraw dias")
ErrVasAlipayUniTransferFail = errors.New("alipay uni transfer fail")
ErrVasOverTodayWithdrawCnt = errors.New("over today withdraw cnt")
ErrVasRefundLimit = errors.New("账号已受限,解限请联系客服")
ErrVasProductNotExists = errors.New("vas product not exists")
ErrVasNotMoneyProduct = errors.New("not money product")
ErrVasWalletNotExist = errors.New("vas wallet not exists")
ErrVasInvalidContactProduct = errors.New("invalid contact product")
ErrVasUserVasNotExist = errors.New("user vas not exists")
ErrVasNoEnoughCoin = errors.New("no enough coin")
ErrVasInvalidCoinPrice = errors.New("invalid coin price")
ErrVasInvalidOrder = errors.New("invalid order")
ErrVasOrderNotMatch = errors.New("order not match")
ErrVasOrderNotExists = errors.New("order not exists")
ErrVasNotUnlock = errors.New("not unlock")
ErrVasAlreadyUnlock = errors.New("already unlock")
ErrVasRepeatDeal = errors.New("repeat deal")
ErrVasInvalidCalcPrice = errors.New("invalid calc price")
ErrVasInvalidParam = errors.New("invalid param")
ErrVasNoEnoughWithdrawDias = errors.New("no enough withdraw dias")
ErrVasAlipayUniTransferFail = errors.New("alipay uni transfer fail")
ErrVasOverTodayWithdrawCnt = errors.New("over today withdraw cnt")
ErrVasRefundLimit = errors.New("账号已受限,解限请联系客服")
ErrVasHvyogoSingleDistributionFail = errors.New("hvyogo single distribution fail")
)

View File

@ -3487,11 +3487,6 @@ func (s *Service) ApiHvyogoSingleDistribute(ctx *gin.Context, req *hvyogoproto.A
logger.Error("_DefaultSingleDistributeHis OpUpdate fail, err: %v", err)
}
if resp.StatusCode != response.StatusCodeSuccess {
err = fmt.Errorf("single distribution fail")
return resp, err
}
return resp, nil
}
@ -3515,6 +3510,17 @@ func (s *Service) ApiHvyogoSingleDistribute(ctx *gin.Context, req *hvyogoproto.A
err = nil
return
}
// 下发打款接口未成功调用
if resp.StatusCode != response.StatusCodeSuccess {
logger.Error("WithdrawApply fail, req: %v, err: %v", util.ToJson(req), resp.StatusText)
// 恢复锁
_, err = _DefaultSingleDistributeHis.GetAndDecLock(ctx, req.BaseRequest.Mid)
if err != nil {
logger.Error("_DefaultSingleDistributeHis GetAndDecLock failed : %v", err)
ec, err = errcode.ErrCodeSingleDistributeHisSrvFail, nil
return
}
}
// 组装返回结果
data = &hvyogoproto.ApiSingleDistributeData{}

View File

@ -11,6 +11,7 @@ import (
"fmt"
"service/api/base"
"service/api/errs"
"service/api/message/response"
accountproto "service/api/proto/account/proto"
hvyogoproto "service/api/proto/hvyogo/proto"
vasproto "service/api/proto/vas/proto"
@ -3870,10 +3871,18 @@ func (v *Vas) UnilaterallyHvyogoWithdrawApply(ctx *gin.Context, req *vasproto.Un
if err != nil {
logger.Error("global err, req: %v, err: %v", util.ToJson(req), err)
}
errTx := v.store.DealTxCR(tx, err)
if errTx != nil {
logger.Error("DealTxCR fail, err: %v", errTx)
return
if resp.StatusCode != response.StatusCodeSuccess {
errTx := v.store.DealTxCR(tx, errs.ErrVasHvyogoSingleDistributionFail)
if errTx != nil {
logger.Error("DealTxCR fail, err: %v", errTx)
return
}
} else {
errTx := v.store.DealTxCR(tx, err)
if errTx != nil {
logger.Error("DealTxCR fail, err: %v", errTx)
return
}
}
}()