|
@@ -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();
|
|
|
//绑定门店
|