mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-05 19:41:40 +08:00
fix: 创建活动时
This commit is contained in:
parent
906002f809
commit
ac2aef980c
@ -35,7 +35,8 @@
|
||||
"mysql2": "^2.3.3",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sequelize": "^6.6.2",
|
||||
"sequelize-typescript": "^2.1.0"
|
||||
"sequelize-typescript": "^2.1.0",
|
||||
"tslib": "^2.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.15.0",
|
||||
|
@ -9,12 +9,13 @@ CREATE TABLE `magic_act_info` (
|
||||
`act_create_time` varchar(128) NOT NULL COMMENT '活动创建时间',
|
||||
`operator` varchar(512) DEFAULT NULL COMMENT '负责人',
|
||||
`locker` varchar(128) DEFAULT NULL COMMENT '当前正在编辑的人',
|
||||
`lock_time` datetime DEFAULT '0000-00-00 00:00:00' COMMENT '锁定时间',
|
||||
`lock_time` datetime DEFAULT NULL COMMENT '锁定时间',
|
||||
`act_status` int(11) DEFAULT NULL COMMENT '活动状态:0-修改中,1-部分已发布,2-已发布',
|
||||
`abtest_raw` mediumtext COMMENT 'serialize后的abtest',
|
||||
PRIMARY KEY (`act_id`),
|
||||
KEY `act_name` (`act_name`)
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = '魔方开源-活动信息表'
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = '魔方开源-活动信息表';
|
||||
|
||||
-- 页面配置表
|
||||
CREATE TABLE `magic_ui_config` (
|
||||
`id` int(8) unsigned NOT NULL AUTO_INCREMENT COMMENT '页面id',
|
||||
@ -31,4 +32,4 @@ CREATE TABLE `magic_ui_config` (
|
||||
`web_plugin` varchar(255) DEFAULT NULL COMMENT 'web插件',
|
||||
`page_name` varchar(128) DEFAULT NULL COMMENT '页面名称(编辑器页面唯一标识)',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 5 DEFAULT CHARSET = utf8mb4 COMMENT = '魔方开源-uiconfig表'
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 DEFAULT CHARSET = utf8mb4 COMMENT = '魔方开源-uiconfig表';
|
||||
|
@ -173,6 +173,7 @@ export default class ActService {
|
||||
actModifyTime: getFormatTime(),
|
||||
actCreateTime: getFormatTime(),
|
||||
actStatus: ActStatus.MODIFYING,
|
||||
actCryptoId: '', // 数据库不能为空,先做个占位符
|
||||
...actInfo,
|
||||
};
|
||||
const act = await ActInfo.create<ActInfo>(newAct as ActInfo);
|
||||
@ -187,7 +188,9 @@ export default class ActService {
|
||||
);
|
||||
|
||||
// 添加默认活动页
|
||||
const defaultPage = await this.pageService.create();
|
||||
const defaultPage = await this.pageService.create({
|
||||
actId: act.actId,
|
||||
});
|
||||
await act.$add<Page>('Pages', defaultPage);
|
||||
|
||||
return act.actId;
|
||||
|
@ -31,17 +31,14 @@ export default class PageService {
|
||||
* @param {Page} page 页面参数
|
||||
* @returns {Page} 新建页面
|
||||
*/
|
||||
create = (page?: Page) => {
|
||||
const oldPage = page;
|
||||
create = (page?: Partial<Page>) => {
|
||||
const newPage = {
|
||||
pageCreateTime: getFormatTime(),
|
||||
pageModifyTime: getFormatTime(),
|
||||
pagePublishStatus: PageStatus.MODIFYING,
|
||||
distCode: oldPage?.distCode,
|
||||
srcCode: oldPage?.srcCode,
|
||||
pagePublishUiVersion: oldPage?.pagePublishUiVersion,
|
||||
pageTitle: oldPage?.pageTitle || 'index',
|
||||
pageName: oldPage?.pageName || 'index',
|
||||
pageTitle: 'index',
|
||||
pageName: 'index',
|
||||
...page,
|
||||
};
|
||||
return Page.create(newPage as Page);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user