|
|
@@ -36,7 +36,6 @@ class Order extends Api
|
|
|
$areaArr = ($params['type'] == 1)? explode(',', $params['area_id']): '';
|
|
|
$areaNum = ($params['type'] == 1)? count($areaArr): $params['num'];
|
|
|
if(($order_info->num +$order_info->init_num+ $areaNum) > $order_info->stock) $this->error(__("库存不足"));
|
|
|
-
|
|
|
// 启动事务
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
@@ -46,14 +45,13 @@ class Order extends Api
|
|
|
if(bccomp($totalPrice, $amount, 2) > 0) throw new Exception(__("余额不足请前往充值"), 15001);
|
|
|
if($order_info->start_time > time()) throw new Exception(__("抢购未开始"));
|
|
|
if($order_info->stock == 0 || time() >= $order_info->end_time) throw new Exception(__("抢购已结束"));
|
|
|
-
|
|
|
+
|
|
|
//批量地区添加 1选择地区 2未选择地区
|
|
|
if($params['type'] == 1)
|
|
|
$productOrder::setPopularAreaOrder($areaArr, $params['order_id'], $order_info->price, $params['product_id'], $this->auth->id);
|
|
|
else
|
|
|
$productOrder::setPopularNoAreaOrder($areaNum, $params['order_id'], $order_info->price, $params['product_id'], $this->auth->id);
|
|
|
|
|
|
-
|
|
|
//余额记录
|
|
|
$ledgerWalletModel->changeWalletAccount($this->auth->id, Asset::TOKEN, -$totalPrice, $ledgerWalletModel::Popular, $this->auth->id);
|
|
|
|