fix: update

This commit is contained in:
xiongxiao
2026-01-13 17:26:38 +08:00
parent cedf3236b0
commit d86f4dc48f
5 changed files with 16 additions and 7 deletions

View File

@@ -1,8 +1,15 @@
import { app, appId } from '@/agent/app.ts';
import { app, appId } from '../app.ts';
import './user/check.ts'
import { isEqual } from 'es-toolkit'
/**
* 验证上下文中的 App ID 是否与指定的 App ID 匹配
* @param {any} ctx - 上下文对象,可能包含 appId 属性
* @param {string} appId - 需要验证的目标 App ID
* @returns {boolean} 如果 ctx 中包含 appId 且匹配则返回 true否则返回 false
* @throws {Error} 如果 ctx 中包含 appId 但不匹配,则抛出 403 错误
*/
const checkAppId = (ctx: any, appId: string) => {
const _appId = ctx?.appId;
const _appId = ctx?.app?.appId;
if (_appId) {
if (_appId !== appId) {
ctx.throw(403, 'Invalid App ID');