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
606b762d
Commit
606b762d
authored
Dec 22, 2017
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
头像url 加 https://
parent
dcef1fc9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
8 deletions
+21
-8
config.php
application/api/config.php
+2
-1
Member.php
application/api/controller/Member.php
+12
-5
Users.php
application/model/Users.php
+7
-2
No files found.
application/api/config.php
View file @
606b762d
...
...
@@ -4,7 +4,8 @@ error_reporting(E_ERROR | E_PARSE);
define
(
'PAGESIZE'
,
15
);
//分页每页条数
define
(
'ADMIN_URL_TL'
,
'https://admin.tonglianjituan.com/'
);
//B端网址
define
(
'CURRENT_URL'
,
\think\Request
::
instance
()
->
server
(
'HTTP_HOST'
)
.
DS
);
//取当前域名地址
define
(
'CURRENT_URL'
,
'https://'
.
$_SERVER
[
'HTTP_HOST'
]
.
DS
);
//取当前域名地址
define
(
'HEADERIMGURL'
,
CURRENT_URL
.
'static'
.
DS
.
'head_portrait/'
);
//头像地址
return
[
'jwt_key'
=>
'tonglian+123'
,
...
...
application/api/controller/Member.php
View file @
606b762d
...
...
@@ -41,14 +41,14 @@ class Member extends Basic
$jwt_data
[
'userNick'
]
=
$user_data
->
user_nick
;
$jwt_data
[
'phone'
]
=
$user_data
->
user_phone
;
$jwt
=
new
JwtUntils
();
$jwt
=
new
JwtUntils
();
$user_data
->
user_pic
=
HEADERIMGURL
.
$user_data
->
user_pic
;
$data
[
'data'
]
=
$user_data
->
getData
();
$data
[
'data'
][
'last_login_ip'
]
=
long2ip
(
$data
[
'data'
][
'last_login_ip'
]);
$data
[
'data'
][
'AuthToken'
]
=
$jwt
->
createToken
(
$jwt_data
);
$data
[
'msg'
]
=
'登陆成功'
;
$data
[
'status'
]
=
200
;
Session
::
set
(
'u_user'
,
$data
[
'data'
]);
$user_data
->
last_login_ip
=
ip2long
(
$this
->
request
->
ip
());
$user_data
->
last_login_time
=
date
(
'Y-m-d H:i:s'
);
$user_data
->
save
();
...
...
@@ -390,14 +390,21 @@ class Member extends Basic
$info
=
$file
->
validate
([
'size'
=>
512000
,
'ext'
=>
'jpg,png'
])
//限制500KB
->
move
(
$path
);
if
(
$info
){
$img_path
=
$info
->
getSaveName
();
$static_path
=
$path
.
DS
.
$img_path
;
$img_path
=
$info
->
getSaveName
();
//生成的图片路径
$static_path
=
$path
.
DS
.
$img_path
;
//生成图片的绝对路径
$image
=
\think\Image
::
open
(
$static_path
);
$image
->
thumb
(
500
,
500
)
->
save
(
$static_path
);
//生成缩略图
//更新用户信息
$user
=
new
Users
();
$user
->
update
([
'id'
=>
$this
->
userId
,
'user_pic'
=>
$img_path
]);
$data
[
'status'
]
=
200
;
$data
[
'msg'
]
=
'上传成功'
;
$data
[
'data'
]
=
[
'file_name'
=>
CURRENT_URL
.
'static'
.
DS
.
'head_portrait'
.
DS
.
$img_path
];
$data
[
'data'
]
=
[
'file_name'
=>
HEADERIMGURL
.
$img_path
];
}
else
{
// 上传失败获取错误信息
$data
[
'msg'
]
=
$file
->
getError
();
...
...
application/model/Users.php
View file @
606b762d
...
...
@@ -13,9 +13,14 @@ class Users extends Model
public
function
selectUser
(
$userId
,
$fields
=
'id,user_phone'
)
{
$param
[
"status"
]
=
array
(
"eq"
,
0
);
return
$this
->
field
(
$fields
)
$data
=
$this
->
field
(
$fields
)
->
where
(
$param
)
->
find
(
$userId
);
if
(
isset
(
$data
->
user_pic
))
{
$data
->
user_pic
=
HEADERIMGURL
.
$data
->
user_pic
;
}
return
$data
;
}
/**
...
...
@@ -39,7 +44,7 @@ class Users extends Model
$agents
=
new
Agents
();
foreach
(
$result
as
$k
=>
$v
)
{
$data
[
$k
]
=
$v
->
getData
();
$data
[
$k
][
'user_pic'
]
=
'/
static/head_portrait/'
.
$data
[
$k
][
'user_pic'
];
$data
[
$k
][
'user_pic'
]
=
CURRENT_URL
.
'
static/head_portrait/'
.
$data
[
$k
][
'user_pic'
];
$agent_data
=
$agents
->
field
(
'realname,phone'
)
->
where
(
'id'
,
$data
[
$k
][
'referrer_id'
])
->
find
();
$data
[
$k
][
'realname'
]
=
$agent_data
[
'realname'
];
$data
[
$k
][
'phone'
]
=
$agent_data
[
'phone'
];
...
...
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