wangfei 6 years ago
parent
commit
85f8e5d9a2
2 changed files with 4 additions and 4 deletions
  1. 2
    2
      service/card/card.go
  2. 2
    2
      service/coupon/coupon.go

+ 2
- 2
service/card/card.go View File

71
 		if usetype != "" {
71
 		if usetype != "" {
72
 			switch usetype {
72
 			switch usetype {
73
 			case models.COUPONCARD_USETYPE_LUCKDRAW:
73
 			case models.COUPONCARD_USETYPE_LUCKDRAW:
74
-				filters = append(filters, "card_id not in (select resource_id from sys_activity_action where active_type='"+models.ActGiveCard+"')")
74
+				filters = append(filters, "card_id not in (select resource_id from sys_activity_action where active_type='"+models.ActGiveCard+"') and used_count=0")
75
 				break
75
 				break
76
 			case models.COUPONCARD_USETYPE_SYS:
76
 			case models.COUPONCARD_USETYPE_SYS:
77
-				filters = append(filters, "card_id not in (select coupon_card_id from ta_luckdraw_record where coupon_card_type='"+models.PRIZE_TYPE_CARD+"')")
77
+				filters = append(filters, "card_id not in (select coupon_card_id from ta_luckdraw_record where coupon_card_type='"+models.PRIZE_TYPE_CARD+"') and used_count=0")
78
 				break
78
 				break
79
 			}
79
 			}
80
 		}
80
 		}

+ 2
- 2
service/coupon/coupon.go View File

66
 		if usetype != "" {
66
 		if usetype != "" {
67
 			switch usetype {
67
 			switch usetype {
68
 			case models.COUPONCARD_USETYPE_LUCKDRAW:
68
 			case models.COUPONCARD_USETYPE_LUCKDRAW:
69
-				filters = append(filters, "coupon_id not in (select resource_id from sys_activity_action where active_type='"+models.ActGiveCoupon+"')")
69
+				filters = append(filters, "coupon_id not in (select resource_id from sys_activity_action where active_type='"+models.ActGiveCoupon+"') and used_count=0")
70
 				break
70
 				break
71
 			case models.COUPONCARD_USETYPE_SYS:
71
 			case models.COUPONCARD_USETYPE_SYS:
72
-				filters = append(filters, "coupon_id not in (select coupon_card_id from ta_luckdraw_record where coupon_card_type='"+models.PRIZE_TYPE_COUPON+"')")
72
+				filters = append(filters, "coupon_id not in (select coupon_card_id from ta_luckdraw_record where coupon_card_type='"+models.PRIZE_TYPE_COUPON+"') and used_count=0")
73
 				break
73
 				break
74
 			}
74
 			}
75
 		}
75
 		}