fix(portal): 修复微官网在浏览器打开时的跨域与网络解析报错,支持默认名片平滑降级

这个提交包含在:
wikiboss
2026-09-21 10:17:47 +08:00
父节点 636bc99b41
当前提交 d909b08f4b
共有 7 个文件被更改,包括 112 次插入 和 7 次删除

查看文件

@@ -14,6 +14,11 @@ export default {
koa: {
port: availablePort(9000),
},
cors: {
origin: '*',
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
allowHeaders: ['Content-Type', 'Authorization', 'x-tenant-id', 'x-requested-with'],
},
// 开启异步上下文管理
asyncContextManager: {
enable: true,

查看文件

@@ -8,7 +8,7 @@ import {
MidwayWebRouterService,
} from '@midwayjs/core';
import * as koa from '@midwayjs/koa';
// import * as crossDomain from '@midwayjs/cross-domain';
import * as crossDomain from '@midwayjs/cross-domain';
import * as validate from '@midwayjs/validate';
import * as info from '@midwayjs/info';
import * as staticFile from '@midwayjs/static-file';
@@ -27,7 +27,7 @@ import { TenantMiddleware } from './comm/middleware/tenant';
// https://koajs.com/
koa,
// 是否开启跨域(注:顺序不能乱放!!!) http://www.midwayjs.org/docs/extensions/cross_domain
// crossDomain,
crossDomain,
// 静态文件托管 https://midwayjs.org/docs/extensions/static_file
staticFile,
// orm https://midwayjs.org/docs/extensions/orm

查看文件

@@ -88,6 +88,12 @@ export class CardPortalService extends BaseService {
card = await this.cardInfoEntity.findOne({
where: { slug: queryKey },
});
if (!card && queryKey.toLowerCase() === 'default') {
card = await this.cardInfoEntity.findOne({
where: { status: 'published' },
order: { id: 'ASC' },
});
}
}
// 3. 实体存在性与发布状态检查