From a460dca6da156680e7fb1a0c686e248e69dd4c5a Mon Sep 17 00:00:00 2001 From: jansen-s Date: Fri, 28 Jun 2019 19:25:47 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E9=80=80=E5=87=BA?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=96=B9=E6=B3=95=20logout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增 退出微信方法 logout --- src/Core/Server.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Core/Server.php b/src/Core/Server.php index 6975ba33..95a324b5 100644 --- a/src/Core/Server.php +++ b/src/Core/Server.php @@ -319,4 +319,11 @@ protected function generateSyncKey($result, $first) $this->vbot->config['server.syncKeyStr'] = implode('|', $syncKey); } + /** + * logout wechat + */ + protected function logout(){ + $url = 'https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxlogout?redirect=1&type=0&skey='.$this->vbot->config['server.skey']; + $this->vbot->http->post($url, ['sid'=>$this->vbot->config['server.sid'], 'uin'=>$this->vbot->config['server.uin']]); + } } From b447b92631351d305591af619442c17057d17458 Mon Sep 17 00:00:00 2001 From: jansen-s Date: Sat, 29 Jun 2019 14:05:42 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20LangServiceProvider?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceProviders/LangServiceProvider.php | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/Foundation/ServiceProviders/LangServiceProvider.php diff --git a/src/Foundation/ServiceProviders/LangServiceProvider.php b/src/Foundation/ServiceProviders/LangServiceProvider.php new file mode 100644 index 00000000..edac3048 --- /dev/null +++ b/src/Foundation/ServiceProviders/LangServiceProvider.php @@ -0,0 +1,20 @@ +singleton('lang', function () use ($vbot) { + return new Lang($vbot); + }); + } +} From 86251c269501eef1705f16bfc60eeb14d3d59bbc Mon Sep 17 00:00:00 2001 From: Jansen <6206574@qq.com> Date: Sat, 29 Jun 2019 14:14:09 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E5=8F=8A=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=A4=9A=E8=AF=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Foundation/Vbot.php | 1 + src/Languages/zh_CN.php | 31 +++++++++++++++++++++++++++++++ src/Support/Lang.php | 29 +++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 src/Languages/zh_CN.php create mode 100644 src/Support/Lang.php diff --git a/src/Foundation/Vbot.php b/src/Foundation/Vbot.php index b9638865..a4f45877 100644 --- a/src/Foundation/Vbot.php +++ b/src/Foundation/Vbot.php @@ -67,6 +67,7 @@ class Vbot extends Container ServiceProviders\ContactServiceProvider::class, ServiceProviders\ApiServiceProvider::class, ServiceProviders\ExtensionServiceProvider::class, + ServiceProviders\LangServiceProvider::class ]; public function __construct(array $config) diff --git a/src/Languages/zh_CN.php b/src/Languages/zh_CN.php new file mode 100644 index 00000000..10a35bc8 --- /dev/null +++ b/src/Languages/zh_CN.php @@ -0,0 +1,31 @@ + +// +---------------------------------------------------------------------- +return [ + 'dump file success.' => '下载到文件失败。', + 'checkSync no response' => 'checkSync接口无返回信息。', + 'cleaning useless cookies.' => '正在清理无用的Cookie信息。', + 'please scan the qrCode with wechat.' => '请使用手机微信扫描二维码。', + 'please confirm login in wechat.' => '请在手机微信上确认登录。', + 'login time out!' => '登录超时!', + 'current session:' => '当前Session ID:', + 'init begin.' => '开始初始化。', + 'init success.' => '初始化完成。', + 'init contacts begin.' => '开始初始化联系人列表。', + 'vbot exit normally.' => 'VBOT已正常退出。', + 'current user\'s nickname:' => '当前登录账户的昵称:', + 'current user\'s username:' => '当前登录账户的用户名:', + 'current user\'s uin:' => '当前登录账户的UIN:', + 'Argument pass error.' => '缺少必要参数。', + 'Ticket error.' => 'pass_ticket错误。', + 'Logout.' => '微信已退出。', + 'Cookies invalid.' => 'Cookie验证错误。', + 'Api frequency.' => 'API调用频繁。', + 'download file failed.' => '下载文件失败。', + 'emoticon path not set.' => '未设置表情库路径。' +]; \ No newline at end of file diff --git a/src/Support/Lang.php b/src/Support/Lang.php new file mode 100644 index 00000000..fec0c5ea --- /dev/null +++ b/src/Support/Lang.php @@ -0,0 +1,29 @@ + +// +---------------------------------------------------------------------- +namespace Hanson\Vbot\Support; +use Hanson\Vbot\Foundation\Vbot; +class Lang{ + private $languages; + protected $vbot; + public function __construct(Vbot $vbot){ + $this->vbot = $vbot; + } + public function get($msg){ + if (empty($this->languages)){ + $langFilePath = dirname(__DIR__).'/Languages/'.$this->vbot->config['lang'].'.php'; + if(file_exists($langFilePath)){ + $this->languages = require_once $langFilePath; + } + } + return isset($this->languages[$msg])?$this->languages[$msg]:$msg; + } + public function setType($type){ + $this->type = $type; + } +} \ No newline at end of file From 8b299b6caf3b3bce28402d6165c9d68b38f89087 Mon Sep 17 00:00:00 2001 From: jansen-s Date: Sat, 29 Jun 2019 14:47:46 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=8F=8A?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E8=BE=93=E5=87=BA=E5=A2=9E=E5=8A=A0=E5=A4=9A?= =?UTF-8?q?=E8=AF=AD=E8=A8=80=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Console/Console.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Console/Console.php b/src/Console/Console.php index c56179ab..2d8b89c0 100644 --- a/src/Console/Console.php +++ b/src/Console/Console.php @@ -51,6 +51,7 @@ public static function isWin() */ public function log($str, $level = 'INFO', $log = false) { + $str = $this->vbot->lang->get($str); if ($this->isOutput()) { if ($log && in_array($level, array_keys(Logger::getLevels()))) { $this->vbot->log->log($level, $str); From 970faed0297466bdd4d145d792f61330ac9e55de Mon Sep 17 00:00:00 2001 From: jansen-s Date: Sat, 29 Jun 2019 14:56:59 +0800 Subject: [PATCH 5/6] Update zh_CN.php --- src/Languages/zh_CN.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Languages/zh_CN.php b/src/Languages/zh_CN.php index 10a35bc8..d0fa73c8 100644 --- a/src/Languages/zh_CN.php +++ b/src/Languages/zh_CN.php @@ -1,11 +1,4 @@ -// +---------------------------------------------------------------------- return [ 'dump file success.' => '下载到文件失败。', 'checkSync no response' => 'checkSync接口无返回信息。', @@ -28,4 +21,4 @@ 'Api frequency.' => 'API调用频繁。', 'download file failed.' => '下载文件失败。', 'emoticon path not set.' => '未设置表情库路径。' -]; \ No newline at end of file +]; From a4fc6bbdaba69070c149756dea7aca840e18c090 Mon Sep 17 00:00:00 2001 From: jansen-s Date: Sat, 29 Jun 2019 14:58:14 +0800 Subject: [PATCH 6/6] Update Lang.php --- src/Support/Lang.php | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Support/Lang.php b/src/Support/Lang.php index fec0c5ea..15c4f8e0 100644 --- a/src/Support/Lang.php +++ b/src/Support/Lang.php @@ -1,11 +1,4 @@ -// +---------------------------------------------------------------------- namespace Hanson\Vbot\Support; use Hanson\Vbot\Foundation\Vbot; class Lang{ @@ -26,4 +19,4 @@ public function get($msg){ public function setType($type){ $this->type = $type; } -} \ No newline at end of file +}