fix: 修复模板页面跳转并移除无入口的下单页
新增运行时 openPage/takePageQuery,tabBar 页自动使用 switchTab 并传递参数 - 编译器写入 tabPages,并拒绝 navigateTo/redirectTo 到 tabBar 页或 switchTab 带参数 - 阿成首页、套餐、出摊、主理人、详情、记录、成功页跳转统一改用 openPage - 套餐筛选改用后台业务提供项分类;详情跳咨询时携带业务提供项 - 移除 capability-booking:小程序无入口且依赖已删除的 /public/brand,需求由咨询表单覆盖"
This commit is contained in:
1 parent
a97cc860cf
commit
55989a5dfe
29 files changed
+353
-119
No files matched your search
+10
-1
@@ -23,6 +23,15 @@ export class RequestIdMiddleware {
|
||||
}
|
||||
}
|
||||
|
||||
/** HttpException.getResponse() 可能是字符串,或 { message: string | string[] }(含 ValidationPipe 错误)。 */
|
||||
function readMessage(detail: unknown): string {
|
||||
if (typeof detail === "string") return detail;
|
||||
const message = (detail as { message?: unknown } | null)?.message;
|
||||
if (typeof message === "string" && message) return message;
|
||||
if (Array.isArray(message) && message.length) return message.map(String).join(";");
|
||||
return "请求失败";
|
||||
}
|
||||
|
||||
@Catch()
|
||||
export class ApiExceptionFilter implements ExceptionFilter {
|
||||
catch(exception: unknown, host: ArgumentsHost): void {
|
||||
@@ -41,7 +50,7 @@ export class ApiExceptionFilter implements ExceptionFilter {
|
||||
data: null,
|
||||
error: {
|
||||
code: `HTTP_${status}`,
|
||||
message: typeof detail === "string" ? detail : "请求失败",
|
||||
message: readMessage(detail),
|
||||
},
|
||||
requestId:
|
||||
(request as FastifyRequest & { requestId?: string }).requestId ??
|
||||
|
||||
@@ -1062,6 +1062,16 @@ test("admin can create and version an inquiry form", async () => {
|
||||
payload: { formId: id, values: {} },
|
||||
});
|
||||
assert.equal(missingRequired.statusCode, 400);
|
||||
// 业务校验错误必须透传具体原因,不能被统一改写为"请求失败"。
|
||||
assert.equal(JSON.parse(missingRequired.body).error.code, "HTTP_400");
|
||||
assert.match(JSON.parse(missingRequired.body).error.message, /不能为空$/);
|
||||
const invalidBody = await request("/customer/inquiry-submissions", {
|
||||
method: "POST",
|
||||
headers: { authorization: `Bearer ${customerToken}` },
|
||||
payload: { formId: id },
|
||||
});
|
||||
assert.equal(invalidBody.statusCode, 400);
|
||||
assert.notEqual(JSON.parse(invalidBody.body).error.message, "请求失败");
|
||||
const capability = await prisma.capabilityInstallation.create({
|
||||
data: {
|
||||
brandId,
|
||||
|
||||
Reference in new issue
Block a user