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
0432f038
Commit
0432f038
authored
Mar 22, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userId to agentId
parent
d172d52b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
18 deletions
+15
-18
Broker.php
application/api_broker/controller/Broker.php
+15
-18
No files found.
application/api_broker/controller/Broker.php
View file @
0432f038
...
...
@@ -326,24 +326,21 @@ class Broker extends Basic
$info
=
$file
->
validate
([
'size'
=>
512000
,
'ext'
=>
'jpg,png'
])
//限制500KB
->
move
(
$path
);
if
(
$info
){
if
(
$this
->
userId
)
{
$user
=
new
AAgents
();
$user_data
=
$user
->
field
(
'img'
)
->
where
(
'id'
,
$this
->
userId
)
->
find
();
@
unlink
(
$path
.
DS
.
$user_data
->
img
);
//删除原来的图片
$img_path
=
$info
->
getSaveName
();
//生成的图片路径
//更新用户信息
$user_data
->
img
=
$img_path
;
$user_data
->
save
();
$static_path
=
$path
.
DS
.
$img_path
;
//生成图片的绝对路径
$image
=
\think\Image
::
open
(
$static_path
);
$image
->
thumb
(
500
,
500
)
->
save
(
$static_path
);
//生成缩略图
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'上传成功'
;
$data
[
'data'
]
=
[
'file_name'
=>
HEADERIMGURL
.
$img_path
];
}
$user
=
new
AAgents
();
$user_data
=
$user
->
field
(
'img'
)
->
where
(
'id'
,
$this
->
agentId
)
->
find
();
@
unlink
(
$path
.
DS
.
$user_data
->
img
);
//删除原来的图片
$img_path
=
$info
->
getSaveName
();
//生成的图片路径
//更新用户信息
$user_data
->
img
=
$img_path
;
$user_data
->
save
();
$static_path
=
$path
.
DS
.
$img_path
;
//生成图片的绝对路径
$image
=
\think\Image
::
open
(
$static_path
);
$image
->
thumb
(
500
,
500
)
->
save
(
$static_path
);
//生成缩略图
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'上传成功'
;
$data
[
'data'
]
=
[
'file_name'
=>
HEADERIMGURL
.
$img_path
];
}
else
{
// 上传失败获取错误信息
$data
[
'msg'
]
=
$file
->
getError
();
...
...
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