|
@@ -31,7 +31,6 @@ class LoginController extends HomeBaseController{ |
|
@@ -31,7 +31,6 @@ class LoginController extends HomeBaseController{ |
31
|
*
|
31
|
*
|
32
|
* @return users_id:用户id
|
32
|
* @return users_id:用户id
|
33
|
* @return type:是否注册(0、未注册,1、已注册)
|
33
|
* @return type:是否注册(0、未注册,1、已注册)
|
34
|
- * @return openid:openid
|
|
|
35
|
* @return is_use:是否在使用设备(0:空闲,1:在用)
|
34
|
* @return is_use:是否在使用设备(0:空闲,1:在用)
|
36
|
*/
|
35
|
*/
|
37
|
public function login(){
|
36
|
public function login(){
|
|
@@ -42,10 +41,14 @@ class LoginController extends HomeBaseController{ |
|
@@ -42,10 +41,14 @@ class LoginController extends HomeBaseController{ |
42
|
if(isset($loginData['openid'])){
|
41
|
if(isset($loginData['openid'])){
|
43
|
$users = Db::name('users')->where('open_id', $loginData['openid'])->find();
|
42
|
$users = Db::name('users')->where('open_id', $loginData['openid'])->find();
|
44
|
if (empty($users)){
|
43
|
if (empty($users)){
|
45
|
- $users_id=Db::name('users')->insertGetId(['open_id'=>$loginData['openid'],'create_time'=>date('Y-m-d H:i:s')]);
|
|
|
46
|
- $this->apiResponse(200,'success',['users_id'=>$users_id,'type'=>0,'openid'=>$loginData['openid'],'is_use'=>0]);
|
44
|
+ $users_id=Db::name('users')->insertGetId(['open_id'=>$loginData['openid'],'create_time'=>time()]);
|
|
|
45
|
+ $this->apiResponse(200,'success',['users_id'=>$users_id,'type'=>0,'is_use'=>0]);
|
47
|
}else{
|
46
|
}else{
|
48
|
- $this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>1,'openid'=>$users['open_id'],'is_use'=>$users['is_use']]);
|
47
|
+ if (empty($users['phone'])){
|
|
|
48
|
+ $this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>0,'is_use'=>$users['is_use']]);
|
|
|
49
|
+ }else{
|
|
|
50
|
+ $this->apiResponse(200,'success',['users_id'=>$users['id'],'type'=>1,'is_use'=>$users['is_use']]);
|
|
|
51
|
+ }
|
49
|
}
|
52
|
}
|
50
|
}else{
|
53
|
}else{
|
51
|
$this->apiResponse(301,'获取登录凭证失败',$loginData);
|
54
|
$this->apiResponse(301,'获取登录凭证失败',$loginData);
|