Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
2e9500f1
Commit
2e9500f1
authored
May 30, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除图片
parent
d505db54
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
232 additions
and
8 deletions
+232
-8
OfficeManage.php
application/api_broker/controller/OfficeManage.php
+102
-0
OfficeManage.php
application/index/controller/OfficeManage.php
+21
-0
OfficeService.php
application/index/service/OfficeService.php
+68
-4
OfficeGBuildingImg.php
application/model/OfficeGBuildingImg.php
+13
-1
OfficeGBuildingStations.php
application/model/OfficeGBuildingStations.php
+20
-0
route.php
application/route.php
+8
-3
No files found.
application/api_broker/controller/OfficeManage.php
0 → 100644
View file @
2e9500f1
<?php
/**
* Created by PhpStorm.
* User: HuJun
* Date: 2019/5/30
* Time: 10:11
*/
namespace
app\api_broker\controller
;
use
app\index\extend\Basic
;
use
app\index\service\OfficeService
;
use
think\Request
;
class
OfficeManage
extends
Basic
{
private
$service
;
public
function
__construct
(
?
Request
$request
=
null
)
{
parent
::
__construct
(
$request
);
$this
->
service
=
new
OfficeService
();
}
/**
* 新增楼盘
*
* @return \think\Response|\think\response\View
*/
public
function
add
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'office/add'
);
}
$code
=
200
;
$result
[
'status'
]
=
$msg
=
''
;
if
(
$this
->
request
->
isPost
())
{
$msg
=
'新增成功'
;
$result
=
$this
->
service
->
edit
(
$this
->
params
,
$this
->
userId
);
}
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
$result
[
'msg'
];
}
return
$this
->
response
(
$code
,
$msg
);
}
/**
* 编辑楼盘
*
* @return \think\Response|\think\response\View
*/
public
function
edit
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'office/add'
);
}
if
(
empty
(
$this
->
params
[
'id'
]))
{
return
$this
->
response
(
101
,
'参数错误'
);
}
$code
=
200
;
$msg
=
''
;
if
(
$this
->
request
->
isPost
())
{
$result
=
$this
->
service
->
edit
(
$this
->
params
);
}
else
{
$result
=
$this
->
service
->
getOfficeDetail
(
$this
->
params
[
'id'
],
0
);
}
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
$result
[
'msg'
];
}
return
$this
->
response
(
$code
,
$msg
,
$result
[
'data'
]);
}
/**
* 删除图片
*
* @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
[
'building_id'
],
2
);
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
'删除失败'
;
}
return
$this
->
response
(
$code
,
$msg
);
}
}
\ No newline at end of file
application/index/controller/OfficeManage.php
View file @
2e9500f1
...
...
@@ -78,4 +78,24 @@ class OfficeManage extends Basic
return
$this
->
response
(
$code
,
$msg
,
$result
[
'data'
]);
}
/**
* 删除图片
*
* @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
[
'building_id'
],
2
);
if
(
$result
[
'status'
]
==
'fail'
)
{
$code
=
101
;
$msg
=
'删除失败'
;
}
return
$this
->
response
(
$code
,
$msg
);
}
}
\ No newline at end of file
application/index/service/OfficeService.php
View file @
2e9500f1
...
...
@@ -10,8 +10,6 @@ namespace app\index\service;
use
app\index\validate\OfficeBuildingValidate
;
use
app\model\GBusinessDistrict
;
use
app\model\MetroStations
;
use
app\model\OfficeGBuilding
;
use
app\model\OfficeGBuildingImg
;
use
app\model\OfficeGBuildingStations
;
...
...
@@ -21,12 +19,14 @@ class OfficeService
private
$validate
;
private
$m_office
;
private
$m_office_img
;
private
$m_building_stations
;
public
function
__construct
()
{
$this
->
validate
=
new
OfficeBuildingValidate
();
$this
->
m_office
=
new
OfficeGBuilding
();
$this
->
m_office_img
=
new
OfficeGBuildingImg
();
$this
->
m_building_stations
=
new
OfficeGBuildingStations
();
}
/**
...
...
@@ -55,6 +55,33 @@ class OfficeService
$id
=
$this
->
m_office
->
addOffice
(
$data
,
$agent_id
);
if
(
$id
>
0
)
{
//新增周边交通
if
(
!
empty
(
$data
[
'add_building_stations'
]))
{
$add_building_stations
=
json_decode
(
$data
[
'add_building_stations'
],
true
);
foreach
(
$add_building_stations
as
$k
=>
$v
)
{
if
(
empty
(
$data
[
'stations_id'
]))
{
continue
;
}
if
(
empty
(
$data
[
'distance'
]))
{
continue
;
}
$save_stations
[
$k
][
'building_id'
]
=
$id
;
$save_stations
[
$k
][
'stations_id'
]
=
$v
[
'stations_id'
];
$save_stations
[
$k
][
'distance'
]
=
$v
[
'distance'
];
}
if
(
isset
(
$save_stations
))
{
$this
->
m_building_stations
->
insertData
(
$save_stations
);
}
}
//删除周边交通
if
(
!
empty
(
$data
[
'del_building_stations'
]))
{
$this
->
m_building_stations
->
updateData
([
'is_del'
=>
1
],
[
'id'
=>
[
'in'
,
$data
[
'del_building_stations'
]]]);
}
$result
[
'status'
]
=
'successful'
;
}
else
{
$result
[
'msg'
]
=
'新增或编辑失败!'
;
...
...
@@ -111,9 +138,8 @@ class OfficeService
// $data['business_name'] = "";
// }
$m_building_stations
=
new
OfficeGBuildingStations
();
$field_stations
=
'a.id,b.line_name,name,distance,b.id as stations_id'
;
$data
[
'building_stations'
]
=
$m_building_stations
->
getListAll
(
$field_stations
,
[
'a.building_id'
=>
$id
]);
$data
[
'building_stations'
]
=
$
this
->
m_building_stations
->
getListAll
(
$field_stations
,
[
'a.building_id'
=>
$id
]);
}
$result
[
'data'
]
=
$data
;
...
...
@@ -126,4 +152,41 @@ class OfficeService
return
$result
;
}
/**
* 删除图片
*
* @param $id
* @param $building_id
* @param $img_status
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
delHouseFile
(
$id
,
$building_id
,
$img_status
)
{
$data
[
'status'
]
=
'fail'
;
$data
[
'msg'
]
=
''
;
if
(
empty
(
$id
)
||
empty
(
$building_id
))
{
$data
[
'msg'
]
=
'参数错误'
;
return
$data
;
}
$where
[
'building_id'
]
=
$id
;
$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'
);
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'删除成功'
;
}
return
$data
;
}
}
\ No newline at end of file
application/model/OfficeGBuildingImg.php
View file @
2e9500f1
...
...
@@ -82,9 +82,21 @@ class OfficeGBuildingImg extends BaseModel
*/
public
function
getListAll
(
$field
,
$where
)
{
$where
[
'i
mg_status
'
]
=
0
;
$where
[
'i
s_del
'
]
=
0
;
return
$this
->
db_
->
field
(
$field
)
->
where
(
$where
)
->
select
();
}
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
}
application/model/OfficeGBuildingStations.php
View file @
2e9500f1
...
...
@@ -49,4 +49,24 @@ class OfficeGBuildingStations extends BaseModel
->
where
(
$where
)
->
select
();
}
/**
* @param $data
* @param $where
* @return int|string
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public
function
updateData
(
$data
,
$where
)
{
return
$this
->
db_
->
where
(
$where
)
->
update
(
$data
);
}
/**
* @param $data
* @return int|string
*/
public
function
insertData
(
$data
){
return
$this
->
db_
->
insertAll
(
$data
);
}
}
application/route.php
View file @
2e9500f1
...
...
@@ -923,9 +923,15 @@ Route::group('search', [
Route
::
group
(
'office'
,
[
'isBargainEnd'
=>
[
'api_broker/OrderLog/isBargainEnd'
,
[
'method'
=>
'get'
]],
'isBargainEnd'
=>
[
'api_broker/OrderLog/isBargainEnd'
,
[
'method'
=>
'GET'
]],
'houseAdd'
=>
[
'api_broker/OfficeManage/add'
,
[
'method'
=>
'GET|POST'
]],
//楼盘字典新增
'houseEdit'
=>
[
'api_broker/OfficeManage/edit'
,
[
'method'
=>
'GET|POST'
]],
//楼盘字典编辑
'delHouseFile'
=>
[
'api_broker/OfficeManage/delHouseFile'
,
[
'method'
=>
'POST'
]],
//删除楼盘图片
]);
Route
::
group
(
'office_index'
,
[
'houseAdd'
=>
[
'index/OfficeManage/add'
,
[
'method'
=>
'GET|POST'
]],
//楼盘字典新增
'houseEdit'
=>
[
'index/OfficeManage/edit'
,
[
'method'
=>
'GET|POST'
]],
//楼盘字典编辑
'delHouseFile'
=>
[
'index/OfficeManage/delHouseFile'
,
[
'method'
=>
'POST'
]],
//删除楼盘图片
]);
//Route::miss('api/index/miss');//处理错误的url
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment