字体文件

This commit is contained in:
yulixing 2019-06-25 11:46:09 +08:00
parent 10e0399f60
commit c6c91515f7
4 changed files with 55 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import helmet from 'helmet';
import FileStreamRotator from 'file-stream-rotator';
import morgan from 'morgan';
import fs from 'fs';
import path from 'path';
import logger from './../utils/logger';
import expressUtils from './../utils/express-utils';
import config from './../../config/config';
@ -97,12 +98,14 @@ app.get('/robots.txt', function(req, res) {
});
// TODO: 待删 字体测试用
app.use('/get_font', async (req, res, next) => {
app.get('/get_font', async (req, res, next) => {
const query = req.query;
const font_name = query.font_name;
const ext = query.ext;
const fontPath = path.join(__dirname, `../fonts/${font_name}.${ext}`)
console.log(path)
res.download(`fonts/${font_name}.${ext}`);
res.download(fontPath);
});
// -- We don't want to serve sessions for static resources

View File

@ -8,6 +8,7 @@ import config from '../../../config/config';
const router = new Router();
// 生成预览图
router.post('/get_pic', async (req, res, next) => {
const body = req.body;
const opt = body.opt;
@ -47,4 +48,29 @@ router.post('/get_pic', async (req, res, next) => {
}
});
// 保存模板
router.post('/save_tpl', async (req, res, next) => {
})
// 修改模板
// 删除模板
// 查询单个模板
// 获取模板列表
export default router;

View File

@ -0,0 +1,24 @@
'use strict';
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;
/**
* 操作日志
*/
const OpLog = new mongoose.Schema({
// 游戏id
tpl_name: {type: String},
tpl_id: {type: String},
prev_url: {type: String},
base_style: {type: Object},
views: [{type: Object}],
comment: {type: String},
createdBy: {type: String}
}, {
collection: 'template',
timestamps: true,
});
export default mongoose.model('Template', Template);

View File

@ -101,7 +101,6 @@ function _drawBg(ctx, info) {
ctx.fillStyle = bg
ctx.fillRect(0, 0, w, h)
}
// TODO: 渐变填充
ctx.restore()
}