From f74a27ca41011aa5846e1bb02f0d6208c0e8210e Mon Sep 17 00:00:00 2001 From: zhl Date: Tue, 8 Jun 2021 11:22:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BA=97=E9=93=BA=E4=BF=A1=E6=81=AF=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E9=A2=9D=E5=A4=96=E5=8F=82=E6=95=B0,=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0sysmail=E7=9A=84=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/controllers/shop.controller.ts | 6 +++++- src/models/content/SysMail.ts | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/models/content/SysMail.ts diff --git a/src/api/controllers/shop.controller.ts b/src/api/controllers/shop.controller.ts index 6354cbc..d578ca2 100644 --- a/src/api/controllers/shop.controller.ts +++ b/src/api/controllers/shop.controller.ts @@ -82,7 +82,11 @@ class ShopController extends BaseController { @router('post /api/:accountid/shop') async shopInfo(req) { let { sid } = req.params - if (!sid || !validShopId(sid)) { + if (!sid) { + throw new ZError(10, `shopInfo 没有店铺id: ${sid}`) + } + sid = sid.split('|')[0] + if (!validShopId(sid)) { throw new ZError(10, `shopInfo 没有店铺id或者店铺id格式不正确: ${sid}`) } let rspData: any = {} diff --git a/src/models/content/SysMail.ts b/src/models/content/SysMail.ts new file mode 100644 index 0000000..0c26ab0 --- /dev/null +++ b/src/models/content/SysMail.ts @@ -0,0 +1,18 @@ +import { dbconn } from '../../decorators/dbconn' +import { getModelForClass, modelOptions, prop } from '@typegoose/typegoose' +import { Severity } from '@typegoose/typegoose/lib/internal/constants' +import { BaseModule } from '../Base' + +@dbconn() +@modelOptions({ + schemaOptions: { collection: 'sys_mail', timestamps: true }, + options: { allowMixed: Severity.ALLOW }, +}) +export class SysMailClass extends BaseModule { + @prop() + public title: string + + @prop() + public content: string +} +export const SysMail = getModelForClass(SysMailClass, { existingConnection: SysMailClass.db })