调整模块管理

This commit is contained in:
Anyon 2020-08-17 15:33:06 +08:00
parent 1351771e46
commit 5d523feaa5
17 changed files with 1674 additions and 39 deletions

View File

@ -0,0 +1,2 @@
# 系统模块初始化成功
* 这次更新了许多内容哦

View File

@ -13,20 +13,9 @@
// | github 代码仓库https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
// 模块配置文件
return [
'name' => 'admin',
'author' => 'Anyon',
'version' => '2020.08.05.00',
'version' => '2020.08.03.00',
'content' => 'ThinkAdmin 系统基础模块',
'changes' => [
'2020.08.05.00' => [
'content' => '优化系统模块管理',
'database' => ['select version()'],
],
'2020.08.03.00' => [
'content' => '系统模块初始化提交',
'database' => ['select version()'],
],
],
];

View File

@ -0,0 +1,2 @@
# 微信模块初始化成功
* 这次更新了许多内容哦

View File

@ -0,0 +1,131 @@
-- ----------------------------
-- Table structure for wechat_fans
-- ----------------------------
DROP TABLE IF EXISTS `_PREFIX_wechat_fans`;
CREATE TABLE `_PREFIX_wechat_fans` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`appid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '公众号APPID',
`unionid` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '粉丝unionid',
`openid` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '粉丝openid',
`tagid_list` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '粉丝标签id',
`is_black` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '是否为黑名单状态',
`subscribe` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '关注状态(0未关注,1已关注)',
`nickname` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户昵称',
`sex` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '用户性别(1男性,2女性,0未知)',
`country` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户所在国家',
`province` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户所在省份',
`city` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户所在城市',
`language` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户的语言(zh_CN)',
`headimgurl` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户头像',
`subscribe_time` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '关注时间',
`subscribe_at` datetime NULL DEFAULT NULL COMMENT '关注时间',
`remark` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '备注',
`subscribe_scene` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '扫码关注场景',
`qr_scene` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '二维码场景值',
`qr_scene_str` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '二维码场景内容',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `index_wechat_fans_openid`(`openid`) USING BTREE,
INDEX `index_wechat_fans_unionid`(`unionid`) USING BTREE,
INDEX `index_wechat_fans_is_back`(`is_black`) USING BTREE,
INDEX `index_wechat_fans_subscribe`(`subscribe`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-粉丝';
-- ----------------------------
-- Table structure for wechat_fans_tags
-- ----------------------------
DROP TABLE IF EXISTS `_PREFIX_wechat_fans_tags`;
CREATE TABLE `_PREFIX_wechat_fans_tags` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '标签ID',
`appid` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '公众号APPID',
`name` varchar(35) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标签名称',
`count` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '总数',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
INDEX `index_wechat_fans_tags_id`(`id`) USING BTREE,
INDEX `index_wechat_fans_tags_appid`(`appid`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-标签';
-- ----------------------------
-- Table structure for wechat_keys
-- ----------------------------
DROP TABLE IF EXISTS `_PREFIX_wechat_keys`;
CREATE TABLE `_PREFIX_wechat_keys` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`appid` char(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '公众号APPID',
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '类型(text,image,news)',
`keys` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '关键字',
`content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '文本内容',
`image_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '图片链接',
`voice_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '语音链接',
`music_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '音乐标题',
`music_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '音乐链接',
`music_image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '缩略图片',
`music_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '音乐描述',
`video_title` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '视频标题',
`video_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '视频URL',
`video_desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '视频描述',
`news_id` bigint(20) UNSIGNED NULL DEFAULT NULL COMMENT '图文ID',
`sort` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '排序字段',
`status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '状态(0禁用,1启用)',
`create_by` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '创建人',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `index_wechat_keys_appid`(`appid`) USING BTREE,
INDEX `index_wechat_keys_type`(`type`) USING BTREE,
INDEX `index_wechat_keys_keys`(`keys`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-关键字';
-- ----------------------------
-- Table structure for wechat_media
-- ----------------------------
DROP TABLE IF EXISTS `_PREFIX_wechat_media`;
CREATE TABLE `_PREFIX_wechat_media` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`appid` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '公众号ID',
`md5` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文件md5',
`type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '媒体类型',
`media_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '永久素材MediaID',
`local_url` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '本地文件链接',
`media_url` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '远程图片链接',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `index_wechat_media_appid`(`appid`) USING BTREE,
INDEX `index_wechat_media_md5`(`md5`) USING BTREE,
INDEX `index_wechat_media_type`(`type`) USING BTREE,
INDEX `index_wechat_media_media_id`(`media_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-素材';
-- ----------------------------
-- Table structure for wechat_news
-- ----------------------------
DROP TABLE IF EXISTS `_PREFIX_wechat_news`;
CREATE TABLE `_PREFIX_wechat_news` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`media_id` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '永久素材MediaID',
`local_url` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '永久素材外网URL',
`article_id` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '关联图文ID(用英文逗号做分割)',
`is_deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态(0未删除,1已删除)',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建人',
PRIMARY KEY (`id`) USING BTREE,
INDEX `index_wechat_news_artcle_id`(`article_id`) USING BTREE,
INDEX `index_wechat_news_media_id`(`media_id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-图文';
-- ----------------------------
-- Table structure for wechat_news_article
-- ----------------------------
DROP TABLE IF EXISTS `_PREFIX_wechat_news_article`;
CREATE TABLE `_PREFIX_wechat_news_article` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '素材标题',
`local_url` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '永久素材显示URL',
`show_cover_pic` tinyint(4) UNSIGNED NULL DEFAULT 0 COMMENT '显示封面(0不显示,1显示)',
`author` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '文章作者',
`digest` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '摘要内容',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '图文内容',
`content_source_url` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '原文地址',
`read_num` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '阅读数量',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '微信-文章';

