更新token接口
This commit is contained in:
parent
39e91b1cef
commit
752a79976a
@ -216,6 +216,8 @@ class Auth extends BaseController
|
|||||||
$data['fan_num'] = app()->make(RelevanceRepository::class)->getUserFans($user->uid, 1, 1, 1);
|
$data['fan_num'] = app()->make(RelevanceRepository::class)->getUserFans($user->uid, 1, 1, 1);
|
||||||
$data['focus_num'] = app()->make(RelevanceRepository::class)->getUserFocus($user->uid, 1, 1, 1);
|
$data['focus_num'] = app()->make(RelevanceRepository::class)->getUserFocus($user->uid, 1, 1, 1);
|
||||||
$data['community_num'] = Db::name('community')->where('uid', $user->uid)->whereIn('is_type', '1,2')->count();
|
$data['community_num'] = Db::name('community')->where('uid', $user->uid)->whereIn('is_type', '1,2')->count();
|
||||||
|
|
||||||
|
$thirdparty = Db::name('user_thirdparty_token')->where('user_id', $user->uid)->select();
|
||||||
return app('json')->success($data);
|
return app('json')->success($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1223,15 +1225,26 @@ class Auth extends BaseController
|
|||||||
$expiresTime = $this->request->param('expires_time', '');
|
$expiresTime = $this->request->param('expires_time', '');
|
||||||
$user = $this->request->userInfo();
|
$user = $this->request->userInfo();
|
||||||
$uid = $user->uid;
|
$uid = $user->uid;
|
||||||
$insertData = [
|
$tokenInfo = Db::name('user_thirdparty_token')->where(['user_type'=>$userType, 'user_id'=>$uid])->find();
|
||||||
'account' => $account,
|
if ($tokenInfo) {
|
||||||
'user_type' => $userType,
|
$updData = [
|
||||||
'token' => $token,
|
'account' => $account,
|
||||||
'expires_time' => $expiresTime,
|
'token' => $token,
|
||||||
'user_id' => $uid,
|
'expires_time' => $expiresTime,
|
||||||
'create_time' => date('Y-m-d H:i:s')
|
'create_time' => date('Y-m-d H:i:s')
|
||||||
];
|
];
|
||||||
Db::name('user_thirdparty_token')->fetchSql(false)->insert($insertData);
|
Db::name('user_thirdparty_token')->where(['user_type'=>$userType, 'user_id'=>$uid])->update($updData);
|
||||||
return app('json')->success($insertData);
|
} else {
|
||||||
|
$insertData = [
|
||||||
|
'user_id' => $uid,
|
||||||
|
'user_type' => $userType,
|
||||||
|
'account' => $account,
|
||||||
|
'token' => $token,
|
||||||
|
'expires_time' => $expiresTime,
|
||||||
|
'create_time' => date('Y-m-d H:i:s')
|
||||||
|
];
|
||||||
|
Db::name('user_thirdparty_token')->insert($insertData);
|
||||||
|
}
|
||||||
|
return app('json')->success($this->request->param());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user