- config.default.js: 新增 customAreaBaseUrl 出口域名配置 - router.js: 新增 GET /mb/douyin1.xml 路由 - controller/template.js: 新增 douyinCustomArea() 方法输出静态 XML - printer_data_builder.js: applyDouyinExpressFieldMapping 支持 customAreaBaseUrl 参数 - order_print.js: 将 app.config.customAreaBaseUrl 传入 buildPlatformRequestSkeleton - douyin.json: 移除硬编码 templateURL,由运行时代码动态拼装
27 lines
791 B
JavaScript
27 lines
791 B
JavaScript
const {
|
||
Controller,
|
||
} = require('egg');
|
||
|
||
class TemplateController extends Controller {
|
||
async xml() {
|
||
const { service, ctx } = this;
|
||
const result = await service.systems.setting.printTemplate.getXmlByTemplate(ctx.params.id);
|
||
ctx.body = result;
|
||
}
|
||
|
||
/**
|
||
* 输出抖音面单自定义区模板 XML(douyin1.xml)
|
||
*/
|
||
async douyinCustomArea() {
|
||
const { ctx } = this;
|
||
ctx.type = 'application/xml';
|
||
ctx.body = `<?xml version="1.0" encoding="UTF-8"?>
|
||
<layout id="CUSTOM_AREA" width="97" height="60" left="0" top="111" style="">
|
||
<layout width="57" height="30" left="2" top="2" style="">
|
||
<text style="fontFamily:宋体;fontSize:9;fontWeight:600"><![CDATA[<%=_data.productInfo%>]]></text>
|
||
</layout>
|
||
</layout>`;
|
||
}
|
||
}
|
||
module.exports = TemplateController;
|