From 5a9dbf0abf40e0384e118a4945741b6fe2340b7f Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 2 Mar 2021 13:08:35 +0800 Subject: [PATCH 01/21] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E9=85=8D=E7=BD=AE=E5=8F=91=E9=80=81=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=82=AE=E4=BB=B6=E6=97=B6=EF=BC=8C=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E5=8C=85=E5=8F=98=E9=87=8F=E6=9C=AA=E6=9B=BF=E6=8D=A2=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/lang/zh-cn/general/config.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/admin/lang/zh-cn/general/config.php b/application/admin/lang/zh-cn/general/config.php index 14ed8b5c2..021384f3b 100644 --- a/application/admin/lang/zh-cn/general/config.php +++ b/application/admin/lang/zh-cn/general/config.php @@ -70,8 +70,8 @@ return [ 'Name already exist' => '变量名称已经存在', 'Add new config' => '点击添加新的配置', 'Send a test message' => '发送测试邮件', - 'This is a test mail content' => '这是一封来自{sitename}校验邮件,用于校验邮件配置是否正常!', - 'This is a test mail' => '这是一封来自{sitename}的邮件', + 'This is a test mail content' => '这是一封来自%s的校验邮件,用于校验邮件配置是否正常!', + 'This is a test mail' => '这是一封来自%s的邮件', 'Please input your email' => '请输入测试接收者邮箱', 'Please input correct email' => '请输入正确的邮箱地址', ]; -- Gitee From dc5a2e01dd9b9171ea970a9d27a56ec87b4c3177 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 2 Mar 2021 13:21:22 +0800 Subject: [PATCH 02/21] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=94=9F=E6=88=90CURD?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=8C=87=E5=AE=9A=E9=9C=80=E8=A6=81=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=97=B6=E7=9A=84=E6=8A=A5=E9=94=99=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Crud.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/admin/command/Crud.php b/application/admin/command/Crud.php index bdc2bd0e0..927625b77 100755 --- a/application/admin/command/Crud.php +++ b/application/admin/command/Crud.php @@ -173,6 +173,7 @@ class Crud extends Command ->addOption('switchsuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate switch component with suffix', null) ->addOption('citysuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate citypicker component with suffix', null) ->addOption('jsonsuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate fieldlist component with suffix', null) + ->addOption('editorsuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate editor component with suffix', null) ->addOption('selectpagesuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate selectpage component with suffix', null) ->addOption('selectpagessuffix', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'automatically generate multiple selectpage component with suffix', null) ->addOption('ignorefields', null, Option::VALUE_OPTIONAL | Option::VALUE_IS_ARRAY, 'ignore fields', null) -- Gitee From 5ab531e0ecafe731b30da0502d315e238897db2e Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 2 Mar 2021 13:44:37 +0800 Subject: [PATCH 03/21] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E8=87=AA=E5=B8=A6Email=E7=B1=BB=E5=8F=91=E9=80=81=E9=82=AE?= =?UTF-8?q?=E4=BB=B6=E6=97=B6=EF=BC=8C=E6=94=B6=E4=BB=B6=E4=BA=BA=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E5=90=8D=E6=98=AF=E6=95=B0=E7=BB=84=E7=B4=A2=E5=BC=95?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Email.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/application/common/library/Email.php b/application/common/library/Email.php index 8d186fc35..458ae09dd 100644 --- a/application/common/library/Email.php +++ b/application/common/library/Email.php @@ -176,7 +176,12 @@ class Email */ protected function buildAddress($emails) { - $emails = is_array($emails) ? $emails : array_flip(explode(',', str_replace(";", ",", $emails))); + if (!is_array($emails)) { + $emails = array_flip(explode(',', str_replace(";", ",", $emails))); + foreach ($emails as $key => $value) { + $emails[$key] = strstr($key, '@', true); + } + } return $emails; } -- Gitee From 5d7181fe1d13116f302157405b05528536f2c54f Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 2 Mar 2021 13:45:19 +0800 Subject: [PATCH 04/21] =?UTF-8?q?=E7=A7=BB=E9=99=A4to=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=BB=8E=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84$name=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Email.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/application/common/library/Email.php b/application/common/library/Email.php index 458ae09dd..5b3a3327d 100644 --- a/application/common/library/Email.php +++ b/application/common/library/Email.php @@ -96,10 +96,9 @@ class Email /** * 设置收件人 * @param mixed $email 收件人,多个收件人以,进行分隔 - * @param string $name 收件人名称 * @return $this */ - public function to($email, $name = '') + public function to($email) { $emailArr = $this->buildAddress($email); foreach ($emailArr as $address => $name) { -- Gitee From 8127f56953940bf589d0bc4bc428e2482f9e80f1 Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 9 Mar 2021 09:17:33 +0800 Subject: [PATCH 05/21] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=9C=A8=E7=BA=BF?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E7=94=9F=E6=88=90Api=E6=96=87=E6=A1=A3?= =?UTF-8?q?=EF=BC=8C=E6=8E=A7=E5=88=B6=E5=99=A8=E8=AE=BE=E7=BD=AE=E9=9A=90?= =?UTF-8?q?=E8=97=8F=E4=BB=8D=E7=84=B6=E4=BC=9A=E6=98=BE=E7=A4=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Api/library/Builder.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/application/admin/command/Api/library/Builder.php b/application/admin/command/Api/library/Builder.php index 169930abd..c36215014 100755 --- a/application/admin/command/Api/library/Builder.php +++ b/application/admin/command/Api/library/Builder.php @@ -165,6 +165,10 @@ class Builder $sectorArr = []; foreach ($allClassAnnotations as $index => &$allClassAnnotation) { + // 如果设置隐藏,则不显示在文档 + if (isset($allClassAnnotation['ApiInternal'])) { + continue; + } $sector = isset($allClassAnnotation['ApiSector']) ? $allClassAnnotation['ApiSector'][0] : $allClassAnnotation['ApiTitle'][0]; $sectorArr[$sector] = isset($allClassAnnotation['ApiWeigh']) ? $allClassAnnotation['ApiWeigh'][0] : 0; } -- Gitee From b909c0b27ae94d28bef364149dea8839c6daa14f Mon Sep 17 00:00:00 2001 From: F4NNIU Date: Tue, 9 Mar 2021 15:58:19 +0800 Subject: [PATCH 06/21] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=A6=81=E6=AD=A2?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=BC=95=E6=93=8E=E6=94=B6=E5=BD=95=E5=92=8C?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/common/meta.html | 1 + 1 file changed, 1 insertion(+) diff --git a/application/admin/view/common/meta.html b/application/admin/view/common/meta.html index fe4ed3c31..6f26b0f40 100644 --- a/application/admin/view/common/meta.html +++ b/application/admin/view/common/meta.html @@ -3,6 +3,7 @@ + -- Gitee From 6c0ea3a420f8e6c1f80beeac6e3ce9345f121fe3 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 10 Mar 2021 10:26:54 +0800 Subject: [PATCH 07/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=82=AE=E4=BB=B6?= =?UTF-8?q?=E5=8F=91=E9=80=81=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/library/Email.php | 3 ++- application/common/library/Log.php | 29 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 application/common/library/Log.php diff --git a/application/common/library/Email.php b/application/common/library/Email.php index 8d186fc35..7d934eca4 100644 --- a/application/common/library/Email.php +++ b/application/common/library/Email.php @@ -62,7 +62,8 @@ class Email $secureArr = [0 => '', 1 => 'tls', 2 => 'ssl']; $secure = isset($secureArr[$this->options['mail_verify_type']]) ? $secureArr[$this->options['mail_verify_type']] : ''; - $this->mail = new Mailer(); + $logger = isset($this->options['debug']) && $this->options['debug'] ? new Log : null; + $this->mail = new Mailer($logger); $this->mail->setServer($this->options['mail_smtp_host'], $this->options['mail_smtp_port'], $secure); $this->mail->setAuth($this->options['mail_from'], $this->options['mail_smtp_pass']); diff --git a/application/common/library/Log.php b/application/common/library/Log.php new file mode 100644 index 000000000..a9d891dca --- /dev/null +++ b/application/common/library/Log.php @@ -0,0 +1,29 @@ + Date: Wed, 10 Mar 2021 10:27:32 +0800 Subject: [PATCH 08/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dunixtime=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E8=AE=A1=E7=AE=97=E5=91=A8=E5=81=8F=E7=A7=BB=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/fast/Date.php | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/extend/fast/Date.php b/extend/fast/Date.php index d8f7ab467..c4e4c3126 100644 --- a/extend/fast/Date.php +++ b/extend/fast/Date.php @@ -25,9 +25,9 @@ class Date * [!!] A list of time zones that PHP supports can be found at * . * - * @param string $remote timezone that to find the offset of - * @param string $local timezone used as the baseline - * @param mixed $now UNIX timestamp or date string + * @param string $remote timezone that to find the offset of + * @param string $local timezone used as the baseline + * @param mixed $now UNIX timestamp or date string * @return integer */ public static function offset($remote, $local = null, $now = null) @@ -57,9 +57,9 @@ class Date * $span = self::span(60, 182, 'minutes,seconds'); // array('minutes' => 2, 'seconds' => 2) * $span = self::span(60, 182, 'minutes'); // 2 * - * @param int $remote timestamp to find the span of - * @param int $local timestamp to use as the baseline - * @param string $output formatting string + * @param int $remote timestamp to find the span of + * @param int $local timestamp to use as the baseline + * @param string $output formatting string * @return string when only a single output is requested * @return array associative list of all outputs requested * @from https://github.com/kohana/ohanzee-helpers/blob/master/src/Date.php @@ -117,8 +117,8 @@ class Date /** * 格式化 UNIX 时间戳为人易读的字符串 * - * @param int Unix 时间戳 - * @param mixed $local 本地时间 + * @param int Unix 时间戳 + * @param mixed $local 本地时间 * * @return string 格式化的日期字符串 */ @@ -167,6 +167,8 @@ class Date $minute = is_null($minute) ? date('i') : $minute; $position = in_array($position, array('begin', 'start', 'first', 'front')); + $baseTime = mktime(0, 0, 0, $month, $day, $year); + switch ($type) { case 'minute': $time = $position ? mktime($hour, $minute + $offset, 0, $month, $day, $year) : mktime($hour, $minute + $offset, 59, $month, $day, $year); @@ -178,19 +180,20 @@ class Date $time = $position ? mktime(0, 0, 0, $month, $day + $offset, $year) : mktime(23, 59, 59, $month, $day + $offset, $year); break; case 'week': + $weekIndex = date("w", $baseTime); $time = $position ? - mktime(0, 0, 0, $month, $day - date("w", mktime(0, 0, 0, $month, $day, $year)) + 1 - 7 * (-$offset), $year) : - mktime(23, 59, 59, $month, $day - date("w", mktime(0, 0, 0, $month, $day, $year)) + 7 - 7 * (-$offset), $year); + strtotime($offset . " weeks", strtotime(date('Y-m-d', strtotime("-" . ($weekIndex ? $weekIndex - 1 : 6) . " days", $baseTime)))) : + strtotime($offset . " weeks", strtotime(date('Y-m-d 23:59:59', strtotime("+" . (6 - ($weekIndex ? $weekIndex - 1 : 6)) . " days", $baseTime)))); break; case 'month': - $_timestamp=mktime(0, 0, 0, $month + $offset, 1, $year); - $time = $position ? $_timestamp : mktime(23, 59, 59, $month + $offset, cal_days_in_month(CAL_GREGORIAN, date("m",$_timestamp), date("Y",$_timestamp)), $year); + $_timestamp = mktime(0, 0, 0, $month + $offset, 1, $year); + $time = $position ? $_timestamp : mktime(23, 59, 59, $month + $offset, cal_days_in_month(CAL_GREGORIAN, date("m", $_timestamp), date("Y", $_timestamp)), $year); break; case 'quarter': - $_month=date("m",mktime(0, 0, 0, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, $day, $year)); + $_month = date("m", mktime(0, 0, 0, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, $day, $year)); $time = $position ? - mktime(0, 0, 0, 1 + ((ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) - 1) * 3, 1, $year) : - mktime(23, 59, 59, (ceil(date('n', mktime(0, 0, 0, $month, $day, $year)) / 3) + $offset) * 3, cal_days_in_month(CAL_GREGORIAN, $_month, $year), $year); + mktime(0, 0, 0, 1 + ((ceil(date('n', $baseTime) / 3) + $offset) - 1) * 3, 1, $year) : + mktime(23, 59, 59, (ceil(date('n', $baseTime) / 3) + $offset) * 3, cal_days_in_month(CAL_GREGORIAN, (ceil(date('n', $baseTime) / 3) + $offset) * 3, $year), $year); break; case 'year': $time = $position ? mktime(0, 0, 0, 1, 1, $year + $offset) : mktime(23, 59, 59, 12, 31, $year + $offset); -- Gitee From 89e14e8f8b1f18497d315ed112c8ccd8b7b05465 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 10 Mar 2021 10:28:32 +0800 Subject: [PATCH 09/21] =?UTF-8?q?=E5=AE=89=E8=A3=85=E8=84=9A=E6=9C=ACPHP?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Install.php | 4 ++-- application/admin/command/Install/zh-cn.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/admin/command/Install.php b/application/admin/command/Install.php index f9da2cd70..99414c392 100644 --- a/application/admin/command/Install.php +++ b/application/admin/command/Install.php @@ -294,8 +294,8 @@ class Install extends Command //数据库配置文件 $dbConfigFile = APP_PATH . 'database.php'; - if (version_compare(PHP_VERSION, '7.0.0', '<')) { - throw new Exception(__("The current version %s is too low, please use PHP 7.0 or higher", PHP_VERSION)); + if (version_compare(PHP_VERSION, '7.1.0', '<')) { + throw new Exception(__("The current version %s is too low, please use PHP 7.1 or higher", PHP_VERSION)); } if (!extension_loaded("PDO")) { throw new Exception(__("PDO is not currently installed and cannot be installed")); diff --git a/application/admin/command/Install/zh-cn.php b/application/admin/command/Install/zh-cn.php index 26914d025..a7dc331af 100644 --- a/application/admin/command/Install/zh-cn.php +++ b/application/admin/command/Install/zh-cn.php @@ -26,7 +26,7 @@ return [ 'Please input correct password' => '密码长度必须在6-16位之间,不能包含空格', 'The two passwords you entered did not match' => '两次输入的密码不一致', 'Please input correct website' => '网站名称输入不正确', - 'The current version %s is too low, please use PHP 7.0 or higher' => '当前版本%s过低,请使用PHP7.0以上版本', + 'The current version %s is too low, please use PHP 7.1 or higher' => '当前版本%s过低,请使用PHP7.1以上版本', 'PDO is not currently installed and cannot be installed' => '当前未开启PDO,无法进行安装', 'The current permissions are insufficient to write the file %s' => '当前权限不足,无法写入文件%s', 'Please go to the official website to download the full package or resource package and try to install' => '当前代码仅包含核心代码,请前往官网下载完整包或资源包覆盖后再尝试安装', -- Gitee From 2e74e2c119d632cd087867ef492a58778f07d2fb Mon Sep 17 00:00:00 2001 From: F4NNIU Date: Thu, 18 Mar 2021 15:33:18 +0800 Subject: [PATCH 10/21] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Composer=20=E4=BE=9D?= =?UTF-8?q?=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 73eef9c1d..1de5b560b 100755 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ ], "require": { "php": ">=7.1.0", - "topthink/framework": "~5.0.24", + "topthink/framework": "dev-master", "topthink/think-captcha": "^1.0", "karsonzhang/fastadmin-addons": "~1.2.4", "overtrue/pinyin": "~3.0", @@ -30,5 +30,11 @@ }, "config": { "preferred-install": "dist" - } + }, + "repositories": [ + { + "type": "vcs", + "url": "https://gitee.com/karson/framework" + } + ] } -- Gitee From c7126fe7bb9ccf83d922de744798d49974320321 Mon Sep 17 00:00:00 2001 From: Karson Date: Wed, 24 Mar 2021 11:18:12 +0800 Subject: [PATCH 11/21] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8B=BC=E9=9F=B3?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/fast/Pinyin.php | 73 +++++++----------------------------------- 1 file changed, 12 insertions(+), 61 deletions(-) diff --git a/extend/fast/Pinyin.php b/extend/fast/Pinyin.php index 87606535f..7397c4fc2 100644 --- a/extend/fast/Pinyin.php +++ b/extend/fast/Pinyin.php @@ -7,79 +7,30 @@ namespace fast; */ class Pinyin { - protected static $keys = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao|she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai|tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong|zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo"; - protected static $values = "-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274|-10270|-10262|-10260|-10256|-10254"; /** * 获取文字的拼音 * @param string $chinese 中文汉字 * @param boolean $onlyfirst 是否只返回拼音首字母 * @param string $delimiter 分隔符 - * @param string $charset 文字编码 + * @param bool $ucfirst 是否首字母大写 * @return string */ - public static function get($chinese, $onlyfirst = false, $delimiter = '', $ucfirst = false, $charset = 'utf-8') + public static function get($chinese, $onlyfirst = false, $delimiter = '', $ucfirst = false) { - $keys_a = explode('|', self::$keys); - $values_a = explode('|', self::$values); - $data = array_combine($keys_a, $values_a); - arsort($data); - reset($data); - if ($charset != 'gb2312') { - $chinese = self::_u2_utf8_gb($chinese); - } - $result = ''; - for ($i = 0; $i < strlen($chinese); $i++) { - $_P = ord(substr($chinese, $i, 1)); - if ($_P > 160) { - $_Q = ord(substr($chinese, ++$i, 1)); - $_P = $_P * 256 + $_Q - 65536; - } - $result .= ($onlyfirst ? substr(self::_pinyin($_P, $data), 0, 1) : self::_pinyin($_P, $data)); - $result .= $delimiter; - } - if ($delimiter) { - $result = rtrim($result, $delimiter); - } - return preg_replace("/[^a-z0-9_\-]*/i", '', $result); - } - - private static function _pinyin($num, $data) - { - if ($num > 0 && $num < 160) { - return chr($num); - } elseif ($num < -20319 || $num > -10247) { - return ''; + $pinyin = new \Overtrue\Pinyin\Pinyin(); + if ($onlyfirst) { + $result = $pinyin->abbr($chinese, $delimiter); } else { - foreach ($data as $k => $v) { - if ($v <= $num) { - break; - } - } - - return $k; + $result = $pinyin->permalink($chinese, $delimiter); } - } - - private static function _u2_utf8_gb($c) - { - $string = ''; - if ($c < 0x80) { - $string .= $c; - } elseif ($c < 0x800) { - $string .= chr(0xC0 | $c >> 6); - $string .= chr(0x80 | $c & 0x3F); - } elseif ($c < 0x10000) { - $string .= chr(0xE0 | $c >> 12); - $string .= chr(0x80 | $c >> 6 & 0x3F); - $string .= chr(0x80 | $c & 0x3F); - } elseif ($c < 0x200000) { - $string .= chr(0xF0 | $c >> 18); - $string .= chr(0x80 | $c >> 12 & 0x3F); - $string .= chr(0x80 | $c >> 6 & 0x3F); - $string .= chr(0x80 | $c & 0x3F); + if ($ucfirst) { + $pinyinArr = explode($delimiter, $result); + $result = implode($delimiter, array_map('ucfirst', $pinyinArr)); } - return iconv('UTF-8', 'GB2312//IGNORE', $string); + + return $result; } + } -- Gitee From 63d74029f06de88f1b6b575f47b01a363fb23296 Mon Sep 17 00:00:00 2001 From: F4NNIU Date: Thu, 25 Mar 2021 11:29:34 +0800 Subject: [PATCH 12/21] =?UTF-8?q?=E5=85=B3=E9=97=AD=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E7=A0=81=E7=9A=84=E8=87=AA=E5=8A=A8=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/index/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/view/index/login.html b/application/admin/view/index/login.html index 9c10db8d7..80910bf44 100644 --- a/application/admin/view/index/login.html +++ b/application/admin/view/index/login.html @@ -113,7 +113,7 @@ {if $Think.config.fastadmin.login_captcha}
- + -- Gitee From 97a6b53cec5e5eff3ba639944eecc3843a9c1adb Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 26 Mar 2021 10:58:11 +0800 Subject: [PATCH 13/21] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=A2=9E=E5=88=A0=E6=94=B9=E4=BA=8B=E5=8A=A1=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Admin.php | 1 + 1 file changed, 1 insertion(+) diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index e7153dde2..7e25dcb02 100644 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -7,6 +7,7 @@ use app\admin\model\AuthGroupAccess; use app\common\controller\Backend; use fast\Random; use fast\Tree; +use think\Db; use think\Validate; /** -- Gitee From e4b2066e0fcc12d5c6699b1b95b5cea1b193fd3e Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 26 Mar 2021 11:01:22 +0800 Subject: [PATCH 14/21] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=A2=9E=E5=88=A0=E6=94=B9=E4=BA=8B=E5=8A=A1=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Admin.php | 132 ++++++++++++-------- 1 file changed, 77 insertions(+), 55 deletions(-) diff --git a/application/admin/controller/auth/Admin.php b/application/admin/controller/auth/Admin.php index 7e25dcb02..aee9c13ab 100644 --- a/application/admin/controller/auth/Admin.php +++ b/application/admin/controller/auth/Admin.php @@ -123,32 +123,39 @@ class Admin extends Backend $this->token(); $params = $this->request->post("row/a"); if ($params) { - if (!Validate::is($params['password'], '\S{6,16}')) { - $this->error(__("Please input correct password")); - } - $params['salt'] = Random::alnum(); - $params['password'] = md5(md5($params['password']) . $params['salt']); - $params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。 - $result = $this->model->validate('Admin.add')->save($params); - if ($result === false) { - $this->error($this->model->getError()); - } - $group = $this->request->post("group/a"); + Db::startTrans(); + try { + if (!Validate::is($params['password'], '\S{6,16}')) { + exception(__("Please input correct password")); + } + $params['salt'] = Random::alnum(); + $params['password'] = md5(md5($params['password']) . $params['salt']); + $params['avatar'] = '/assets/img/avatar.png'; //设置新管理员默认头像。 + $result = $this->model->validate('Admin.add')->save($params); + if ($result === false) { + exception($this->model->getError()); + } + $group = $this->request->post("group/a"); - //过滤不允许的组别,避免越权 - $group = array_intersect($this->childrenGroupIds, $group); - if (!$group) { - $this->error(__('The parent group exceeds permission limit')); - } + //过滤不允许的组别,避免越权 + $group = array_intersect($this->childrenGroupIds, $group); + if (!$group) { + exception(__('The parent group exceeds permission limit')); + } - $dataset = []; - foreach ($group as $value) { - $dataset[] = ['uid' => $this->model->id, 'group_id' => $value]; + $dataset = []; + foreach ($group as $value) { + $dataset[] = ['uid' => $this->model->id, 'group_id' => $value]; + } + model('AuthGroupAccess')->saveAll($dataset); + Db::commit(); + } catch (\Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); } - model('AuthGroupAccess')->saveAll($dataset); $this->success(); } - $this->error(); + $this->error(__('Parameter %s can not be empty', '')); } return $this->view->fetch(); } @@ -169,46 +176,53 @@ class Admin extends Backend $this->token(); $params = $this->request->post("row/a"); if ($params) { - if ($params['password']) { - if (!Validate::is($params['password'], '\S{6,16}')) { - $this->error(__("Please input correct password")); + Db::startTrans(); + try { + if ($params['password']) { + if (!Validate::is($params['password'], '\S{6,16}')) { + exception(__("Please input correct password")); + } + $params['salt'] = Random::alnum(); + $params['password'] = md5(md5($params['password']) . $params['salt']); + } else { + unset($params['password'], $params['salt']); + } + //这里需要针对username和email做唯一验证 + $adminValidate = \think\Loader::validate('Admin'); + $adminValidate->rule([ + 'username' => 'require|regex:\w{3,12}|unique:admin,username,' . $row->id, + 'email' => 'require|email|unique:admin,email,' . $row->id, + 'password' => 'regex:\S{32}', + ]); + $result = $row->validate('Admin.edit')->save($params); + if ($result === false) { + exception($row->getError()); } - $params['salt'] = Random::alnum(); - $params['password'] = md5(md5($params['password']) . $params['salt']); - } else { - unset($params['password'], $params['salt']); - } - //这里需要针对username和email做唯一验证 - $adminValidate = \think\Loader::validate('Admin'); - $adminValidate->rule([ - 'username' => 'require|regex:\w{3,12}|unique:admin,username,' . $row->id, - 'email' => 'require|email|unique:admin,email,' . $row->id, - 'password' => 'regex:\S{32}', - ]); - $result = $row->validate('Admin.edit')->save($params); - if ($result === false) { - $this->error($row->getError()); - } - // 先移除所有权限 - model('AuthGroupAccess')->where('uid', $row->id)->delete(); + // 先移除所有权限 + model('AuthGroupAccess')->where('uid', $row->id)->delete(); - $group = $this->request->post("group/a"); + $group = $this->request->post("group/a"); - // 过滤不允许的组别,避免越权 - $group = array_intersect($this->childrenGroupIds, $group); - if (!$group) { - $this->error(__('The parent group exceeds permission limit')); - } + // 过滤不允许的组别,避免越权 + $group = array_intersect($this->childrenGroupIds, $group); + if (!$group) { + exception(__('The parent group exceeds permission limit')); + } - $dataset = []; - foreach ($group as $value) { - $dataset[] = ['uid' => $row->id, 'group_id' => $value]; + $dataset = []; + foreach ($group as $value) { + $dataset[] = ['uid' => $row->id, 'group_id' => $value]; + } + model('AuthGroupAccess')->saveAll($dataset); + Db::commit(); + } catch (\Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); } - model('AuthGroupAccess')->saveAll($dataset); $this->success(); } - $this->error(); + $this->error(__('Parameter %s can not be empty', '')); } $grouplist = $this->auth->getGroups($row['id']); $groupids = []; @@ -243,10 +257,18 @@ class Admin extends Backend } $deleteIds = array_values(array_diff($deleteIds, [$this->auth->id])); if ($deleteIds) { - $this->model->destroy($deleteIds); - model('AuthGroupAccess')->where('uid', 'in', $deleteIds)->delete(); + Db::startTrans(); + try { + $this->model->destroy($deleteIds); + model('AuthGroupAccess')->where('uid', 'in', $deleteIds)->delete(); + Db::commit(); + } catch (\Exception $e) { + Db::rollback(); + $this->error($e->getMessage()); + } $this->success(); } + $this->error(__('No rows were deleted')); } } $this->error(__('You have no permission')); -- Gitee From 65daf79d0a0d3c72d65bdc69115cb50895a39516 Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 26 Mar 2021 11:04:52 +0800 Subject: [PATCH 15/21] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=87=E6=A1=88?= =?UTF-8?q?=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/view/index/index.html | 2 +- application/index/view/layout/default.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/application/index/view/index/index.html b/application/index/view/index/index.html index 31f96d208..bef9626fb 100755 --- a/application/index/view/index/index.html +++ b/application/index/view/index/index.html @@ -74,7 +74,7 @@
-

Copyright @ 2017~{:date('Y',time())} 版权所有 {$site.beian}

+

Copyright @ 2017~{:date('Y',time())} 版权所有 {$site.beian}

diff --git a/application/index/view/layout/default.html b/application/index/view/layout/default.html index 3e6ccca00..48e87caf3 100644 --- a/application/index/view/layout/default.html +++ b/application/index/view/layout/default.html @@ -52,11 +52,11 @@ {include file="common/script" /} - \ No newline at end of file + -- Gitee From 916722b1391ee8cb0f24a9c18ad265b785e58ad4 Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 26 Mar 2021 14:57:04 +0800 Subject: [PATCH 16/21] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=A7=84=E5=88=99=E5=9B=BE=E7=89=87=E5=92=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=97=B6=E4=B8=8D=E7=94=9F?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/addon/config.html | 25 +++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/application/admin/view/addon/config.html b/application/admin/view/addon/config.html index ebec7b2a1..ca91c775e 100644 --- a/application/admin/view/addon/config.html +++ b/application/admin/view/addon/config.html @@ -68,20 +68,27 @@ {/case} {case value="image" break="0"}{/case} {case value="images"} -
- - - -
    +
    + +
    + + +
    +
    +
      {/case} {case value="file" break="0"}{/case} {case value="files"} -
      - - - +
      + +
      + + +
      +
      +
        {/case} {case bool} -- Gitee From ab89d2d50634ed3cf4b773962db7a587b67d7ea8 Mon Sep 17 00:00:00 2001 From: Karson Date: Fri, 26 Mar 2021 16:46:52 +0800 Subject: [PATCH 17/21] =?UTF-8?q?=E4=BC=98=E5=8C=96API=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E5=8F=82=E6=95=B0=E6=A0=BC=E5=BC=8F=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/command/Api.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/application/admin/command/Api.php b/application/admin/command/Api.php index 2c7198427..b7ed2b347 100644 --- a/application/admin/command/Api.php +++ b/application/admin/command/Api.php @@ -37,6 +37,10 @@ class Api extends Command $force = $input->getOption('force'); $url = $input->getOption('url'); $language = $input->getOption('language'); + $template = $input->getOption('template'); + if (!preg_match("/^([a-z0-9]+)\.html\$/i", $template)) { + throw new Exception('template file not correct'); + } $language = $language ? $language : 'zh-cn'; $langFile = $apiDir . 'lang' . DS . $language . '.php'; if (!is_file($langFile)) { @@ -51,7 +55,7 @@ class Api extends Command } // 模板文件 $template_dir = $apiDir . 'template' . DS; - $template_file = $template_dir . $input->getOption('template'); + $template_file = $template_dir . $template; if (!is_file($template_file)) { throw new Exception('template file not found'); } -- Gitee From e2772b164b3863b00dd5731b15d1e6c1782dd460 Mon Sep 17 00:00:00 2001 From: Karson Date: Sat, 27 Mar 2021 23:02:33 +0800 Subject: [PATCH 18/21] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E6=95=B0=E6=8D=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Dashboard.php | 72 +++++++----- application/admin/lang/zh-cn/dashboard.php | 28 ++--- application/admin/view/dashboard/index.html | 116 ++++++++++---------- application/common.php | 5 +- public/assets/js/backend/dashboard.js | 60 +++------- 5 files changed, 134 insertions(+), 147 deletions(-) diff --git a/application/admin/controller/Dashboard.php b/application/admin/controller/Dashboard.php index 4175baf84..6d79275e9 100644 --- a/application/admin/controller/Dashboard.php +++ b/application/admin/controller/Dashboard.php @@ -2,13 +2,17 @@ namespace app\admin\controller; +use app\admin\model\Admin; +use app\admin\model\User; use app\common\controller\Backend; -use think\Config; +use app\common\model\Attachment; +use fast\Date; +use think\Db; /** * 控制台 * - * @icon fa fa-dashboard + * @icon fa fa-dashboard * @remark 用于展示当前系统中的统计数据、统计报表及重要实时数据 */ class Dashboard extends Backend @@ -19,37 +23,47 @@ class Dashboard extends Backend */ public function index() { - $seventtime = \fast\Date::unixtime('day', -7); - $paylist = $createlist = []; - for ($i = 0; $i < 7; $i++) - { - $day = date("Y-m-d", $seventtime + ($i * 86400)); - $createlist[$day] = mt_rand(20, 200); - $paylist[$day] = mt_rand(1, mt_rand(1, $createlist[$day])); + $column = []; + $starttime = Date::unixtime('day', -6); + $endtime = Date::unixtime('day', 0, 'end'); + $joinlist = Db("user")->where('jointime', 'between time', [$starttime, $endtime]) + ->field('jointime, status, COUNT(*) AS nums, DATE_FORMAT(FROM_UNIXTIME(jointime), "%Y-%m-%d") AS join_date') + ->group('join_date') + ->select(); + for ($time = $starttime; $time <= $endtime;) { + $column[] = date("Y-m-d", $time); + $time += 86400; } - $hooks = config('addons.hooks'); - $uploadmode = isset($hooks['upload_config_init']) && $hooks['upload_config_init'] ? implode(',', $hooks['upload_config_init']) : 'local'; - $addonComposerCfg = ROOT_PATH . '/vendor/karsonzhang/fastadmin-addons/composer.json'; - Config::parse($addonComposerCfg, "json", "composer"); - $config = Config::get("composer"); - $addonVersion = isset($config['version']) ? $config['version'] : __('Unknown'); + $userlist = array_fill_keys($column, 0); + foreach ($joinlist as $k => $v) { + $userlist[$v['join_date']] = $v['nums']; + } + + $dbTableList = Db::query("SHOW TABLE STATUS"); $this->view->assign([ - 'totaluser' => 35200, - 'totalviews' => 219390, - 'totalorder' => 32143, - 'totalorderamount' => 174800, - 'todayuserlogin' => 321, - 'todayusersignup' => 430, - 'todayorder' => 2324, - 'unsettleorder' => 132, - 'sevendnu' => '80%', - 'sevendau' => '32%', - 'paylist' => $paylist, - 'createlist' => $createlist, - 'addonversion' => $addonVersion, - 'uploadmode' => $uploadmode + 'totaluser' => User::count(), + 'totaladdon' => count(get_addon_list()), + 'totaladmin' => Admin::count(), + 'totalcategory' => \app\common\model\Category::count(), + 'todayusersignup' => User::whereTime('jointime', 'today')->count(), + 'todayuserlogin' => User::whereTime('logintime', 'today')->count(), + 'sevendau' => User::whereTime('jointime|logintime', '-7 days')->count(), + 'thirtydau' => User::whereTime('jointime|logintime', '-30 days')->count(), + 'threednu' => User::whereTime('jointime', '-3 days')->count(), + 'sevendnu' => User::whereTime('jointime', '-7 days')->count(), + 'dbtablenums' => count($dbTableList), + 'dbsize' => array_sum(array_map(function ($item) { + return $item['Data_length'] + $item['Index_length']; + }, $dbTableList)), + 'attachmentnums' => Attachment::count(), + 'attachmentsize' => Attachment::sum('filesize'), + 'picturenums' => Attachment::where('mimetype', 'like', 'image/%')->count(), + 'picturesize' => Attachment::where('mimetype', 'like', 'image/%')->sum('filesize'), ]); + $this->assignconfig('column', array_keys($userlist)); + $this->assignconfig('userdata', array_values($userlist)); + return $this->view->fetch(); } diff --git a/application/admin/lang/zh-cn/dashboard.php b/application/admin/lang/zh-cn/dashboard.php index 0008f0796..0b244d19e 100644 --- a/application/admin/lang/zh-cn/dashboard.php +++ b/application/admin/lang/zh-cn/dashboard.php @@ -6,34 +6,34 @@ return [ 'Type' => '栏目类型', 'Image' => '图片', 'Total user' => '总会员数', - 'Total view' => '总访问数', - 'Total order' => '总订单数', - 'Total order amount' => '总金额', + 'Total addon' => '总插件数', + 'Total category' => '总分类数', + 'Total admin' => '总管理员数', 'Today user signup' => '今日注册', 'Today user login' => '今日登录', 'Today order' => '今日订单', 'Unsettle order' => '未处理订单', + 'Three dnu' => '三日新增', 'Seven dnu' => '七日新增', 'Seven dau' => '七日活跃', + 'Thirty dau' => '月活跃', 'Custom zone' => '这里是你的自定义数据', - 'Sales' => '成交数', - 'Orders' => '订单数', + 'Register user' => '注册用户数', 'Real time' => '实时', 'Category count' => '分类统计', 'Category count tips' => '当前分类总记录数', + 'Database count' => '数据库统计', + 'Database table nums' => '数据表数量', + 'Database size' => '占用空间', 'Attachment count' => '附件统计', + 'Attachment nums' => '附件数量', + 'Attachment size' => '附件大小', 'Attachment count tips' => '当前上传的附件数量', - 'Article count' => '文章统计', - 'News count' => '新闻统计', - 'Comment count' => '评论次数', - 'Like count' => '点赞次数', - 'Recent news' => '最新新闻', - 'Recent discussion' => '最新发贴', + 'Picture count' => '图片统计', + 'Picture nums' => '图片数量', + 'Picture size' => '图片大小', 'Server info' => '服务器信息', 'PHP version' => 'PHP版本', - 'Fastadmin version' => '主框架版本', - 'Fastadmin addon version' => '插件版本', - 'Thinkphp version' => 'ThinkPHP版本', 'Sapi name' => '运行方式', 'Debug mode' => '调试模式', 'Software' => '环境信息', diff --git a/application/admin/view/dashboard/index.html b/application/admin/view/dashboard/index.html index d70af3b38..1a07e4474 100644 --- a/application/admin/view/dashboard/index.html +++ b/application/admin/view/dashboard/index.html @@ -150,7 +150,6 @@ } - #statistics .panel { min-height: 150px; } @@ -183,28 +182,28 @@
        - +
        - {$totalviews} - {:__('Total view')} + {$totaladdon} + {:__('Total addon')}
        - +
        - {$totalorder} - {:__('Total order')} + {$totalcategory} + {:__('Total category')}
        - +
        - {$totalorderamount} - {:__('Total order amount')} + {$totaladdon} + {:__('Total admin')}
        @@ -229,7 +228,7 @@
        -
        +
        {$todayuserlogin}
        {:__('Today user login')}
        @@ -239,40 +238,40 @@
        -
        +
        -
        {$todayorder}
        -
        {:__('Today order')}
        +
        {$threednu}
        +
        {:__('Three dnu')}
        -
        -
        +
        +
        -
        {$unsettleorder}
        -
        {:__('Unsettle order')}
        +
        {$sevendnu}
        +
        {:__('Seven dnu')}
        -
        +
        -
        {$sevendnu}
        -
        {:__('Seven dnu')}
        +
        {$sevendau}
        +
        {:__('Seven dau')}
        -
        -
        +
        +
        -
        {$sevendau}
        -
        {:__('Seven dau')}
        +
        {$thirtydau}
        +
        {:__('Thirty dau')}
        @@ -296,9 +295,14 @@
        {:__('Category count')}
        -

        1234

        -
        1234
        - {:__('Category count tips')} +
        +
        +

        {$totalcategory}

        +
        + {:__('Category count tips')} +
        +
        +
        @@ -308,12 +312,23 @@
        {:__('Real time')} -
        {:__('Attachment count')}
        +
        {:__('Database count')}
        -

        1043

        -
        2592
        - {:__('Attachment count tips')} +
        +
        +

        {$dbtablenums}

        +
        + {:__('Database table nums')} +
        +
        +
        +

        {$dbsize|format_bytes=###,'',0}

        +
        + {:__('Database size')} +
        +
        +
        @@ -324,21 +339,21 @@
        {:__('Real time')} -
        {:__('Article count')}
        +
        {:__('Attachment count')}
        -

        1234

        -
        - {:__('Comment count')} +

        {$attachmentnums}

        +
        + {:__('Attachment nums')}
        -

        6754

        -
        - {:__('Like count')} +

        {$attachmentsize|format_bytes=###,'',0}

        +
        + {:__('Attachment size')}
        @@ -351,21 +366,21 @@
        {:__('Real time')} -
        {:__('News count')}
        +
        {:__('Picture count')}
        -

        5302

        -
        - {:__('Comment count')} +

        {$picturenums}

        +
        + {:__('Picture nums')}
        -

        8205

        -
        - {:__('Like count')} +

        {$picturesize|format_bytes=###,'',0}

        +
        + {:__('Picture size')}
        @@ -385,12 +400,3 @@
        - - - diff --git a/application/common.php b/application/common.php index 43b53a30d..67bf8e02f 100755 --- a/application/common.php +++ b/application/common.php @@ -33,15 +33,16 @@ if (!function_exists('format_bytes')) { * 将字节转换为可读文本 * @param int $size 大小 * @param string $delimiter 分隔符 + * @param int $precision 小数位数 * @return string */ - function format_bytes($size, $delimiter = '') + function format_bytes($size, $delimiter = '', $precision = 2) { $units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); for ($i = 0; $size >= 1024 && $i < 6; $i++) { $size /= 1024; } - return round($size, 2) . $delimiter . $units[$i]; + return round($size, $precision) . $delimiter . $units[$i]; } } diff --git a/public/assets/js/backend/dashboard.js b/public/assets/js/backend/dashboard.js index 078d1def3..ab8409c2e 100755 --- a/public/assets/js/backend/dashboard.js +++ b/public/assets/js/backend/dashboard.js @@ -11,11 +11,19 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart text: '', subtext: '' }, + color: [ + "#18d1b1", + "#3fb1e3", + "#626c91", + "#a0a7e6", + "#c4ebad", + "#96dee8" + ], tooltip: { trigger: 'axis' }, legend: { - data: [__('Sales'), __('Orders')] + data: [__('Register user')] }, toolbox: { show: false, @@ -27,7 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart xAxis: { type: 'category', boundaryGap: false, - data: Orderdata.column + data: Config.column }, yAxis: {}, grid: [{ @@ -37,7 +45,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart bottom: 30 }], series: [{ - name: __('Sales'), + name: __('Register user'), type: 'line', smooth: true, areaStyle: { @@ -48,55 +56,13 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'table', 'echarts', 'echart width: 1.5 } }, - data: Orderdata.paydata - }, - { - name: __('Orders'), - type: 'line', - smooth: true, - areaStyle: { - normal: {} - }, - lineStyle: { - normal: { - width: 1.5 - } - }, - data: Orderdata.createdata - }] + data: Config.userdata + }] }; // 使用刚指定的配置项和数据显示图表。 myChart.setOption(option); - //动态添加数据,可以通过Ajax获取数据然后填充 - setInterval(function () { - Orderdata.column.push((new Date()).toLocaleTimeString().replace(/^\D*/, '')); - var amount = Math.floor(Math.random() * 200) + 20; - Orderdata.createdata.push(amount); - Orderdata.paydata.push(Math.floor(Math.random() * amount) + 1); - - //按自己需求可以取消这个限制 - if (Orderdata.column.length >= 20) { - //移除最开始的一条数据 - Orderdata.column.shift(); - Orderdata.paydata.shift(); - Orderdata.createdata.shift(); - } - myChart.setOption({ - xAxis: { - data: Orderdata.column - }, - series: [{ - name: __('Sales'), - data: Orderdata.paydata - }, - { - name: __('Orders'), - data: Orderdata.createdata - }] - }); - }, 2000); $(window).resize(function () { myChart.resize(); }); -- Gitee From cd37a9e7e491d65411941901bcfee641d9960548 Mon Sep 17 00:00:00 2001 From: Karson Date: Sat, 27 Mar 2021 23:03:59 +0800 Subject: [PATCH 19/21] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=8F=B3=E4=B8=8A=E8=A7=92=E5=9B=BE=E6=A0=87=E6=96=87=E5=AD=97?= =?UTF-8?q?=20=E4=BC=98=E5=8C=96=E6=9D=83=E9=99=90=E8=A7=84=E5=88=99?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/auth/Rule.php | 4 +- application/admin/view/common/header.html | 26 +++++--- public/assets/js/backend/auth/rule.js | 70 ++++++++++++---------- public/assets/js/backend/index.js | 2 +- 4 files changed, 61 insertions(+), 41 deletions(-) diff --git a/application/admin/controller/auth/Rule.php b/application/admin/controller/auth/Rule.php index 80f234253..e7939f095 100644 --- a/application/admin/controller/auth/Rule.php +++ b/application/admin/controller/auth/Rule.php @@ -31,7 +31,7 @@ class Rule extends Backend } $this->model = model('AuthRule'); // 必须将结果集转换为数组 - $ruleList = collection($this->model->field('condition,remark,createtime,updatetime', true)->order('weigh DESC,id ASC')->select())->toArray(); + $ruleList = \think\Db::name("auth_rule")->field('type,condition,remark,createtime,updatetime', true)->order('weigh DESC,id ASC')->select(); foreach ($ruleList as $k => &$v) { $v['title'] = __($v['title']); } @@ -44,6 +44,7 @@ class Rule extends Backend continue; } $ruledata[$v['id']] = $v['title']; + unset($v['spacer']); } unset($v); $this->view->assign('ruledata', $ruledata); @@ -57,7 +58,6 @@ class Rule extends Backend if ($this->request->isAjax()) { $list = $this->rulelist; $total = count($this->rulelist); - $result = array("total" => $total, "rows" => $list); return json($result); diff --git a/application/admin/view/common/header.html b/application/admin/view/common/header.html index 2835a8074..a0ca7d66b 100755 --- a/application/admin/view/common/header.html +++ b/application/admin/view/common/header.html @@ -24,21 +24,21 @@
        +
        + +
        + +
        +
        @@ -45,6 +51,18 @@
        +
        + +
        + {:build_radios('row[menutype]', $menutypeList)} +
        +
        +
        + +
        + +
        +
        @@ -65,4 +83,4 @@
        -{include file="auth/rule/tpl" /} \ No newline at end of file +{include file="auth/rule/tpl" /} diff --git a/application/admin/view/auth/rule/edit.html b/application/admin/view/auth/rule/edit.html index ba12a20ce..64ecd7238 100644 --- a/application/admin/view/auth/rule/edit.html +++ b/application/admin/view/auth/rule/edit.html @@ -24,6 +24,12 @@
        +
        + +
        + +
        +
        @@ -45,6 +51,18 @@
        +
        + +
        + {:build_radios('row[menutype]', $menutypeList, $row['menutype'])} +
        +
        +
        + +
        + +
        +
        @@ -65,4 +83,4 @@
        -{include file="auth/rule/tpl" /} \ No newline at end of file +{include file="auth/rule/tpl" /} diff --git a/extend/fast/Tree.php b/extend/fast/Tree.php index f874d0594..52f1cbb25 100644 --- a/extend/fast/Tree.php +++ b/extend/fast/Tree.php @@ -322,7 +322,7 @@ class Tree $childlist = strtr($childlist, array('@class' => $childdata ? 'last' : '')); $value = array( '@childlist' => $childlist, - '@url' => $childdata || !isset($value['@url']) ? "javascript:;" : url($value['@url']), + '@url' => $childdata || !isset($value['@url']) ? "javascript:;" : $value['@url'], '@addtabs' => $childdata || !isset($value['@url']) ? "" : (stripos($value['@url'], "?") !== false ? "&" : "?") . "ref=addtabs", '@caret' => ($childdata && (!isset($value['@badge']) || !$value['@badge']) ? '' : ''), '@badge' => isset($value['@badge']) ? $value['@badge'] : '', diff --git a/public/assets/js/backend/auth/rule.js b/public/assets/js/backend/auth/rule.js index ed412f1ec..de86f7ec4 100755 --- a/public/assets/js/backend/auth/rule.js +++ b/public/assets/js/backend/auth/rule.js @@ -163,7 +163,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function bindevent: function () { $(document).on('click', "input[name='row[ismenu]']", function () { var name = $("input[name='row[name]']"); - name.prop("placeholder", $(this).val() == 1 ? name.data("placeholder-menu") : name.data("placeholder-node")); + var ismenu = $(this).val() == 1; + name.prop("placeholder", ismenu ? name.data("placeholder-menu") : name.data("placeholder-node")); + $('div[data-type="menu"]').toggleClass("hidden", !ismenu); }); $("input[name='row[ismenu]']:checked").trigger("click"); diff --git a/public/assets/js/backend/index.js b/public/assets/js/backend/index.js index c24479abc..464d41b0e 100755 --- a/public/assets/js/backend/index.js +++ b/public/assets/js/backend/index.js @@ -73,7 +73,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi }); //清除缓存 - $(document).on('click', "ul.wipecache li a,.wipecache", function () { + $(document).on('click', "ul.wipecache li a,a.wipecache", function () { $.ajax({ url: 'ajax/wipecache', dataType: 'json', -- Gitee