|
@@ -344,8 +344,8 @@ func (m *CouponDAO) GetCustomerCouponByCouponAndUser(couponid, userid string) ([
|
344
|
344
|
}
|
345
|
345
|
|
346
|
346
|
// GetCouponDetail 获取优惠券详情
|
347
|
|
-func (m *CouponDAO) GetCouponDetail(couponid string) (*CaseCouponDetail, error) {
|
348
|
|
- var coupon = new(CaseCouponDetail)
|
|
347
|
+func (m *CouponDAO) GetCouponDetail(couponid string) (*CaseCouponDetailWithRealName, error) {
|
|
348
|
+ var coupon = new(CaseCouponDetailWithRealName)
|
349
|
349
|
sql := `select * from ta_coupon where coupon_id=? and status>?`
|
350
|
350
|
_, err := m.db.Sql(sql, couponid, models.STATUS_DEL).Get(coupon)
|
351
|
351
|
if err != nil {
|
|
@@ -354,7 +354,7 @@ func (m *CouponDAO) GetCouponDetail(couponid string) (*CaseCouponDetail, error)
|
354
|
354
|
if coupon == nil || coupon.CouponId == "" {
|
355
|
355
|
return nil, errors.New("无优惠券信息")
|
356
|
356
|
}
|
357
|
|
- cCoupons, err := m.GetCustomerCouponByCoupon(couponid)
|
|
357
|
+ cCoupons, err := m.GetCustomerCouponByCouponWithRealName(couponid)
|
358
|
358
|
if err != nil {
|
359
|
359
|
return nil, err
|
360
|
360
|
}
|
|
@@ -369,6 +369,14 @@ func (m *CouponDAO) GetCustomerCouponByCoupon(couponid string) ([]model.TaCustom
|
369
|
369
|
return customerCoupons, err
|
370
|
370
|
}
|
371
|
371
|
|
|
372
|
+// GetCustomerCouponByCouponWithRealName 根据优惠券与用户获取领取的用户信息
|
|
373
|
+func (m *CouponDAO) GetCustomerCouponByCouponWithRealName(couponid string) ([]CustomerCouponWithSales, error) {
|
|
374
|
+ var customerCoupons []CustomerCouponWithSales
|
|
375
|
+ sql := `select a.*,b.real_name from ta_customer_coupon a inner join sys_user b on a.sales_id = b.user_id where a.coupon_id=? and a.status>?`
|
|
376
|
+ err := m.db.Sql(sql, couponid, models.STATUS_DEL).Find(&customerCoupons)
|
|
377
|
+ return customerCoupons, err
|
|
378
|
+}
|
|
379
|
+
|
372
|
380
|
// GetCustomerCouponByUser 根据用户获取领取的用户信息
|
373
|
381
|
func (m *CouponDAO) GetCustomerCouponByUser(caseid, userid string) ([]model.TaCustomerCoupon, error) {
|
374
|
382
|
var customerCoupons []model.TaCustomerCoupon
|