View File

@ -0,0 +1,6 @@
DROP TABLE IF EXISTS `_PREFIX_wechat_fans`;
DROP TABLE IF EXISTS `_PREFIX_wechat_fans_tags`;
DROP TABLE IF EXISTS `_PREFIX_wechat_keys`;
DROP TABLE IF EXISTS `_PREFIX_wechat_media`;
DROP TABLE IF EXISTS `_PREFIX_wechat_news`;
DROP TABLE IF EXISTS `_PREFIX_wechat_news_article`;

View File

@ -0,0 +1 @@
<?php

View File

@ -13,18 +13,9 @@
// | github 代码仓库https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
// 模块配置文件
return [
'name' => 'wechat',
'author' => 'Anyon',
'version' => '2020.08.03.01',
'content' => 'ThinkAdmin 微信基础模块',
'changes' => [
'2020.08.03.00' => [
'content' => '模块初始化提交',
'database' => [
'select version()',
],
],
],
];

9
composer.lock generated
View File

@ -937,12 +937,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "08aff82bffe0e4b6356373c65ddf7c2d521598a5"
"reference": "822d461c4f23e5ab3cd3489cd740a7171706e367"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/08aff82bffe0e4b6356373c65ddf7c2d521598a5",
"reference": "08aff82bffe0e4b6356373c65ddf7c2d521598a5",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/822d461c4f23e5ab3cd3489cd740a7171706e367",
"reference": "822d461c4f23e5ab3cd3489cd740a7171706e367",
"shasum": "",
"mirrors": [
{
@ -956,6 +956,7 @@
"ext-gd": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-mbstring": "*",
"topthink/framework": "^6.0"
},
"type": "library",
@ -986,7 +987,7 @@
],
"description": "ThinkPHP v6.0 Development Library",
"homepage": "http://thinkadmin.top",
"time": "2020-08-14T09:41:49+00:00"
"time": "2020-08-17T07:02:36+00:00"
},
{
"name": "zoujingli/wechat-developer",

View File

@ -28,7 +28,7 @@ return [
// 数据库类型
'type' => 'mysql',
// 服务器地址
'hostname' => '127.0.0.1',
'hostname' => 'server.cuci.cc',
// 数据库名
'database' => 'admin_v6',
// 用户名

View File

@ -298,6 +298,7 @@ return array(
'think\\admin\\service\\CaptchaService' => $vendorDir . '/zoujingli/think-library/src/service/CaptchaService.php',
'think\\admin\\service\\ExpressService' => $vendorDir . '/zoujingli/think-library/src/service/ExpressService.php',
'think\\admin\\service\\InstallService' => $vendorDir . '/zoujingli/think-library/src/service/InstallService.php',
'think\\admin\\service\\MarkdownService' => $vendorDir . '/zoujingli/think-library/src/service/MarkdownService.php',
'think\\admin\\service\\MenuService' => $vendorDir . '/zoujingli/think-library/src/service/MenuService.php',
'think\\admin\\service\\MessageService' => $vendorDir . '/zoujingli/think-library/src/service/MessageService.php',
'think\\admin\\service\\ModuleService' => $vendorDir . '/zoujingli/think-library/src/service/ModuleService.php',

View File

@ -431,6 +431,7 @@ class ComposerStaticInitb911c14a0826c73d9f097343fd33a252
'think\\admin\\service\\CaptchaService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/CaptchaService.php',
'think\\admin\\service\\ExpressService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ExpressService.php',
'think\\admin\\service\\InstallService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/InstallService.php',
'think\\admin\\service\\MarkdownService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MarkdownService.php',
'think\\admin\\service\\MenuService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MenuService.php',
'think\\admin\\service\\MessageService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MessageService.php',
'think\\admin\\service\\ModuleService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ModuleService.php',

View File

@ -963,12 +963,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "08aff82bffe0e4b6356373c65ddf7c2d521598a5"
"reference": "822d461c4f23e5ab3cd3489cd740a7171706e367"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/08aff82bffe0e4b6356373c65ddf7c2d521598a5",
"reference": "08aff82bffe0e4b6356373c65ddf7c2d521598a5",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/822d461c4f23e5ab3cd3489cd740a7171706e367",
"reference": "822d461c4f23e5ab3cd3489cd740a7171706e367",
"shasum": "",
"mirrors": [
{
@ -982,9 +982,10 @@
"ext-gd": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-mbstring": "*",
"topthink/framework": "^6.0"
},
"time": "2020-08-14T09:41:49+00:00",
"time": "2020-08-17T07:02:36+00:00",
"type": "library",
"extra": {
"think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2020-08-17 10:22:34
// This file is automatically generated at:2020-08-17 15:04:49
declare (strict_types = 1);
return array (
0 => 'think\\admin\\Library',

View File

@ -15,6 +15,7 @@
"ext-curl": "*",
"ext-json": "*",
"ext-iconv": "*",
"ext-mbstring": "*",
"topthink/framework": "^6.0"
},
"autoload": {

View File

@ -94,7 +94,7 @@ class Queue extends Command
$host = $this->input->getOption('host') ?: '127.0.0.1';
$root = $this->app->getRootPath() . 'public' . DIRECTORY_SEPARATOR;
$command = "php -S {$host}:{$port} -t {$root} {$root}router.php";
$this->output->highlight("># {$command}");
$this->output->comment("># {$command}");
if (count($result = $this->process->query($command)) > 0) {
if ($this->process->iswin()) $this->process->exec("start http://{$host}:{$port}");
$this->output->writeln(">> WebServer process already exist for pid {$result[0]['pid']}");
@ -116,7 +116,7 @@ class Queue extends Command
{
$root = $this->app->getRootPath() . 'public' . DIRECTORY_SEPARATOR;
if (count($result = $this->process->query("-t {$root} {$root}router.php")) > 0) {
$this->output->highlight("># {$result[0]['cmd']}");
$this->output->comment("># {$result[0]['cmd']}");
$this->output->writeln(">> WebServer process {$result[0]['pid']} running");
} else {
$this->output->writeln(">> The WebServer process is not running");
@ -144,7 +144,7 @@ class Queue extends Command
{
$this->app->db->name($this->table)->count();
$command = $this->process->think('xadmin:queue listen');
$this->output->highlight("># {$command}");
$this->output->comment("># {$command}");
if (count($result = $this->process->query($command)) > 0) {
$this->output->writeln(">> Asynchronous daemons already exist for pid {$result[0]['pid']}");
} else {
@ -234,7 +234,7 @@ class Queue extends Command
[$start, $where] = [microtime(true), [['status', '=', 1], ['exec_time', '<=', time()]]];
foreach ($this->app->db->name($this->table)->where($where)->order('exec_time asc')->select()->toArray() as $vo) try {
$command = $this->process->think("xadmin:queue dorun {$vo['code']} -");
$this->output->highlight("># {$command}");
$this->output->comment("># {$command}");
if (count($this->process->query($command)) > 0) {
$this->output->writeln(">> Already in progress -> [{$vo['code']}] {$vo['title']}");
} else {

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,7 @@
namespace think\admin\service;
use think\admin\extend\HttpExtend;
use think\admin\extend\Parsedown;
use think\admin\Service;
/**
@ -104,9 +105,12 @@ class ModuleService extends Service
public function getModules(array $data = []): array
{
foreach (NodeService::instance()->getModules() as $name) {
if (is_array($version = $this->getModuleVersion($name))) {
if (preg_match('|^\d{4}\.\d{2}\.\d{2}\.\d{2}$|', $version['version'])) {
$data[$name] = $version;
if (is_array($vars = $this->getModuleVersion($name)) && isset($vars['version'])) {
if (preg_match('|^\d{4}\.\d{2}\.\d{2}\.\d{2}$|', $vars['version'])) {
$data[$name] = $vars;
foreach (glob("{$this->app->getBasePath()}{$name}/module/change/*.md") as $file) {
$data[$name]['change'][pathinfo($file, PATHINFO_FILENAME)] = Parsedown::instance()->parse(file_get_contents($file));
}
}
}
}
@ -153,7 +157,7 @@ class ModuleService extends Service
*/
private function getModuleVersion($name)
{
$file = $this->app->getBasePath() . $name . DIRECTORY_SEPARATOR . 'ver.php';
$file = "{$this->app->getBasePath()}{$name}/module/version.php";
if (file_exists($file) && is_file($file) && is_array($vars = @include $file)) {
return isset($vars['name']) && isset($vars['version']) ? $vars : null;
} else {