瀏覽代碼

购买套餐调整

zhangxiaobin 1 年之前
父節點
當前提交
348d56874e
共有 1 個文件被更改,包括 5 次插入0 次删除
  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();
             //绑定门店