auth->session($code); if (isset($result['errcode'])&&$result['errcode'] != 0) { throw new ErrorCodeException(ErrorCode::WXLOGIN_INVALID_CODE); } // 更新或者插入用户数据 return User::query()->firstOrCreate( ['openid' => $result['openid']], ['unionid' => $result['unionid']] ); } public function check($userId) { // TODO: Implement check() method. } public function undo($userId) { // TODO: Implement undo() method. } }