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:
@@ -89,6 +89,12 @@ class Auth
|
||||
`create_at` int DEFAULT NULL,
|
||||
PRIMARY KEY (`id`), KEY `idx_sort` (`sort`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4");
|
||||
// 自愈:老表补 member_id 列(框架会员直通用)
|
||||
$prefix = Db::getConfig('prefix');
|
||||
$has = Db::query("SHOW COLUMNS FROM `{$prefix}mqttbroker_auth` LIKE 'member_id'");
|
||||
if (empty($has)) {
|
||||
Db::execute("ALTER TABLE `{$prefix}mqttbroker_auth` ADD `member_id` int unsigned NOT NULL DEFAULT '0' COMMENT '归属框架会员ID(会员直通回填)'");
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
}
|
||||
}
|
||||
@@ -120,7 +126,27 @@ class Auth
|
||||
}
|
||||
|
||||
if (!$acc) {
|
||||
// 无此账号:匿名开时视为普通匿名用户(用户名仅作标识),否则拒绝
|
||||
// 无此账号:尝试框架会员直通(仅当显式开启且禁止匿名,避免被匿名语义绕过)
|
||||
if (!$anonymous && !empty($this->config['allow_member_login'])) {
|
||||
$member = null;
|
||||
try {
|
||||
$member = Db::name('member_user')
|
||||
->where('account', $username)
|
||||
->where('status', 1)
|
||||
->field('id,password')
|
||||
->find();
|
||||
} catch (\Throwable $e) {
|
||||
$member = null;
|
||||
}
|
||||
// 会员密码使用 bcrypt 原生盐(详见 ywxapp\model\MemberUser),
|
||||
// 表无独立 salt 列,直接 verify 即可。
|
||||
if ($member && !empty($member['password'])
|
||||
&& password_verify((string) $password, $member['password'])) {
|
||||
$isSuper = !empty($this->config['member_is_superuser']);
|
||||
return ['ok' => true, 'superuser' => $isSuper, 'reason' => 'member', 'member_id' => $member['id']];
|
||||
}
|
||||
}
|
||||
// 匿名开时视为普通匿名用户(用户名仅作标识),否则拒绝
|
||||
return $anonymous
|
||||
? ['ok' => true, 'superuser' => false, 'reason' => 'anonymous-named']
|
||||
: ['ok' => false, 'superuser' => false, 'reason' => 'account not found'];
|
||||
@@ -170,7 +196,7 @@ class Auth
|
||||
continue;
|
||||
}
|
||||
$type = $r['target_type'];
|
||||
if ($type === 'member' && $r['target'] !== $username) {
|
||||
if ($type === 'user' && $r['target'] !== $username) {
|
||||
continue;
|
||||
}
|
||||
if ($type === 'client' && $r['target'] !== $clientId) {
|
||||
|
||||
Reference in New Issue
Block a user