Commit 572150f6 authored by hujun's avatar hujun

删除楼盘图片

parent c9f2923a
......@@ -36,7 +36,7 @@ class OfficeRoom extends Basic
{
$msg = '';
$code = 200;
$result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], 2);
$result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], $this->params['save_path']);
if ($result['status'] == 'fail') {
$code = 101;
$msg = '删除失败';
......
<?php
/**
* Created by PhpStorm.
* User: HuJun
* Date: 2019/5/30
* Time: 10:11
*/
namespace app\api_broker\controller;
use app\api_broker\extend\Basic;
use app\index\service\OfficeService;
class OfficeBuilding extends Basic
{
private $service;
public function __construct()
{
parent::__construct();
$this->service = new OfficeService();
}
/**
* 删除图片
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function delHouseFile()
{
$msg = '';
$code = 200;
$result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], $this->params['save_path']);
if ($result['status'] == 'fail') {
$code = 101;
$msg = '删除失败';
}
return $this->response($code, $msg);
}
}
\ No newline at end of file
......@@ -90,7 +90,7 @@ class OfficeManage extends Basic
{
$msg = '';
$code = 200;
$result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], $this->params['type']);
$result = $this->service->delHouseFile($this->params['id'], $this->params['house_id'], $this->params['save_path']);
if ($result['status'] == 'fail') {
$code = 101;
$msg = '删除失败';
......
......@@ -316,35 +316,40 @@ class OfficeRoomService
/**
* 删除图片
*
* @param $id
* @param int $id
* @param $house_id
* @param $img_status
* @param string $save_path
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-6-2 上午10:26
*/
public function delHouseFile($id, $house_id, $img_status)
public function delHouseFile($id = 0, $house_id, $save_path = '')
{
$data['status'] = 'fail';
$data['msg'] = '';
if (empty($id) || empty($building_id)) {
$data['msg'] = '参数错误';
return $data;
}
if (empty($id)) {
$where['house_id'] = $house_id;
$where['img_name'] = $save_path;
} else {
$where['id'] = $id;
$where['img_status'] = $img_status;
}
$id = $this->m_office_img->getFindData('id', $where);
if (empty($id['id'])) {
$data['msg'] = '没有该文件';
} else {
$this->m_office_img->editData(['img_status' => 1], $id['id'], 'id');
$result = $this->m_office_img->editData(['img_status' => 1], $id['id'], 'id');
if ($result) {
$data['status'] = 200;
$data['msg'] = '删除成功';
} else {
$data['msg'] = '删除失败';
}
}
return $data;
......
......@@ -169,45 +169,40 @@ class OfficeService
/**
* 删除图片
*
* @param $id
* @param int $id
* @param $house_id
* @param $img_status
* @param string $save_path
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* User HuJun
* Date 19-6-2 上午10:26
*/
public function delHouseFile($id, $house_id, $img_status)
public function delHouseFile($id = 0, $house_id, $save_path = '')
{
$data['status'] = 'fail';
$data['msg'] = '';
if (empty($id) || empty($house_id)) {
$data['msg'] = '参数错误';
return $data;
}
if (empty($house_id)) {
$data['msg'] = '参数错误';
return $data;
}
if (empty($img_status)) {
$data['msg'] = '参数错误';
return $data;
}
if (empty($id)) {
$where['house_id'] = $house_id;
$where['img_name'] = $save_path;
} else {
$where['id'] = $id;
$where['img_status'] = $img_status;
}
$id = $this->m_office_img->getFindData('id', $where);
if (empty($id['id'])) {
$data['msg'] = '没有该文件';
} else {
$this->m_office_img->editData(['img_status' => 1], $id['id'], 'id');
$result = $this->m_office_img->editData(['img_status' => 1], $id['id'], 'id');
if ($result) {
$data['status'] = 200;
$data['msg'] = '删除成功';
} else {
$data['msg'] = '删除失败';
}
}
return $data;
......
......@@ -963,18 +963,18 @@ Route::group('office', [
'getCommission' => ['api_broker/OfficeOrderLog/getCommission', ['method' => 'GET|POST']],
'isShowAdjustment' => ['api_broker/OfficeOrderLog/isShowAdjustment', ['method' => 'GET|POST']],
'addBargain' => ['api_broker/OfficeOrderLog/addBargain', ['method' => 'post']], //新增成交报告佣金(分佣提成)
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST|GET']],//楼盘字典新增和编辑
'delHouseFile' => ['api_broker/OfficeRoom/delHouseFile', ['method' => 'POST']],//删除楼盘图片
'houseEdit' => ['api_broker/OfficeRoom/edit', ['method' => 'POST']],//楼盘字典新增和编辑
'delHouseFile' => ['api_broker/OfficeRoom/delHouseFile', ['method' => 'POST']],//删除房源图片
'delBuildingFile' => ['api_broker/OfficeBuilding/delHouseFile', ['method' => 'POST']],//删除楼盘图片
'getBuildingSearch' => ['api_broker/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
'getBuildingDetail' => ['api_broker/OfficeRoom/getBuildingDetail', ['method' => 'GET']],//楼盘详情
]);
Route::group('office_index', [
'houseAdd' => [ 'index/OfficeManage/add', [ 'method' => 'GET|POST' ] ],//楼盘字典新增
'houseEdit' => [ 'index/OfficeManage/edit', [ 'method' => 'GET|POST' ] ],//楼盘字典编辑
'delHouseFile' => [ 'index/OfficeManage/delHouseFile', [ 'method' => 'POST' ] ],//删除楼盘图片
'houseDictionaryAdd' => ['index/OfficeManage/add', ['method' => 'GET|POST']],//楼盘字典新增
'houseDictionaryEdit' => ['index/OfficeManage/edit', ['method' => 'GET|POST']],//楼盘字典编辑
'delHouseFile' => ['index/OfficeManage/delHouseFile', ['method' => 'POST']],//删除房源图片
'delBuildingFile' => ['index/OfficeBuilding/delBuildingFile', ['method' => 'POST']],//删除楼盘图片
'getBuildingSearch' => ['index/OfficeRoom/getBuildingSearch', ['method' => 'GET']],//搜索楼盘
'getBuildingDetail' => ['index/OfficeRoom/getBuildingDetail', ['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