1
This commit is contained in:
@@ -22,17 +22,21 @@ type CouponService struct {
|
||||
// GetSystemCoupon 系统优惠卷详情
|
||||
func (r *CouponService) GetSystemCoupon(couponId int64) (g *dto.CouponDto, err error) {
|
||||
couponDao := dao.CouponDao{}
|
||||
coupon, err := couponDao.GetCouponPreloadById(couponId)
|
||||
coupon, err := couponDao.GetCouponById(couponId)
|
||||
if err != nil || coupon == nil {
|
||||
return nil, errors.New(err.Error())
|
||||
}
|
||||
|
||||
// 获取优惠卷发放数据
|
||||
couponGrantDao := dao.CouponGrantDao{}
|
||||
couponGrants, err := couponGrantDao.GetCouponGrantListPreloadByCouponId(coupon.CouponId)
|
||||
|
||||
// 处理返回值
|
||||
g = dto.GetCouponDto(coupon)
|
||||
|
||||
// 加载发放优惠卷数据
|
||||
if len(coupon.CouponGrant) > 0 {
|
||||
g = g.LoadCouponGrant(coupon.CouponGrant)
|
||||
if len(couponGrants) > 0 {
|
||||
g = g.LoadCouponGrant(couponGrants)
|
||||
}
|
||||
|
||||
// 加载关联问诊类型
|
||||
|
||||
Reference in New Issue
Block a user