This commit is contained in:
2024-06-07 09:19:04 +08:00
parent 859c9f56d0
commit 035676ba57
4 changed files with 64 additions and 18 deletions
+7 -3
View File
@@ -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)
}
// 加载关联问诊类型