...
|
...
|
@@ -174,5 +174,29 @@ class PublicController extends RestBaseController |
|
|
}
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
* @title 获取token
|
|
|
* @description 获取token
|
|
|
* @author Tiger Yang
|
|
|
* @url /wxapp/public/get_token
|
|
|
* @method POST
|
|
|
*
|
|
|
* @param name:openid type:string require:1 other: desc:openid
|
|
|
*
|
|
|
* @return token:登录唯一标识
|
|
|
*/
|
|
|
public function get_token(){
|
|
|
$openid = $this->request->param('openid');
|
|
|
$third_party_user = Db::name('third_party_user')->where(array('openid'=>$openid))->find();
|
|
|
if(empty($third_party_user)){
|
|
|
$this->error('查无此人!');
|
|
|
}
|
|
|
$data = Db::name('user_token')->where(array('user_id'=>$third_party_user['user_id']))->find();
|
|
|
if($data['expire_time']<time()){
|
|
|
$this->success('token过期了',['code'=>50001,'msg'=>'token过期了']);
|
|
|
}else{
|
|
|
$this->success('ok',['code'=>20000,'msg'=>'ok','data'=>$data['token']]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|