diff --git a/src/OpenWork/Provider/Client.php b/src/OpenWork/Provider/Client.php index fe8088300..f02e7fdce 100644 --- a/src/OpenWork/Provider/Client.php +++ b/src/OpenWork/Provider/Client.php @@ -38,10 +38,11 @@ public function __construct(ServiceContainer $app) * @param string $redirectUri * @param string $userType * @param string $state + * @param bool $serviceWwlogin * * @return string */ - public function getLoginUrl(string $redirectUri = '', string $userType = 'admin', string $state = '') + public function getLoginUrl(string $redirectUri = '', string $userType = 'admin', string $state = '', bool $serviceWwlogin = false) { $redirectUri || $redirectUri = $this->app->config['redirect_uri_single']; $state || $state = random_bytes(64); @@ -52,6 +53,13 @@ public function getLoginUrl(string $redirectUri = '', string $userType = 'admin' 'state' => $state, ]; + // 新版企微登录 + if ($serviceWwlogin) { + $params['appid'] = $this->app['config']['suite_id']; + $params['login_type'] = 'ServiceApp'; + return 'https://login.work.weixin.qq.com/wwlogin/sso/login?'.http_build_query($params); + } + return 'https://open.work.weixin.qq.com/wwopen/sso/3rd_qrConnect?'.http_build_query($params); }