Commit 7e3f3535 authored by hujun's avatar hujun

图片异常处理

parent 56356a6a
...@@ -76,7 +76,13 @@ class HouseService ...@@ -76,7 +76,13 @@ class HouseService
if ($data['id'] == '') { if ($data['id'] == '') {
$house_img->add($data, $house_id); //只记录新增图片 $house_img->add($data, $house_id); //只记录新增图片
} else { } else {
$house_img->edit($data, $house_id); //编辑图片 $image_result = $house_img->edit($data, $house_id); //编辑图片
if ($image_result['status'] == 'fail') {
$result['status'] = 'fail';
$result['msg'] = '编辑图片失败,'.$validate->getError();
return $result;
}
} }
//案场权限人 //案场权限人
......
...@@ -78,13 +78,10 @@ class GHousesImgs extends BaseModel ...@@ -78,13 +78,10 @@ class GHousesImgs extends BaseModel
* *
* @param $params * @param $params
* @param $house_id * @param $house_id
* @return array|false * @return mixed
* @throws \Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function edit($params, $house_id) { public function edit($params, $house_id) {
try {
//编辑图片 //编辑图片
$house_img_data = $this->field('id,img_name,img_type') $house_img_data = $this->field('id,img_name,img_type')
->where('img_status <> 1 AND house_id = ' . $house_id)->select(); ->where('img_status <> 1 AND house_id = ' . $house_id)->select();
...@@ -169,8 +166,16 @@ class GHousesImgs extends BaseModel ...@@ -169,8 +166,16 @@ class GHousesImgs extends BaseModel
} }
} }
$this->add($params, $house_id); $this->add($params, $house_id);
return $this->saveAll($house_img_edit); $this->saveAll($house_img_edit);
$result['status'] = 'successful';
} catch (\Exception $e) {
$result['status'] = 'fail';
$result['msg'] = $e->getMessage();
}
return $result;
} }
/****** zw start *******/ /****** zw start *******/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment