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