...
|
...
|
@@ -108,7 +108,8 @@ class Depot extends Backend |
|
|
}
|
|
|
$areaModel = new \app\admin\model\Area();
|
|
|
$params['area_name'] = $areaModel->where('id',$params['area_id'])->value('name');
|
|
|
if (empty($params['goods_id'])) $this->error('请填写商品id');
|
|
|
if ($params['type'] == 1 && empty($params['goods_id'])) $this->error('请填写商品id');
|
|
|
if ($params['type'] == 2 && empty($params['integral_goods_id'])) $this->error('请填写商品id');
|
|
|
if ($params['type'] == 2) $params['goods_id'] = $params['integral_goods_id'];
|
|
|
$result = $this->model->allowField(true)->save($params);
|
|
|
$stock_num = $this->model->where(['goods_id'=>$params['goods_id'],'type'=>$params['type']])->sum('stock_num');
|
...
|
...
|
@@ -165,7 +166,8 @@ class Depot extends Backend |
|
|
$validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
|
|
|
$row->validateFailException(true)->validate($validate);
|
|
|
}
|
|
|
if (empty($params['goods_id'])) $this->error('请填写商品id');
|
|
|
if ($params['type'] == 1 && empty($params['goods_id'])) $this->error('请填写商品id');
|
|
|
if ($params['type'] == 2 && empty($params['integral_goods_id'])) $this->error('请填写商品id');
|
|
|
if ($params['type'] == 2) $params['goods_id'] = $params['integral_goods_id'];
|
|
|
$areaModel = new \app\admin\model\Area();
|
|
|
$params['area_name'] = $areaModel->where('id',$params['area_id'])->value('name');
|
...
|
...
|
|