|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace app\api\controller\qiyu;
|
|
|
use app\common\controller\Api;
|
|
|
+use app\common\model\QiyuToken;
|
|
|
use think\Cache;
|
|
|
|
|
|
/**
|
|
@@ -27,17 +28,39 @@ class User extends Api
|
|
|
if($data['appsecret']!=$config['appSecret']){
|
|
|
$this->error('appsecret有误');
|
|
|
}
|
|
|
- $cacheName="qiyu_crm_token";
|
|
|
$expire=$config['expire']??7200;
|
|
|
- $token=Cache::remember($cacheName,function (){
|
|
|
- return session_create_id();
|
|
|
- },$expire);
|
|
|
+ $token=QiyuToken::getToken();
|
|
|
$this->success('',[
|
|
|
'token'=>$token,
|
|
|
'expires'=>$expire,
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取用户信息
|
|
|
+ * @param string userid
|
|
|
+ */
|
|
|
+ public function info(){
|
|
|
+ $data=$this->_validate([
|
|
|
+ 'userid'=>['require']
|
|
|
+ ]);
|
|
|
+ $user=\app\common\model\User::where('mobile',$data['userid'])->find();
|
|
|
+ if(!$user){
|
|
|
+ $this->error('用户不存在');
|
|
|
+ }
|
|
|
+ $this->success('',[
|
|
|
+ 'uid'=>$data['userid'],
|
|
|
+ 'data'=>[
|
|
|
+ ['index'=>0,'key'=>'account','label'=>'账户','value'=>$user->getShowName()],
|
|
|
+ ['index'=>1,'key'=>'name','label'=>'昵称','value'=>$user['nickname']],
|
|
|
+ ['index'=>2,'key'=>'mobile','label'=>'手机号','value'=>$user['mobile']],
|
|
|
+ ]
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ protected function checkToken(){
|
|
|
+
|
|
|
+ }
|
|
|
protected function success($msg = '', $data = [], $code = 1, $type = null, array $header = [])
|
|
|
{
|
|
|
$info=[
|