service/api/errs/error.go

65 lines
2.8 KiB
Go
Raw Normal View History

2023-12-21 22:17:40 +08:00
package errs
import (
"github.com/pkg/errors"
"service/api/errcode"
)
func DealVasErr(err error) (errcode.ErrCode, error) {
var (
ec = errcode.ErrCodeVasSrvOk
)
if err != nil {
2024-05-14 10:55:49 +08:00
if ec, ok := ErrEcMap[err]; ok {
2023-12-21 22:17:40 +08:00
return ec, err
}
ec = errcode.ErrCodeVasSrvFail
return ec, err
}
return ec, err
}
var ErrEcMap = map[error]errcode.ErrCode{
ErrVasProductNotExists: errcode.ErrCodeProductNotExist,
ErrVasNotMoneyProduct: errcode.ErrCodeVasNotMoneyProduct,
ErrVasWalletNotExist: errcode.ErrCodeVasWalletNotExist,
ErrVasInvalidContactProduct: errcode.ErrCodeVasInvalidContactProduct,
ErrVasUserVasNotExist: errcode.ErrCodeVasUserVasNotExist,
ErrVasNoEnoughCoin: errcode.ErrCodeVasNoEnoughCoin,
ErrVasInvalidCoinPrice: errcode.ErrCodeVasInvalidCoinPrice,
ErrVasInvalidOrder: errcode.ErrCodeVasInvalidOrder,
ErrVasOrderNotMatch: errcode.ErrCodeVasOrderNotMatch,
ErrVasOrderNotExists: errcode.ErrCodeVasOrderNotExists,
ErrVasNotUnlock: errcode.ErrCodeVasNotUnlock,
ErrVasAlreadyUnlock: errcode.ErrCodeVasAlreadyUnlock,
ErrVasRepeatDeal: errcode.ErrCodeVasRepeatDeal,
ErrVasInvalidCalcPrice: errcode.ErrCodeVasInvalidCalcPrice,
ErrVasInvalidParam: errcode.ErrCodeVasInvalidParam,
2024-01-08 11:49:16 +08:00
ErrVasNoEnoughWithdrawDias: errcode.ErrCodeVasNoEnoughWithdrawDias,
ErrVasAlipayUniTransferFail: errcode.ErrCodeVasAlipayUniTransferFail,
2024-01-08 22:38:18 +08:00
ErrVasOverTodayWithdrawCnt: errcode.ErrCodeVasOverTodayWithdrawCnt,
2024-05-14 10:55:49 +08:00
ErrVasRefundLimit: errcode.ErrCodeVasOverRefundLimit,
2023-12-21 22:17:40 +08:00
}
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")
2024-01-08 11:49:16 +08:00
ErrVasNoEnoughWithdrawDias = errors.New("no enough withdraw dias")
ErrVasAlipayUniTransferFail = errors.New("alipay uni transfer fail")
2024-01-08 22:38:18 +08:00
ErrVasOverTodayWithdrawCnt = errors.New("over today withdraw cnt")
2024-05-14 10:55:49 +08:00
ErrVasRefundLimit = errors.New("账号已受限,解限请联系客服")
2023-12-21 22:17:40 +08:00
)