refactor(app): appId wxapp-escort-admin 更名为 wxapp_companion

与陪诊师小程序工程名对齐;同步注册表、配置白名单、脚本示例与测试。数据库 user_app / user_identity / user.app 旧字段已同步迁移。
This commit is contained in:
lik
2026-11-10 16:33:35 +08:00
parent 5fabb6ba86
commit efd4e4444c
9 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ describe('用户接口集成测试', () => {
.send({ mobile: testMobile, passwd: testPasswd, appId });
const admin1 = await login('web-escort-admin');
const wx = await login('wxapp-escort-admin');
const wx = await login('wxapp_companion');
assert.equal(admin1.body.code, 0, admin1.body.msg);
assert.equal(wx.body.code, 0, wx.body.msg);
const admin1Token = admin1.body.data.user.security.token;
+1 -1
View File
@@ -53,7 +53,7 @@ describe('resolveConfig', () => {
});
it('兼容 Map 存储', () => {
const config = resolveConfig('wxapp-escort-admin', new Map([['pageSize', 50]]));
const config = resolveConfig('wxapp_companion', new Map([['pageSize', 50]]));
assert.equal(config.pageSize, 50);
assert.equal(config.soundAlert, true);
});
+1 -1
View File
@@ -23,7 +23,7 @@ describe('APP_REGISTRY', () => {
});
it('管理端应用与可授权角色配置正确', () => {
assert.ok(ADMIN_APP_IDS.includes('wxapp-escort-admin'));
assert.ok(ADMIN_APP_IDS.includes('wxapp_companion'));
assert.ok(ADMIN_APP_IDS.includes('web-escort-admin'));
assert.deepEqual(GRANTABLE_ROLES, ['user', 'admin']);
});
+2 -2
View File
@@ -6,7 +6,7 @@ import { APP } from '../app.js';
import { DBModel } from '../models/index.js';
import { hashToken } from '../utils/crypto.js';
const ADMIN_APP = 'wxapp-escort-admin';
const ADMIN_APP = 'wxapp_companion';
const WEB_ADMIN_APP = 'web-escort-admin';
const CONSUMER_APP = 'wxapp-escort';
@@ -135,7 +135,7 @@ describe('管理端权限', () => {
it('A 应用 user + B 应用 admin:按应用逐条判角色,必须放行', async () => {
// 典型画像:先登录小程序管理端(自动 ["user"]),后被授予 Web 后台 ["admin"]。
// wxapp-escort-admin 排序在 web-escort-admin 之前,只取第一条判角色会误拒。
// wxapp_companion 排序在 web-escort-admin 之前,只取第一条判角色会误拒。
const mixed = await createUser(nextMobile(), '混合角色管理员');
await addMembership(mixed.user._id, ADMIN_APP, ['user']);
await addMembership(mixed.user._id, WEB_ADMIN_APP, ['admin']);