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