chore: 重写初始提交(清空历史,整理后全量提交)

This commit is contained in:
ywxapp
2026-08-16 16:54:14 +08:00
commit 6c1a106bc1
1808 changed files with 238144 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
-- ============================================================
-- 远程服务器修复整合 SQL
-- 适用:ywxapp 线上库(前缀示例 wxapp_,请按实际替换)
-- 背景:
-- 1) 自愈引擎因线上 Db::getConfig('prefix') 取空,把 wxapp_notice 建成了无前缀 notice 表,
-- 导致 SELECT wxapp_notice 报 1146。已修复代码改用 BaseModel::currentPrefix()
-- 但线上已误建的表需要手动清理并重建。
-- 2) install.sql 种子未含后台「营运」菜单,需补充插入。
-- 用法:
-- ① 把本文件所有 `wxapp_` 替换成你线上实际表前缀(如保持不变则直接执行)。
-- ② 一次性执行全部语句(含清理旧表 + 建正确表 + 插菜单)。
-- ============================================================
-- ---------- 1. 修复 wxapp_notice 表 ----------
-- 1.1 清理自愈误建的无前缀表(若存在)
DROP TABLE IF EXISTS `notice`;
-- 1.2 重建正确前缀的表
CREATE TABLE IF NOT EXISTS `wxapp_notice` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL DEFAULT '' COMMENT '公告标题',
`content` text COMMENT '公告内容',
`author` varchar(50) NOT NULL DEFAULT '' COMMENT '发布人',
`type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '类型 1系统维护 2活动公告 3版本更新 4其他',
`is_top` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否置顶 0否 1是',
`start_time` int(11) NOT NULL DEFAULT 0 COMMENT '展示开始时间 0=长期',
`end_time` int(11) NOT NULL DEFAULT 0 COMMENT '展示结束时间 0=长期',
`view_count` int(11) NOT NULL DEFAULT 0 COMMENT '浏览量',
`sort` int(11) NOT NULL DEFAULT 0 COMMENT '排序',
`status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '状态 0禁用 1启用',
`create_at` int(11) NOT NULL DEFAULT 0 COMMENT '创建时间',
`update_at` int(11) NOT NULL DEFAULT 0 COMMENT '更新时间',
`delete_at` int(11) NOT NULL DEFAULT 0 COMMENT '删除时间',
PRIMARY KEY (`id`),
KEY `idx_type` (`type`),
KEY `idx_is_top` (`is_top`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='站点公告';
-- ---------- 2. 补充后台「营运」菜单 ----------
-- 2.1 若线上已存在同名菜单,先清理(避免 Duplicate entry
DELETE FROM `wxapp_backend_power` WHERE `name` IN ('operate','links:index','notice:index','ad:index','task:index','prop:index','medal:index','sms:index','help:index','shop:index','card:index','score:index');
-- 2.2 营运(顶级目录)
INSERT INTO `wxapp_backend_power`
(`pid`, `title`, `name`, `type`, `route`, `icon`, `sort`, `addon`, `status`, `create_at`, `update_at`, `delete_at`)
VALUES
(0, '营运', 'operate', 1, '/operate', 'layui-icon layui-icon-engine', 4, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0);
SET @operate_id = LAST_INSERT_ID();
-- 2.3 营运下子菜单
INSERT INTO `wxapp_backend_power`
(`pid`, `title`, `name`, `type`, `route`, `icon`, `sort`, `addon`, `status`, `create_at`, `update_at`, `delete_at`)
VALUES
(@operate_id, '友情链接', 'links:index', 2, 'links/index', '', 0, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '站点公告', 'notice:index', 2, 'notice/index', '', 1, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '站点广告', 'ad:index', 2, 'ad/index', '', 2, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '站点任务', 'task:index', 2, 'task/index', '', 3, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '道具中心', 'prop:index', 2, 'prop/index', '', 4, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '勋章中心', 'medal:index', 2, 'medal/index', '', 5, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '短信服务', 'sms:index', 2, 'sms/index', '', 6, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '站点帮助', 'help:index', 2, 'help/index', '', 7, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '电子商务', 'shop:index', 2, 'shop/index', '', 8, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '充值卡密', 'card:index', 2, 'card/index', '', 10, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0),
(@operate_id, '积分规则', 'score:index', 2, 'score/index', '', 11, NULL, 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 0);