Commit 0ccaddcd by linboxuan

update writeCommunicationLog

parent e3b31c2e
...@@ -175,18 +175,37 @@ class NeedinfoService extends ServiceBase { ...@@ -175,18 +175,37 @@ class NeedinfoService extends ServiceBase {
} }
async writeCommunicationLog(pobj,actionBody){ async writeCommunicationLog(pobj,actionBody){
// 查询需求沟通记录
actionBody.Note = ["noteTime",moment().format("YYYY-MM-DD HH:mm:ss"),"note",actionBody.Note]; actionBody.Note = ["noteTime",moment().format("YYYY-MM-DD HH:mm:ss"),"note",actionBody.Note];
var sql = "update n_need_info set followContent=json_array_append(followContent, '$', JSON_OBJECT(:Note)) where channelNeedNo=:BizId" let needRes = await this.findOne({channelNeedNo:actionBody.BizId});
// var sql = "update n_need_info set followContent=json_array_append(followContent, '$', "+ "\"" + JSON.stringify(actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +actionBody.BizId +"\"" +" " // 没有需求单直接返回
var paramWhere = { if(!needRes) {
Note: actionBody.Note, return system.getResult("没有这个需求单");
BizId: actionBody.BizId }
}; if(!needRes.followContent) {
let updateRes = await this.customUpdate(sql,paramWhere); var sql = "update n_need_info set followContent=JSON_OBJECT(:followContent) where channelNeedNo=:BizId"
if(updateRes[1]) { var paramWhere = {
followContent: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
return system.getResultSuccess();
}
return system.getResult("添加记录失败");
} else {
var sql = "update n_need_info set followContent=json_array_append(followContent, '$', JSON_OBJECT(:Note)) where channelNeedNo=:BizId"
// var sql = "update n_need_info set followContent=json_array_append(followContent, '$', "+ "\"" + JSON.stringify(actionBody.Note) + "\""+") where channelNeedNo="+ "\"" +actionBody.BizId +"\"" +" "
var paramWhere = {
Note: actionBody.Note,
BizId: actionBody.BizId
};
var updateRes = await this.customUpdate(sql,paramWhere);
if(updateRes[1]) {
return system.getResultSuccess(); return system.getResultSuccess();
}
return system.getResult("添加记录失败");
} }
return system.getResult("添加记录失败");
} }
} }
module.exports = NeedinfoService; module.exports = NeedinfoService;
......
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