Browse Source

调试

yijia
v-Brocloni 3 years ago
parent
commit
ccbafb471c
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      application/api/controller/Index.php

+ 5
- 1
application/api/controller/Index.php View File

@@ -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]]);
}


Loading…
Cancel
Save