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