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

View File

@ -44,6 +44,10 @@ const (
Rmb = 100 Rmb = 100
) )
const (
AccountForDw = 2 // 迪为账户
)
// 商品 // 商品
// gen:qs // gen:qs
// //
@ -70,13 +74,14 @@ type Goods struct {
DiscountList string `json:"discount_list" gorm:"type:text;"` // 折扣 DiscountList string `json:"discount_list" gorm:"type:text;"` // 折扣
SpecIndex string `json:"spec_index" gorm:"index"` // 1_3 SpecIndex string `json:"spec_index" gorm:"index"` // 1_3
PriceVm uint32 `json:"price_vm"` // 积分价格 PriceVm uint32 `json:"price_vm"` // 积分价格
PriceRm uint32 `json:"price_rm"` // 人民币价格 PriceRm uint32 `json:"price_rm"` // 人民币价格
PriceOriginal uint32 `json:"price_original"` // 市场价 PriceOriginal uint32 `json:"price_original"` // 市场价
DeliveryFee uint32 `json:"delivery_fee"` // 邮费 DeliveryFee uint32 `json:"delivery_fee"` // 邮费
DealType uint32 `json:"deal_type"` // 1-积分兑换 2-购买 3-抵扣 DealType uint32 `json:"deal_type"` // 1-积分兑换 2-购买 3-抵扣
VersionId uint64 `json:"version_id"` // 乐观锁 VersionId uint64 `json:"version_id"` // 乐观锁
ShowDiscount int8 `json:"show_discount"` // ShowDiscount int8 `json:"show_discount"` //
GoodsAccountNum uint32 `json:"goods_account_num"` // 收款账户编号
GoodsCat *GoodsCat `json:"goods_cat" gorm:"-"` GoodsCat *GoodsCat `json:"goods_cat" gorm:"-"`
GoodsDiscount *GoodsDiscount `json:"goods_discount" gorm:"-"` GoodsDiscount *GoodsDiscount `json:"goods_discount" gorm:"-"`