[update] Login qr show option

This commit is contained in:
Lkeme 2023-06-18 15:12:17 +08:00
parent 3c29197c5e
commit f57bd956ae
4 changed files with 109 additions and 66 deletions

View File

@ -23,10 +23,28 @@
}, },
"repositories": [ "repositories": [
{ {
"description": "PhpComposer(全量)", "description": "PhpComposer",
"type": "composer", "type": "composer",
"url": "https://packagist.phpcomposer.com", "url": "https://packagist.phpcomposer.com",
"canonical": false "canonical": false
},
{
"description": "TencentCloud",
"type": "composer",
"url": "https://mirrors.tencent.com/composer/",
"canonical": false
},
{
"description": "packagist.kr",
"type": "composer",
"url": "https://packagist.kr",
"canonical": false
},
{
"description": "AliCloud",
"type": "composer",
"url": "https://mirrors.aliyun.com/composer/",
"canonical": false
} }
], ],
"require": { "require": {

View File

@ -251,7 +251,7 @@ $ -e VERSION=2 # 使用 版本 V2.x.x(默认选项)
> 以下加速镜像均为网络收集,感谢公益提供者,如有问题请联系删除 > 以下加速镜像均为网络收集,感谢公益提供者,如有问题请联系删除
```shell script ```shell script
$ -e MIRRORS=0 # 使用 github.com(RAW|CDN $ -e MIRRORS=0 # 使用 github.com(RAW|源站|默认)
$ -e MIRRORS=1 # 使用 ghproxy.com(KR|韩国) $ -e MIRRORS=1 # 使用 ghproxy.com(KR|韩国)
$ -e MIRRORS=2 # 使用 gitclone.com(CN|中国) $ -e MIRRORS=2 # 使用 gitclone.com(CN|中国)
$ -e MIRRORS=3 # 使用 hub.gitfast.tk(US|美国) $ -e MIRRORS=3 # 使用 hub.gitfast.tk(US|美国)

View File

@ -368,6 +368,33 @@ class Login extends BasePlugin
$this->loginAfter($mode, $response['code'], $response); $this->loginAfter($mode, $response['code'], $response);
} }
/**
* @param string $qr
* @return void
*/
protected function qrcodeLoginShow(string $qr): void
{
Log::info("1.终端直接显示(输入:1)");
Log::info("2.浏览器链接访问(输入:2)");
$option = $this->cliInput("请输入二维码显示方式: ");
switch ($option) {
case '1':
//
$this->cliInput("请尝试放大窗口,以确保二维码完整显示,回车继续");
Qrcode::show($qr);
break;
case '2':
Log::info("请使用浏览器访问下面的链接,以确保二维码完整显示");
// $url = 'https://cli.im/api/qrcode/code?text=' . urlencode($qr) . '&mhid=';
$url = 'https://cli.im/api/qrcode/code?text=' . urlencode($qr);
Log::info($url);
break;
default:
failExit('无效的选项');
}
}
/** /**
* 扫码登录 * 扫码登录
* @param string $mode * @param string $mode
@ -377,12 +404,10 @@ class Login extends BasePlugin
{ {
Log::info("尝试 $mode 登录"); Log::info("尝试 $mode 登录");
// //
$this->cliInput("请尝试放大窗口,以确保二维码完整显示,回车继续");
//
$response = $this->fetchQrAuthCode(); $response = $this->fetchQrAuthCode();
$auth_code = $response['auth_code']; $auth_code = $response['auth_code'];
// //
Qrcode::show($response['url']); $this->qrcodeLoginShow($response['url']);
// max 180 step 3 // max 180 step 3
foreach (range(0, 180, 3) as $_) { foreach (range(0, 180, 3) as $_) {
sleep(3); sleep(3);

View File

@ -112,11 +112,11 @@ enable = false
; 动态抽奖&预约直播抽奖 ; 动态抽奖&预约直播抽奖
[lottery] [lottery]
enable = true enable = false
; 抽奖模式 0.从最新Id开始抽奖 1.从最新Id的前2400个开始抽奖 ; 抽奖模式 0.从最新Id开始抽奖 1.从最新Id的前2400个开始抽奖
lottery_mode = 0 lottery_mode = 0
; 直播预约抽奖 ; 直播预约抽奖
live_enable = true live_enable = false
; 每日电池 对应直播间ID和直播间UID ; 每日电池 对应直播间ID和直播间UID
[daily_gold] [daily_gold]