1、新建商城订单时判断收款账户(明慧/迪为);

This commit is contained in:
chenlin 2025-01-15 15:40:03 +08:00
parent 98e2fa8b31
commit 85439ff6f2
2 changed files with 43 additions and 20 deletions

View File

@ -157,7 +157,8 @@ type MallOrderCreateReq struct {
// @Tags 商城, V1.4.5
// @Produce json
// @Accept json
// @Success 200 {object} model.HomeCategoryListResp
// @Param request body MallOrderCreateReq true "新建商城订单模型"
// @Success 200 {object} RespRet
// @Router /api/v1/mall/order/create [post]
func MallOrderCreate(c *gin.Context) {
req := MallOrderCreateReq{}
@ -449,6 +450,22 @@ func MallOrderCreate(c *gin.Context) {
return
}
if goods.GoodsAccountNum == model.AccountForDw { // 迪为账户收费
webPay, err := wxpay.WebPay(order.SerialNo, order.Rm, user.WxOpenID, "N", wxpay.WxPayBuyGoods, configInfo.NotifyUrl, true)
if err != nil {
logger.Error(errors.New("WebPay err"))
RespJson(c, status.InternalServerError, nil)
return
}
ret := map[string]interface{}{
"web_pay": webPay,
"order_id": order.ID,
"order": order,
}
RespOK(c, ret)
} else { // 其他则默认明慧账户收费
webPay, err := wxpay.HmJsPayUnifiedOrderForBuyGoods(order.SerialNo, order.Rm, user.WxOpenID, configInfo.NotifyUrl)
if err != nil {
logger.Error(errors.New("WebPay err"))
@ -463,6 +480,7 @@ func MallOrderCreate(c *gin.Context) {
}
RespOK(c, ret)
}
return
}

View File

@ -44,6 +44,10 @@ const (
Rmb = 100
)
const (
AccountForDw = 2 // 迪为账户
)
// 商品
// gen:qs
//
@ -77,6 +81,7 @@ type Goods struct {
DealType uint32 `json:"deal_type"` // 1-积分兑换 2-购买 3-抵扣
VersionId uint64 `json:"version_id"` // 乐观锁
ShowDiscount int8 `json:"show_discount"` //
GoodsAccountNum uint32 `json:"goods_account_num"` // 收款账户编号
GoodsCat *GoodsCat `json:"goods_cat" gorm:"-"`
GoodsDiscount *GoodsDiscount `json:"goods_discount" gorm:"-"`