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
db7d846d
Commit
db7d846d
authored
Jul 11, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
87185045
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
WxSdk.php
application/api/controller/WxSdk.php
+2
-2
RegisterService.php
application/api/service/RegisterService.php
+28
-13
No files found.
application/api/controller/WxSdk.php
View file @
db7d846d
...
...
@@ -73,8 +73,8 @@ class WxSdk extends Basic
$user_info
=
$this
->
userModel
->
getUserByWhere
(
$conditions
,
$fields
);
//todo 判断用户是否第一次登陆了没有则更新数据
if
(
$id
>
0
&&
count
(
$user_info
)
>
0
&&
empty
(
$user_info
[
0
][
"last_login_time"
])
||
empty
(
$user_info
[
0
][
"last_login_ip"
])
||
empty
(
$user_info
[
0
][
"first_login_time"
]
))
{
if
(
count
(
$user_info
)
>
0
&&
(
empty
(
$user_info
[
0
][
"last_login_time"
])
||
empty
(
$user_info
[
0
][
"last_login_ip"
])
||
empty
(
$user_info
[
0
][
"first_login_time"
])
))
{
$userArr
=
array
(
"id"
=>
$user_info
[
0
][
'id'
],
"last_login_time"
=>
date
(
"Y-m-d H:i:s"
,
time
()),
...
...
application/api/service/RegisterService.php
View file @
db7d846d
...
...
@@ -40,16 +40,21 @@ class RegisterService
//todo 1.判断是否有此用户,包涵未激活或者冻结, 2.无此用户则注册,返回AuthToken ,3有则登录返回AuthToken
//判断用户是否注册
$conditions
[
"user_phone"
]
=
$phone
;
$fields
=
"id,buyer_id,user_nick,user_pic,other_pic,sex,agent_id,referrer_id,referrer_source,user_phone,status"
;
$fields
=
"id,buyer_id,user_nick,user_pic,other_pic,sex,agent_id,referrer_id,referrer_source,user_phone,status,first_login_time"
;
$user_info
=
$this
->
userModel
->
getUserByWhere
(
$conditions
,
$fields
);
$buyer_id
=
$sex
=
$id
=
$status
=
$agent_id
=
0
;
$buyer_nick
=
$user_nick
=
$other_pic
=
""
;
$registration_time
=
$first_login_time
=
""
;
if
(
count
(
$user_info
)
>
0
)
{
if
(
empty
(
$user_info
[
0
][
"first_login_time"
]))
{
$first_login_time
=
date
(
"Y-m-d H:i:s"
,
time
());
}
switch
((
int
)
$user_info
[
0
][
"status"
])
{
case
-
1
://
激活
$status
=
0
;
$registration_time
=
date
(
"Y-m-d H:i:s"
,
time
());
break
;
case
0
:
//正常
if
(
$referrer_id
>
0
)
...
...
@@ -69,6 +74,9 @@ class RegisterService
$agent_id
=
$user_info
[
0
][
"agent_id"
];
$id
=
$user_info
[
0
][
"id"
];
$other_pic
=
$user_info
[
0
][
"other_pic"
];
}
else
{
$registration_time
=
date
(
"Y-m-d H:i:s"
,
time
());
$first_login_time
=
date
(
"Y-m-d H:i:s"
,
time
());
}
// 验证union_id是否已经存在,
...
...
@@ -95,7 +103,8 @@ class RegisterService
}
$userArr
=
$this
->
userBin
(
$user_nick
,
$sex
,
$id
,
$buyer_id
,
$status
,
$agent_id
,
$phone
,
$referrer_id
,
$referrer_source
,
$last_login_ip
,
$other_pic
);
$userArr
=
$this
->
userBin
(
$user_nick
,
$sex
,
$id
,
$buyer_id
,
$status
,
$agent_id
,
$phone
,
$referrer_id
,
$referrer_source
,
$last_login_ip
,
$other_pic
,
$registration_time
,
$first_login_time
);
//保存数据
$id
=
$this
->
userModel
->
saveUser
(
$userArr
);
...
...
@@ -157,28 +166,34 @@ class RegisterService
* @param $referrer_source
* @param $last_login_ip
* @param $other_pic
* @param $registration_time
* @param $first_login_time
* @return mixed
*/
public
function
userBin
(
$user_nick
,
$sex
,
$id
,
$buyer_id
,
$status
,
$agent_id
,
$phone
,
$referrer_id
,
$referrer_source
,
$last_login_ip
,
$other_pic
)
public
function
userBin
(
$user_nick
,
$sex
,
$id
,
$buyer_id
,
$status
,
$agent_id
,
$phone
,
$referrer_id
,
$referrer_source
,
$last_login_ip
,
$other_pic
,
$registration_time
,
$first_login_time
)
{
if
(
$id
>
0
)
{
$userParams
[
"id"
]
=
$id
;
}
else
{
$userParams
[
"registration_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
if
(
$referrer_id
==
0
)
{
$userParams
[
"first_login_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
//记录第一次登录时间排除邀请注册
$push
=
new
PushMessageService
();
$content
=
'你邀请的客户'
.
$user_nick
.
'-'
.
$phone
.
'手机号成功下载登录App'
;
$push
->
pushMessageById
(
$referrer_id
,
'邀请注册'
,
$content
);
}
$userParams
[
"create_time"
]
=
date
(
"Y-m-d H:i:s"
,
time
());
}
$userParams
[
"buyer_id"
]
=
$buyer_id
;
$userParams
[
"user_phone"
]
=
$phone
;
$userParams
[
"user_nick"
]
=
$user_nick
;
$userParams
[
"sex"
]
=
$sex
;
$userParams
[
"status"
]
=
$status
;
if
(
$registration_time
)
{
$userParams
[
"registration_time"
]
=
$registration_time
;
}
if
(
$first_login_time
)
{
$userParams
[
"first_login_time"
]
=
$first_login_time
;
//记录第一次登录时间排除邀请注册
$push
=
new
PushMessageService
();
$content
=
'你邀请的客户'
.
$user_nick
.
'-'
.
$phone
.
'手机号成功下载登录App'
;
$push
->
pushMessageById
(
$referrer_id
,
'邀请注册'
,
$content
);
}
if
(
$other_pic
)
{
$userParams
[
"other_pic"
]
=
$other_pic
;
}
...
...
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