重构优惠券表结构与功能
This commit is contained in:
@@ -332,8 +332,8 @@ func (s *tradeService) OnCompleteTrade(user *m.User, interNo string, outerNo str
|
||||
}
|
||||
|
||||
// 核销优惠券
|
||||
if detail.CouponId != nil {
|
||||
err = Coupon.UseCoupon(q, *detail.CouponId)
|
||||
if detail.CouponUserId != nil {
|
||||
err = Coupon.UseCoupon(q, *detail.CouponUserId)
|
||||
if err != nil {
|
||||
return core.NewServErr("核销优惠券失败", err)
|
||||
}
|
||||
@@ -614,15 +614,13 @@ type ProductData interface {
|
||||
}
|
||||
|
||||
type TradeDetail struct {
|
||||
Product ProductData `json:"product"`
|
||||
Type m.TradeType `json:"type"`
|
||||
Subject string `json:"subject"`
|
||||
Amount decimal.Decimal `json:"amount"`
|
||||
Actual decimal.Decimal `json:"actual"`
|
||||
DiscountId *int32 `json:"discount_id,omitempty"`
|
||||
Discount *m.ProductDiscount `json:"-"` // 不应缓存
|
||||
CouponId *int32 `json:"coupon_id,omitempty"`
|
||||
Coupon *m.Coupon `json:"-"` // 不应缓存
|
||||
Product ProductData `json:"product"`
|
||||
Type m.TradeType `json:"type"`
|
||||
Subject string `json:"subject"`
|
||||
Amount decimal.Decimal `json:"amount"`
|
||||
Actual decimal.Decimal `json:"actual"`
|
||||
DiscountId *int32 `json:"discount_id,omitempty"`
|
||||
CouponUserId *int32 `json:"coupon_id,omitempty"`
|
||||
}
|
||||
|
||||
type TradeErr string
|
||||
|
||||
Reference in New Issue
Block a user