修改了 系统优惠卷详情 ,增加发放记录

This commit is contained in:
2024-05-31 17:42:34 +08:00
parent 7b021906a2
commit 61ca263d0d
5 changed files with 115 additions and 31 deletions
+6 -1
View File
@@ -22,7 +22,7 @@ type CouponService struct {
// GetSystemCoupon 系统优惠卷详情
func (r *CouponService) GetSystemCoupon(couponId int64) (g *dto.CouponDto, err error) {
couponDao := dao.CouponDao{}
coupon, err := couponDao.GetCouponById(couponId)
coupon, err := couponDao.GetCouponPreloadById(couponId)
if err != nil || coupon == nil {
return nil, errors.New(err.Error())
}
@@ -30,6 +30,11 @@ func (r *CouponService) GetSystemCoupon(couponId int64) (g *dto.CouponDto, err e
// 处理返回值
g = dto.GetCouponDto(coupon)
// 加载发放优惠卷数据
if len(coupon.CouponGrant) > 0 {
g = g.LoadCouponGrant(coupon.CouponGrant)
}
return g, nil
}