|
|
@@ -712,6 +712,33 @@ router.get('/play/:id', function (req, res, next) {
|
|
|
|
|
|
});
|
|
|
|
|
|
+// print页路由
|
|
|
+router.get('/print/:id', function (req, res, next) {
|
|
|
+ (async function () {
|
|
|
+ let id = req.params.id;
|
|
|
+ let data = {
|
|
|
+ id,
|
|
|
+ title: meta.playTitle.en,
|
|
|
+ description: meta.playDescription.en,
|
|
|
+ };
|
|
|
+
|
|
|
+ utils.validators.validateId(id);
|
|
|
+ let doc = await models.Art.findById(id);
|
|
|
+ if (!doc) throw createError(404, 'Art Not Found!');
|
|
|
+
|
|
|
+ let host = config.resHost;
|
|
|
+ let size = Math.min(doc.width, 2000);
|
|
|
+ let downlink = `${host}/thumbs/coloring-page/page/${size}/${doc._id}.jpeg`;
|
|
|
+
|
|
|
+ data.downlink = downlink;
|
|
|
+
|
|
|
+ res.render('print', data);
|
|
|
+
|
|
|
+ })().catch(next);
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+
|
|
|
|
|
|
router.get('/:lang/info', function (req, res, next) {
|
|
|
(async function () {
|
|
|
@@ -737,9 +764,9 @@ const organizeData = (data, lang) => {
|
|
|
let publishVersion = doc.publishVersion || 0;
|
|
|
let version = publishVersion + 1500;
|
|
|
|
|
|
- doc.thumb = `${host}/thumbs/v2/page/480/${doc._id}.jpeg`;
|
|
|
+ doc.thumb = `${host}/thumbs/coloring-page/page/480/${doc._id}.jpeg`;
|
|
|
if (doc.mystery) { // 神秘图固定用一张
|
|
|
- doc.thumb = `${host}/thumbs/v2/mystery/480/${doc._id}.jpeg`;
|
|
|
+ doc.thumb = `${host}/thumbs/coloring-page/mystery/480/${doc._id}.jpeg`;
|
|
|
} else if (doc.hasSpecial) { // special图有切线图、渐变切线图、灰度图、上传图3中可选
|
|
|
let str = 'special_outline';
|
|
|
if (doc.useSpecialThumb == 1) {
|
|
|
@@ -749,7 +776,7 @@ const organizeData = (data, lang) => {
|
|
|
} else if (doc.useSpecialThumb == 3) {
|
|
|
str = 'special_gradient';
|
|
|
}
|
|
|
- doc.thumb = `${host}/thumbs/v2/${str}/480/${doc._id}.jpeg`;
|
|
|
+ doc.thumb = `${host}/thumbs/coloring-page/${str}/480/${doc._id}.jpeg`;
|
|
|
}
|
|
|
|
|
|
doc.zip = `${host}/zips/v2/number_mini/${version}/${doc._id}.zip`;
|
|
|
@@ -782,9 +809,9 @@ const organizeDetail = (doc, lang) => {
|
|
|
let publishVersion = doc.publishVersion || 0;
|
|
|
let version = publishVersion + 1500;
|
|
|
|
|
|
- doc.thumb = `${host}/thumbs/v2/page/480/${doc._id}.jpeg`;
|
|
|
+ doc.thumb = `${host}/thumbs/coloring-page/page/480/${doc._id}.jpeg`;
|
|
|
if (doc.mystery) { // 神秘图固定用一张
|
|
|
- doc.thumb = `${host}/thumbs/v2/mystery/480/${doc._id}.jpeg`;
|
|
|
+ doc.thumb = `${host}/thumbs/coloring-page/mystery/480/${doc._id}.jpeg`;
|
|
|
} else if (doc.hasSpecial) { // special图有切线图、渐变切线图、灰度图、上传图3中可选
|
|
|
let str = 'special_outline';
|
|
|
if (doc.useSpecialThumb == 1) {
|
|
|
@@ -794,7 +821,7 @@ const organizeDetail = (doc, lang) => {
|
|
|
} else if (doc.useSpecialThumb == 3) {
|
|
|
str = 'special_gradient';
|
|
|
}
|
|
|
- doc.thumb = `${host}/thumbs/v2/${str}/480/${doc._id}.jpeg`;
|
|
|
+ doc.thumb = `${host}/thumbs/coloring-page/${str}/480/${doc._id}.jpeg`;
|
|
|
}
|
|
|
|
|
|
doc.zip = `${host}/zips/v2/number_mini/${version}/${doc._id}.zip`
|
|
|
@@ -824,6 +851,9 @@ const organizeDetail = (doc, lang) => {
|
|
|
let utf8name = encodeURIComponent(doc.title.replace(/[\s_]+/g, '-')).toLowerCase();
|
|
|
doc.uri = `/${lang}/coloring-page/${utf8name}-${doc._id}`;
|
|
|
|
|
|
+ let size = Math.min(doc.width, 2000);
|
|
|
+ doc.downlink = `${host}/thumbs/coloring-page/page/${size}/${doc._id}.jpeg`;
|
|
|
+
|
|
|
delete doc.hasSpecial;
|
|
|
delete doc.useSpecialThumb;
|
|
|
delete doc.publishVersion;
|