|
@@ -37,22 +37,20 @@ class ItemController extends BaseController
|
|
|
{
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
$post = Yii::$app->request->post();
|
|
|
$data = $post['data']; //[{itemId:1000,classId:2,cost:1,addPrice:1,stockWarning:1}]
|
|
$data = $post['data']; //[{itemId:1000,classId:2,cost:1,addPrice:1,stockWarning:1}]
|
|
|
- //2021.7.11 linqh 参数改为 只传售价,成本价和加价 各一半[{itemId:1000,classId:2,price:1,stockWarning:1}]
|
|
|
|
|
- if(empty($data)){
|
|
|
|
|
- util::fail("参数错误");
|
|
|
|
|
|
|
+ //2021.7.11 linqh 参数改为 只传售价,成本价和加价各取一半[{itemId:1000,classId:2,price:1,stockWarning:1}]
|
|
|
|
|
+ if (empty($data)) {
|
|
|
|
|
+ util::fail("请选花材");
|
|
|
}
|
|
}
|
|
|
- $data = json_decode($data,true);
|
|
|
|
|
- if(!is_array($data) || empty($data)){
|
|
|
|
|
- util::fail("参数格式错误");
|
|
|
|
|
|
|
+ $data = json_decode($data, true);
|
|
|
|
|
+ if (!is_array($data) || empty($data)) {
|
|
|
|
|
+ util::fail("请选花材");
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- foreach ($data as $v){
|
|
|
|
|
|
|
+ foreach ($data as $v) {
|
|
|
$v['adminId'] = $this->adminId;
|
|
$v['adminId'] = $this->adminId;
|
|
|
$v['sjId'] = $this->sjId;
|
|
$v['sjId'] = $this->sjId;
|
|
|
ItemService::addGhsItem($v);
|
|
ItemService::addGhsItem($v);
|
|
|
}
|
|
}
|
|
|
util::complete('添加成功');
|
|
util::complete('添加成功');
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function actionUpdate()
|
|
public function actionUpdate()
|