Commit d9bf6e65 by lujunyi

注释

parent 4d04848a
...@@ -23,7 +23,7 @@ public function login(Request $request) ...@@ -23,7 +23,7 @@ public function login(Request $request)
$credentials = app('wechat.mini_program')->auth->session($code); $credentials = app('wechat.mini_program')->auth->session($code);
if ($credentials['openid'] ?? '') { if ($credentials['openid'] ?? '') {
$user = User::firstOrCreate(['openid', $credentials['openid']]); $user = User::firstOrCreate(['openid', $credentials['openid']]);
// 追加登录类型到token里面 // 追加登录类型到token里面,前端需要带在header头中 Authorization:Bearer Token
$token = auth('api')->claims(['login_type' => User::LOGIN_TYPE_USER])->fromUser($user); $token = auth('api')->claims(['login_type' => User::LOGIN_TYPE_USER])->fromUser($user);
// $data = $this->respondWithToken($token)->original; // $data = $this->respondWithToken($token)->original;
$data = ['token' => $token]; $data = ['token' => $token];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment