feat: 新增交通银行数据导出插件及测试通道机制
This commit is contained in:
@@ -56,20 +56,33 @@ export class ApiPluginsController extends BaseController {
|
||||
.select([
|
||||
'p.id AS id',
|
||||
'p.name AS name',
|
||||
'p.latestVersion AS version',
|
||||
'p.latestVersion AS latestVersion',
|
||||
'p.testVersion AS testVersion',
|
||||
'p.status AS status',
|
||||
'p.category AS category',
|
||||
])
|
||||
// revoked=下架:不下发,执行机会按白名单清理;disabled=停用:仍下发但版本留空(不拉新、本地保留)
|
||||
.where('ap.account = :account', { account: acct })
|
||||
.andWhere("p.status <> 'revoked'")
|
||||
.orderBy('p.id', 'ASC')
|
||||
.getRawMany();
|
||||
// 测试通道:status=testing 且账号是管理员 → 取在测版本;其他账号继续用正式版(业务不中断)
|
||||
const isAdmin = await this.centerAuthService.accountIsAdmin(acct);
|
||||
return {
|
||||
account: acct,
|
||||
plugins: rows.map(r => ({
|
||||
id: r.id,
|
||||
name: r.name,
|
||||
version: r.version,
|
||||
category: r.category || '',
|
||||
})),
|
||||
plugins: rows.map(r => {
|
||||
const testVer = String(r.testVersion || '').trim();
|
||||
const disabled = r.status === 'disabled';
|
||||
const useTest = !disabled && isAdmin && r.status === 'testing' && !!testVer;
|
||||
return {
|
||||
id: r.id,
|
||||
name: r.name,
|
||||
version: disabled ? '' : (useTest ? testVer : String(r.latestVersion || '')),
|
||||
category: r.category || '',
|
||||
status: r.status,
|
||||
channel: useTest ? 'test' : 'prod',
|
||||
};
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user