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
1f27bee3
Commit
1f27bee3
authored
Mar 16, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
删除商铺文件
parent
88e01278
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
2 deletions
+58
-2
Shop.php
application/api_broker/controller/Shop.php
+35
-0
GHouses.php
application/model/GHouses.php
+1
-0
GHousesImgs.php
application/model/GHousesImgs.php
+20
-2
route.php
application/route.php
+2
-0
No files found.
application/api_broker/controller/Shop.php
View file @
1f27bee3
...
...
@@ -299,4 +299,39 @@ class Shop extends Basic
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
/**
* 删除图片
*
* @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
[
'file_name'
])
||
empty
(
$this
->
params
[
'house_id'
])){
$data
[
'msg'
]
=
'File_name or id house_id null'
;
}
else
{
$img
=
new
GHousesImgs
();
$id
=
$img
->
getHouseImagesInfo
(
'id'
,[
'house_id'
=>
$this
->
params
[
'house_id'
],
'img_name'
=>
$this
->
params
[
'file_name'
]
]);
if
(
empty
(
$id
[
'id'
]))
{
$data
[
'msg'
]
=
'没有该文件'
;
}
else
{
$path
=
ROOT_PATH
.
'public'
.
DS
.
'resource'
.
DS
.
'lib'
.
DS
.
'Attachments'
.
DS
.
'Images/'
;
@
unlink
(
$path
.
$this
->
params
[
'file_name'
]);
$img
->
editData
([
'img_status'
=>
1
],
$this
->
params
[
'house_id'
],
'id'
);
$data
[
'status'
]
=
200
;
}
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
application/model/GHouses.php
View file @
1f27bee3
...
...
@@ -72,6 +72,7 @@ class GHouses extends BaseModel
$data
[
'city_code'
]
=
$area
[
'1'
];
$data
[
'disc_code'
]
=
$area
[
'2'
];
foreach
(
$img_data
as
$k
=>
$v
)
{
$v
->
img_name
=
CK_IMG_URL
.
'images'
.
$v
->
img_name
;
switch
(
$v
->
img_type
)
{
case
1
:
$data
[
'cover'
]
=
$v
->
img_name
;
...
...
application/model/GHousesImgs.php
View file @
1f27bee3
...
...
@@ -179,12 +179,15 @@ class GHousesImgs extends BaseModel
}
/****** zw start *******/
/**
* 查询图片
*
* @param $param
* @param $limit_
* @return mixed
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseImages
(
$param
,
$limit_
)
{
...
...
@@ -196,4 +199,18 @@ class GHousesImgs extends BaseModel
->
select
();
}
/****** zw end *******/
/**
* 获取图片信息
*
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getHouseImagesInfo
(
$field
,
$where
)
{
return
$this
->
field
(
$field
)
->
where
(
$where
)
->
find
();
}
}
\ No newline at end of file
application/route.php
View file @
1f27bee3
...
...
@@ -326,6 +326,7 @@ Route::group('broker', [
'houseEdit'
=>
[
'api_broker/shop/edit'
,
[
'method'
=>
'get|post'
]],
//编辑商铺
'getLabelsShopList'
=>
[
'api_broker/label/getLabelsShopList'
,
[
'method'
=>
'get'
]],
//编辑商铺
'uploadHouseFile'
=>
[
'api_broker/shop/uploadHouseFile'
,
[
'method'
=>
'post'
]],
//商铺上传文件
'delHouseFile'
=>
[
'api_broker/shop/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