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
088c36fe
Commit
088c36fe
authored
Mar 15, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app上传图片文件
parent
dcb8068f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
Shop.php
application/api_broker/controller/Shop.php
+38
-0
Houses.php
application/index/controller/Houses.php
+0
-1
route.php
application/route.php
+2
-0
No files found.
application/api_broker/controller/Shop.php
View file @
088c36fe
...
...
@@ -265,4 +265,42 @@ class Shop extends Basic
return
$this
->
response
(
$result
[
'code'
],
$result
[
'msg'
],
$result
[
'data'
]);;
}
/**
* 上传头像
*
* @return \think\Response
*/
public
function
uploadHouseFile
()
{
$data
[
'status'
]
=
101
;
$data
[
'msg'
]
=
''
;
$data
[
'data'
]
=
''
;
$file
=
request
()
->
file
(
'file'
);
if
(
$file
){
$path
=
ROOT_PATH
.
'public'
.
DS
.
'resource'
.
DS
.
'lib'
.
DS
.
'Attachments'
.
DS
.
'images'
.
DS
.
'app_housesFile'
;
$info
=
$file
->
validate
([
'size'
=>
1024000
,
'ext'
=>
'jpg,png'
])
->
move
(
$path
);
if
(
$info
){
// if ($this->userId) {
// $user_data = $this->gHousesImgModel->field('img_name')->where('id',$this->agentId)->find();
// @unlink($path.DS.$user_data->user_pic); //删除原来的图片
$img_path
=
$info
->
getSaveName
();
//生成的图片路径
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'上传成功'
;
$data
[
'data'
]
=
[
'file_name'
=>
CK_IMG_URL
.
'images'
.
DS
.
'app_housesFile'
.
DS
.
$img_path
,
'save_path'
=>
'app_housesFile/'
.
$img_path
];
// }
}
else
{
// 上传失败获取错误信息
$data
[
'msg'
]
=
$file
->
getError
();
}
}
else
{
$data
[
'msg'
]
=
'没有该文件'
;
}
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
}
application/index/controller/Houses.php
View file @
088c36fe
...
...
@@ -192,7 +192,6 @@ class Houses extends Basic
$data
[
'data'
][
'list'
]
=
$this
->
house
->
getHouseListDish
(
$pageNo
,
$pageSize
,
'a.id DESC'
,
$fields
,
$where
,
$this
->
userId
);
$data
[
'data'
][
'total'
]
=
$this
->
house
->
getHouseListDishTotal
(
$where
);
}
$data
[
'data'
][
'auth_c'
]
=
Session
::
get
(
'user_info.auth'
);
return
$this
->
response
(
$data
[
'status'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
...
...
application/route.php
View file @
088c36fe
...
...
@@ -325,6 +325,7 @@ Route::group('broker', [
'center'
=>
[
'api_broker/MyCenter/center'
,
[
'method'
=>
'get|post'
]
],
'houseEdit'
=>
[
'api_broker/shop/edit'
,
[
'method'
=>
'get|post'
]],
//编辑商铺
'getLabelsShopList'
=>
[
'api_broker/label/getLabelsShopList'
,
[
'method'
=>
'get'
]],
//编辑商铺
'uploadHouseFile'
=>
[
'api_broker/shop/uploadHouseFile'
,
[
'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