feat: 公共表更名 common/member 前缀 + 插件命令自动加载 + 版本 1.1.1
- 18 张公共表更名(addon/attachment/configure/links/spider_log/spider_stat/sms/notice/ad/task/prop/medal/help/card -> common_*,member_wallets->member_wallet,score_rule/score_log -> member_*,addon_config->common_addonconf),模型全部对齐新表名,Db 直引用清零 - Attachment 模型补 表名绑定,修复富文本上传查 wxapp_attachment 1146 隐患 - install.sql + 迁移 SQL:backend_admin/backend_role delete_at 默认 0,修复软删除(NULL != 0)误过滤导致后台菜单为空 - AppService::boot() 支持插件 info.php 声明 commands 自动注册插件命令(psr-4 自动加载,坏类名自动跳过) - 各插件(haonav/mqttbroker/wxchat/articles/blog/forum 等)字段与配置同步调整 - 框架版本 1.1.0 -> 1.1.1
This commit is contained in:
@@ -7,7 +7,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Ad as AdModel;
|
||||
use ywxapp\model\CommonAd as AdModel;
|
||||
use app\backend\validate\Ad as AdValidate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,7 @@ class Card extends BackendBase
|
||||
$uids = array_filter(array_column($items, 'uid'));
|
||||
$users = [];
|
||||
if (!empty($uids)) {
|
||||
$users = Db::name('member')->whereIn('uid', array_unique($uids))
|
||||
$users = Db::name('member_user')->whereIn('uid', array_unique($uids))
|
||||
->column('nickname,username', 'uid');
|
||||
}
|
||||
foreach ($items as &$row) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* @Author: YwxApp <ywx@ywxapp.cn>
|
||||
* @Date: 2026-04-29 02:32:33
|
||||
* @LastEditors: YwxApp <ywx@ywxapp.cn>
|
||||
* @LastEditTime: 2026-08-03 13:32:15
|
||||
* @LastEditTime: 2026-08-19 22:05:03
|
||||
* @Description:
|
||||
* @FilePath: \ywxapp_dev\app\backend\controller\Configure.php
|
||||
* @CustomString: Copyright (c) 2026 YwxApp
|
||||
@@ -14,7 +14,7 @@ namespace app\backend\controller;
|
||||
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
use ywxapp\model\Configure as ConfigureModel;
|
||||
use ywxapp\model\CommonConfigure as ConfigureModel;
|
||||
use think\facade\Db;
|
||||
use think\facade\Cache;
|
||||
use ywxapp\controller\BackendBase;
|
||||
|
||||
@@ -64,10 +64,10 @@ class Console extends BackendBase
|
||||
public function hotsearch()
|
||||
{
|
||||
$admin = Db::name('backend_admin')->count();
|
||||
$user = Db::name('member')->count();
|
||||
$user = Db::name('member_user')->count();
|
||||
$article = Db::name('articles_article')->count();
|
||||
$links = Db::name('links')->count();
|
||||
$addon = Db::name('addon')->count();
|
||||
$links = Db::name('common_links')->count();
|
||||
$addon = Db::name('common_addon')->count();
|
||||
$data = [
|
||||
['keywords' => '管理员', 'frequency' => $admin, 'userNums' => $admin],
|
||||
['keywords' => '会员', 'frequency' => $user, 'userNums' => $user],
|
||||
|
||||
@@ -1,14 +1,21 @@
|
||||
<?php
|
||||
/*
|
||||
* @Author: YwxApp <ywx@ywxapp.cn>
|
||||
* @Date: 2026-08-07 09:44:40
|
||||
* @LastEditors: YwxApp <ywx@ywxapp.cn>
|
||||
* @LastEditTime: 2026-08-19 22:06:38
|
||||
* @Description:
|
||||
* @FilePath: \ywxapp_dev\app\backend\controller\Help.php
|
||||
* @CustomString: Copyright (c) 2026 YwxApp
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace app\backend\controller;
|
||||
|
||||
use think\Request;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\BaseModel;
|
||||
use ywxapp\model\Help as HelpModel;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\CommonHelp as HelpModel;
|
||||
use app\backend\validate\Help as HelpValidate;
|
||||
|
||||
/**
|
||||
@@ -22,7 +29,7 @@ class Help extends BackendBase
|
||||
protected function initialize()
|
||||
{
|
||||
// 运行时自愈 help 表结构(category / view_count 等扩展列)
|
||||
\ywxapp\model\Help::ensureSchema();
|
||||
\ywxapp\model\CommonHelp::ensureSchema();
|
||||
$this->model = new HelpModel();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Links as LinksModel;
|
||||
use ywxapp\model\CommonLinks as LinksModel;
|
||||
use app\backend\validate\Links as LinksValidate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Medal as MedalModel;
|
||||
use ywxapp\model\CommonMedal as MedalModel;
|
||||
use app\backend\validate\Medal as MedalValidate;
|
||||
|
||||
/**
|
||||
@@ -173,7 +173,7 @@ class Medal extends BackendBase
|
||||
$this->result->error('请选择勋章');
|
||||
}
|
||||
// 校验用户存在
|
||||
$user = Db::name('member')->where('uid', $uid)->find();
|
||||
$user = Db::name('member_user')->where('uid', $uid)->find();
|
||||
if (! $user) {
|
||||
$this->result->error('用户不存在');
|
||||
}
|
||||
|
||||
@@ -10,9 +10,10 @@ declare (strict_types = 1);
|
||||
|
||||
namespace app\backend\controller;
|
||||
|
||||
use think\facade\Cache;
|
||||
use think\facade\Request;
|
||||
use think\facade\View;
|
||||
use app\backend\model\NavMenu;
|
||||
use ywxapp\model\CommonNavMenu as NavMenu;
|
||||
use ywxapp\controller\BackendBase;
|
||||
|
||||
/**
|
||||
@@ -30,12 +31,56 @@ class Navbar extends BackendBase
|
||||
public function index()
|
||||
{
|
||||
if (Request::isAjax()) {
|
||||
$list = NavMenu::getAdminTree();
|
||||
return json(['code' => 0, 'msg' => 'ok', 'data' => $list, 'count' => count($list)]);
|
||||
$title = trim((string) Request::param('title', ''));
|
||||
$rows = NavMenu::getAdminTree($title);
|
||||
// 拍平成 treeTable isSimpleData 所需的扁平 pid 列表(treeTable 用 pid 自动建树)
|
||||
$flat = [];
|
||||
foreach ($rows as $p) {
|
||||
$p['pid'] = (int) $p['parent_id'];
|
||||
$flat[] = $p;
|
||||
foreach (($p['child'] ?? []) as $c) {
|
||||
$c['pid'] = (int) $c['parent_id'];
|
||||
$flat[] = $c;
|
||||
}
|
||||
}
|
||||
foreach ($flat as &$row) {
|
||||
unset($row['child']);
|
||||
}
|
||||
return json(['code' => 0, 'msg' => 'ok', 'data' => $flat, 'count' => count($flat)]);
|
||||
}
|
||||
// 已启用插件列表:导航「所属应用」可选插件(插件页面同样支持绑定域名)
|
||||
View::assign('plugins', $this->enabledPlugins());
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已启用插件名列表.
|
||||
*/
|
||||
private function enabledPlugins(): array
|
||||
{
|
||||
$raw = Cache::get('addon_loaded_config');
|
||||
if (! is_array($raw) || empty($raw)) {
|
||||
$addonDir = root_path() . 'addon' . DIRECTORY_SEPARATOR;
|
||||
$raw = [];
|
||||
if (is_dir($addonDir)) {
|
||||
foreach (array_diff(scandir($addonDir), ['.', '..']) as $dir) {
|
||||
$info = @include $addonDir . $dir . DIRECTORY_SEPARATOR . 'info.php';
|
||||
if (is_array($info)) {
|
||||
$raw[$dir] = $info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$plugins = [];
|
||||
foreach ($raw as $info) {
|
||||
if (! empty($info['state']) && ! empty($info['name'])) {
|
||||
$plugins[] = (string) $info['name'];
|
||||
}
|
||||
}
|
||||
sort($plugins);
|
||||
return $plugins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加/编辑页(页面式,复用 edit.html).
|
||||
*/
|
||||
@@ -47,6 +92,7 @@ class Navbar extends BackendBase
|
||||
'parent_id' => (int) Request::post('parent_id', 0),
|
||||
'title' => trim((string) Request::post('title', '')),
|
||||
'url' => trim((string) Request::post('url', '')),
|
||||
'app' => trim((string) Request::post('app', '')),
|
||||
'icon' => trim((string) Request::post('icon', '')),
|
||||
'sort' => (int) Request::post('sort', 0),
|
||||
'status' => (int) Request::post('status', 1),
|
||||
@@ -86,6 +132,7 @@ class Navbar extends BackendBase
|
||||
'parent_id' => (int) Request::post('parent_id', 0),
|
||||
'title' => trim((string) Request::post('title', '')),
|
||||
'url' => trim((string) Request::post('url', '')),
|
||||
'app' => trim((string) Request::post('app', '')),
|
||||
'icon' => trim((string) Request::post('icon', '')),
|
||||
'sort' => (int) Request::post('sort', 0),
|
||||
'status' => (int) Request::post('status', 1),
|
||||
@@ -114,19 +161,25 @@ class Navbar extends BackendBase
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除(支持单 id;有子项时拒绝,避免孤儿).
|
||||
* 删除(支持单 id 或批量 ids 逗号分隔;有子项时拒绝,避免孤儿).
|
||||
*/
|
||||
public function delete($id = 0)
|
||||
{
|
||||
$id = $id ?: (int) Request::post('id', 0);
|
||||
if (! $id) {
|
||||
$ids = Request::post('ids', '');
|
||||
if ($ids !== '' && $ids !== null) {
|
||||
$ids = array_values(array_unique(array_filter(array_map('intval', explode(',', (string) $ids)))));
|
||||
} else {
|
||||
$id = $id ?: (int) Request::post('id', 0);
|
||||
$ids = $id ? [$id] : [];
|
||||
}
|
||||
if (empty($ids)) {
|
||||
return json(['code' => 1, 'msg' => '请选择要删除的项']);
|
||||
}
|
||||
$hasChild = NavMenu::where('parent_id', $id)->where('delete_at', 0)->count();
|
||||
$hasChild = NavMenu::where('parent_id', 'in', $ids)->where('delete_at', 0)->count();
|
||||
if ($hasChild) {
|
||||
return json(['code' => 1, 'msg' => '请先删除该菜单下的子项']);
|
||||
return json(['code' => 1, 'msg' => '请先删除所选菜单下的子项']);
|
||||
}
|
||||
NavMenu::destroy($id);
|
||||
NavMenu::destroy($ids);
|
||||
return json(['code' => 0, 'msg' => '已删除']);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Notice as NoticeModel;
|
||||
use app\backend\validate\Notice as NoticeValidate;
|
||||
use app\backend\validate\CommonNotice as NoticeValidate;
|
||||
|
||||
/**
|
||||
* 站点公告管理
|
||||
|
||||
@@ -7,7 +7,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Prop as PropModel;
|
||||
use ywxapp\model\CommonProp as PropModel;
|
||||
use app\backend\validate\Prop as PropValidate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Score as ScoreModel;
|
||||
use ywxapp\model\MebmberScore as ScoreModel;
|
||||
use app\backend\validate\Score as ScoreValidate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Shop as ShopModel;
|
||||
use ywxapp\model\CommonShop as ShopModel;
|
||||
use app\backend\validate\Shop as ShopValidate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Sms as SmsModel;
|
||||
use ywxapp\model\CommonSms as SmsModel;
|
||||
use app\backend\validate\Sms as SmsValidate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ class Spider extends BackendBase
|
||||
$url = $this->request->param('url', '');
|
||||
$date = $this->request->param('date', ''); // YYYY-MM-DD
|
||||
|
||||
$query = Db::name('spider_log');
|
||||
$query = Db::name('common_spider_log');
|
||||
if ($spider !== '') {
|
||||
$query->where('spider', $spider);
|
||||
}
|
||||
@@ -88,11 +88,11 @@ class Spider extends BackendBase
|
||||
$trend = ['dates' => [], 'series' => []];
|
||||
|
||||
try {
|
||||
$rows = Db::name('spider_stat')
|
||||
$rows = Db::name('common_spider_stat')
|
||||
->where('stat_date', '>=', $d30)
|
||||
->select()
|
||||
->toArray();
|
||||
$totalRows = Db::name('spider_stat')
|
||||
$totalRows = Db::name('common_spider_stat')
|
||||
->field('spider, SUM(`count`) AS total')
|
||||
->group('spider')
|
||||
->select()
|
||||
@@ -163,7 +163,7 @@ class Spider extends BackendBase
|
||||
$days = $this->request->param('days/d', 30);
|
||||
$days = max(1, min(365, $days));
|
||||
try {
|
||||
$count = Db::name('spider_log')
|
||||
$count = Db::name('common_spider_log')
|
||||
->where('create_at', '<', time() - $days * 86400)
|
||||
->delete();
|
||||
$this->result->success('', "已清理 {$count} 条 {$days} 天前的明细日志");
|
||||
|
||||
@@ -7,8 +7,8 @@ use think\facade\Db;
|
||||
use think\db\exception\DbException;
|
||||
use think\exception\ValidateException;
|
||||
use ywxapp\controller\BackendBase;
|
||||
use ywxapp\model\Task as TaskModel;
|
||||
use ywxapp\model\Prop as PropModel;
|
||||
use ywxapp\model\CommonTask as TaskModel;
|
||||
use ywxapp\model\CommonProp as PropModel;
|
||||
use app\backend\validate\Task as TaskValidate;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user