Browse Source

购买套餐调整

zhangxiaobin 1 year ago
parent
commit
348d56874e
1 changed files with 5 additions and 0 deletions
  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['id'] = $packageId;
             $packageWhere['status'] = 1;
             $packageWhere['status'] = 1;
+            $packageWhere['num'] = ['gt',0];
             $package = Db::name('package')->where($packageWhere)->find();
             $package = Db::name('package')->where($packageWhere)->find();
             if (empty($package)) {
             if (empty($package)) {
                 throw new Exception('未找到套餐信息');
                 throw new Exception('未找到套餐信息');
@@ -182,7 +183,11 @@ class OrderService
             //生成订单
             //生成订单
             $time = time();
             $time = time();
             $packageWhere['id'] = $packageId;
             $packageWhere['id'] = $packageId;
+            $packageWhere['num'] = ['gt',0];
             $package = Db::name('package')->where($packageWhere)->lock(true)->find();
             $package = Db::name('package')->where($packageWhere)->lock(true)->find();
+            if (empty($package)) {
+                throw new Exception('未找到套餐信息');
+            }
             $userWhere['id'] = $userId;
             $userWhere['id'] = $userId;
             $user = Db::name('user')->where($userWhere)->find();
             $user = Db::name('user')->where($userWhere)->find();
             //绑定门店
             //绑定门店