|
|
@@ -6,6 +6,7 @@ use addons\unishop\model\Order; |
|
|
|
use app\admin\model\unishop\OrderProduct; |
|
|
|
use app\admin\model\unishop\Product; |
|
|
|
use app\common\controller\Api; |
|
|
|
use think\Exception; |
|
|
|
|
|
|
|
/** |
|
|
|
* 首页接口 |
|
|
@@ -46,7 +47,10 @@ class Index extends Api |
|
|
|
$list = collection($list)->toArray(); |
|
|
|
$product = new \app\admin\model\unishop\Product(); |
|
|
|
foreach ($list as $val){ |
|
|
|
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"])->setInc("real_sales",-$val["number"]); |
|
|
|
try { |
|
|
|
$product->where(["id"=>$val['product_id']])->setInc("stock",$val["number"]); |
|
|
|
$product->where(["id"=>$val['product_id']])->setInc("real_sales",-$val["number"]); |
|
|
|
}catch (Exception $e){} |
|
|
|
} |
|
|
|
$model->save(["status"=>0],["id"=>["in",$ids]]); |
|
|
|
} |
|
|
|