Просмотр исходного кода

添加时要校验用户领取的数量不能大于优惠券发放的限量

evoxwht 2 лет назад
Родитель
Сommit
1afa4b504d
1 измененных файлов с 6 добавлено и 0 удалено
  1. 6 0
      crmeb/app/services/activity/coupon/StoreCouponIssueServices.php

+ 6 - 0
crmeb/app/services/activity/coupon/StoreCouponIssueServices.php

@@ -123,6 +123,12 @@ class StoreCouponIssueServices extends BaseServices
             $data['is_permanent'] = 1;
             $data['total_count'] = 0;
         }
+
+        if ($data['is_permanent'] != 1 && $data['receive_limit'] > $data['total_count']) {
+            throw new AdminException(500031);
+        }
+
+
         $data['add_time'] = time();
         $res = $this->dao->save($data);
         if (($data['product_id'] !== '' || $data['category_id'] !== '') && $res) {