Commit 43647f66 authored by hujun's avatar hujun

图片删除

parent a38c9e11
......@@ -13,6 +13,7 @@ use app\api\controller\Sublet;
use app\index\extend\Basic;
use app\model\AAgents;
use app\model\GHouses;
use app\model\GHousesImgs;
use app\model\GHousesToAgents;
use app\model\SubletModel;
use think\Request;
......@@ -58,7 +59,7 @@ class Houses extends Basic
if ($this->request->isAjax()) {
//获取商铺详情
$house = new GHouses();
$result['data'] = $house->getHouseById($this->params['id']);
$result['data'] = $house->getHouseById($this->params['id'], 1);
$return = $this->response($result['code'], $result['msg'], $result['data']);
} else {
//商铺添加页面
......@@ -351,4 +352,40 @@ class Houses extends Basic
$agent->commit();
return $this->response(200, '', ['total'=>count($total)]);
}
/**
* 删除图片
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delHouseFile()
{
$data['status'] = 101;
$data['msg'] = '';
$data['data'] = '';
if (empty($this->params['save_path']) || empty($this->params['house_id'])) {
return $this->response($data['status'], 'Save_path or id house_id is null', $data['data']);
}
$img = new GHousesImgs();
$id = $img->getHouseImagesInfo('id', [
'house_id' => $this->params['house_id'],
'img_name' => $this->params['save_path'],
'img_status' => 0
]);
if (empty($id['id'])) {
$data['msg'] = '没有该文件';
} else {
$path = ROOT_PATH . 'public' . DS . 'resource' . DS . 'lib' . DS . 'Attachments' . DS . 'Images/';
$img->editData([ 'img_status' => 1 ], $id['id'], 'id');
$data['status'] = 200;
}
return $this->response($data['status'], $data['msg'], $data['data']);
}
}
\ No newline at end of file
......@@ -162,6 +162,7 @@ Route::group('index', [
'editExclusive' => [ 'index/houses/editExclusive', [ 'method' => 'post' ] ], //添加和编辑楼盘独家
'getExclusive' => [ 'index/houses/getExclusive', [ 'method' => 'get' ] ], //获取楼盘独家
'getRecords' => [ 'index/houses/getRecords', [ 'method' => 'get' ] ], //操作记录
'delHouseFile' => [ 'index/houses/delHouseFile', [ 'method' => 'post' ] ], //操作记录
'getDistrictList' => [ 'index/district/getDistrictList', [ 'method' => 'get' ] ], //总监列表
'adddistrict' => [ 'index/district/addDistrict', [ 'method' => 'get|post' ] ], //添加部门,绑定总监关系
'getDistrictListByName' => [ 'index/district/getDistrictListByName', [ 'method' => 'get' ] ], //查询部门
......
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