Commit 99143124 by 庄冰

aaa

parent 5b691945
...@@ -33,6 +33,19 @@ class TemplateinfoCtl extends CtlBase { ...@@ -33,6 +33,19 @@ class TemplateinfoCtl extends CtlBase {
return result; return result;
} }
/** /**
* 根据id获取模板信息
* @param {*} pobj
*/
async getTemplateInfoById(pobj){
let result = await this.templateinfoSve.getTemplateInfoById(pobj);
return result;
}
async setTemplateBusinessId(pobj){
let result = await this.templateinfoSve.setTemplateBusinessId(pobj);
return result;
}
/**
* 重写保存方法 * 重写保存方法
* @param pobj * @param pobj
* @returns {Promise<void>} * @returns {Promise<void>}
......
...@@ -16,6 +16,7 @@ module.exports = (db, DataTypes) => { ...@@ -16,6 +16,7 @@ module.exports = (db, DataTypes) => {
is_enabled: DataTypes.INTEGER, is_enabled: DataTypes.INTEGER,
template_content: DataTypes.JSON, template_content: DataTypes.JSON,
form_id: DataTypes.INTEGER, form_id: DataTypes.INTEGER,
business_code:DataTypes.STRING,
notes: DataTypes.STRING, notes: DataTypes.STRING,
user_id: DataTypes.STRING(100), user_id: DataTypes.STRING(100),
user_name: DataTypes.STRING(100), //user_name 用户名称 user_name: DataTypes.STRING(100), //user_name 用户名称
......
...@@ -48,6 +48,36 @@ class TemplateinfoService extends ServiceBase { ...@@ -48,6 +48,36 @@ class TemplateinfoService extends ServiceBase {
}); });
return system.getResultSuccess(templateInfo); return system.getResultSuccess(templateInfo);
} }
async getTemplateInfoById(pobj){
var ab = pobj;
if(!ab){
return system.getResultFail(-100,"参数错误");
}
if(!ab.id){
return system.getResultFail(-101,"模板ID不能为空");
}
var templateInfo = await this.dao.model.findOne({
where:{id:ab.id},raw:true
});
return system.getResultSuccess(templateInfo);
}
async setTemplateBusinessId(pobj){
var ab = pobj;
if(!ab){
return system.getResultFail(-100,"参数错误");
}
if(!ab.id){
return system.getResultFail(-101,"模板ID不能为空");
}
if(!ab.business_code){
return system.getResultFail(-102,"商品ID不能为空");
}
await this.dao.update({id:ab.id,business_code:ab.business_code});
var templateInfo = await this.dao.model.findOne({
where:{id:ab.id},raw:true
});
return system.getResultSuccess(templateInfo);
}
/** /**
* 根据模板编码获取模板信息(模板调用) * 根据模板编码获取模板信息(模板调用)
* 编辑模板时使用此接口 * 编辑模板时使用此接口
......
...@@ -75,7 +75,7 @@ class System { ...@@ -75,7 +75,7 @@ class System {
}, },
body: data body: data
}, function (error, response, body) { }, function (error, response, body) {
rtn.statusCode = response.statusCode rtn.statusCode = response && response.statusCode?response.statusCode : "";
if (!error) { if (!error) {
if (body) { if (body) {
rtn.data = body rtn.data = body
......
...@@ -11,18 +11,23 @@ class LogClient { ...@@ -11,18 +11,23 @@ class LogClient {
return u; return u;
} }
async log(pobj, req, rtninfo, errinfo) { async log(pobj, req, rtninfo, errinfo) {
rtninfo.requestId = this.getUUID() try {
req.params.param = pobj rtninfo.requestId = this.getUUID()
//第三个字段应该存公司id req.params.param = pobj
system.execLogs(settings.appname + "_" + req.xctx.codetitle, req.params, "_" + pobj.company_id + "_", rtninfo, errinfo).then(res => { //第三个字段应该存公司id
if (res && res.status == 1) { system.execLogs(settings.appname + "_" + req.xctx.codetitle, req.params, "_" + pobj.company_id + "_", rtninfo, errinfo).then(res => {
console.log("log.....success") if (res && res.status == 1) {
} else { console.log("log.....success")
} else {
console.log("log.....fail")
}
}).catch(e => {
console.log("log.....fail") console.log("log.....fail")
} })
}).catch(e => { } catch (error) {
console.log("log.....fail") console.log(error);
}) }
} }
} }
module.exports = LogClient; module.exports = LogClient;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment