正在显示
1 个修改的文件
包含
4 行增加
和
2 行删除
@@ -108,7 +108,8 @@ class Depot extends Backend | @@ -108,7 +108,8 @@ class Depot extends Backend | ||
108 | } | 108 | } |
109 | $areaModel = new \app\admin\model\Area(); | 109 | $areaModel = new \app\admin\model\Area(); |
110 | $params['area_name'] = $areaModel->where('id',$params['area_id'])->value('name'); | 110 | $params['area_name'] = $areaModel->where('id',$params['area_id'])->value('name'); |
111 | - if (empty($params['goods_id'])) $this->error('请填写商品id'); | 111 | + if ($params['type'] == 1 && empty($params['goods_id'])) $this->error('请填写商品id'); |
112 | + if ($params['type'] == 2 && empty($params['integral_goods_id'])) $this->error('请填写商品id'); | ||
112 | if ($params['type'] == 2) $params['goods_id'] = $params['integral_goods_id']; | 113 | if ($params['type'] == 2) $params['goods_id'] = $params['integral_goods_id']; |
113 | $result = $this->model->allowField(true)->save($params); | 114 | $result = $this->model->allowField(true)->save($params); |
114 | $stock_num = $this->model->where(['goods_id'=>$params['goods_id'],'type'=>$params['type']])->sum('stock_num'); | 115 | $stock_num = $this->model->where(['goods_id'=>$params['goods_id'],'type'=>$params['type']])->sum('stock_num'); |
@@ -165,7 +166,8 @@ class Depot extends Backend | @@ -165,7 +166,8 @@ class Depot extends Backend | ||
165 | $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; | 166 | $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; |
166 | $row->validateFailException(true)->validate($validate); | 167 | $row->validateFailException(true)->validate($validate); |
167 | } | 168 | } |
168 | - if (empty($params['goods_id'])) $this->error('请填写商品id'); | 169 | + if ($params['type'] == 1 && empty($params['goods_id'])) $this->error('请填写商品id'); |
170 | + if ($params['type'] == 2 && empty($params['integral_goods_id'])) $this->error('请填写商品id'); | ||
169 | if ($params['type'] == 2) $params['goods_id'] = $params['integral_goods_id']; | 171 | if ($params['type'] == 2) $params['goods_id'] = $params['integral_goods_id']; |
170 | $areaModel = new \app\admin\model\Area(); | 172 | $areaModel = new \app\admin\model\Area(); |
171 | $params['area_name'] = $areaModel->where('id',$params['area_id'])->value('name'); | 173 | $params['area_name'] = $areaModel->where('id',$params['area_id'])->value('name'); |
-
请 注册 或 登录 后发表评论