Explorar el Código

购买套餐调整

zhangxiaobin hace 1 año
padre
commit
348d56874e
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      application/common/service/OrderService.php

+ 5 - 0
application/common/service/OrderService.php

@@ -49,6 +49,7 @@ class OrderService
             //验证套餐
             $packageWhere['id'] = $packageId;
             $packageWhere['status'] = 1;
+            $packageWhere['num'] = ['gt',0];
             $package = Db::name('package')->where($packageWhere)->find();
             if (empty($package)) {
                 throw new Exception('未找到套餐信息');
@@ -182,7 +183,11 @@ class OrderService
             //生成订单
             $time = time();
             $packageWhere['id'] = $packageId;
+            $packageWhere['num'] = ['gt',0];
             $package = Db::name('package')->where($packageWhere)->lock(true)->find();
+            if (empty($package)) {
+                throw new Exception('未找到套餐信息');
+            }
             $userWhere['id'] = $userId;
             $user = Db::name('user')->where($userWhere)->find();
             //绑定门店