Commit e0e63ed2 by v_vdywang

wdy

parent 6b26daaf
...@@ -225,10 +225,10 @@ class TrademarktransactionService extends ServiceBase { ...@@ -225,10 +225,10 @@ class TrademarktransactionService extends ServiceBase {
// 2020 0909 lin 新增功能 查询code是否存在如果价格 高于之前的code 就价格异常 // 2020 0909 lin 新增功能 查询code是否存在如果价格 高于之前的code 就价格异常
// count作为插入成功数量 // count作为插入成功数量
var count = 0; var count = 0;
for(var i = 0;i < objlist.length;i++) { for (var i = 0; i < objlist.length; i++) {
var tmInfo = await this.dao.model.findOne({ var tmInfo = await this.dao.model.findOne({
where: { where: {
channel_code: objlist[i].channel_code, channel_code: objlist[i].channel_code,
code: objlist[i].code, code: objlist[i].code,
}, },
attributes: [ attributes: [
...@@ -237,8 +237,8 @@ class TrademarktransactionService extends ServiceBase { ...@@ -237,8 +237,8 @@ class TrademarktransactionService extends ServiceBase {
], ],
raw: true raw: true
}); });
if(tmInfo) { if (tmInfo) {
if(tmInfo.business_quoted_price < objlist[i].business_quoted_price) { if (tmInfo.business_quoted_price < objlist[i].business_quoted_price) {
objlist[i]["publish_status"] = "fail" objlist[i]["publish_status"] = "fail"
continue; continue;
} }
...@@ -247,7 +247,7 @@ class TrademarktransactionService extends ServiceBase { ...@@ -247,7 +247,7 @@ class TrademarktransactionService extends ServiceBase {
} }
let res = await this.dao.model.bulkCreate(objlist); let res = await this.dao.model.bulkCreate(objlist);
var data = { var data = {
tm : res, tm: res,
successCount: count successCount: count
} }
return system.getResultSuccess(data); return system.getResultSuccess(data);
...@@ -509,14 +509,14 @@ class TrademarktransactionService extends ServiceBase { ...@@ -509,14 +509,14 @@ class TrademarktransactionService extends ServiceBase {
if (!objlist || objlist.length < 1) { if (!objlist || objlist.length < 1) {
return system.getResultFail(-106, "参数错误"); return system.getResultFail(-106, "参数错误");
} }
if (objlist[0].pic_url) { // if (objlist[0].pic_url) {
// await this.addEsData(objlist); // // await this.addEsData(objlist);
} else { // } else {
var codeList = [] var codeList = []
for (let i = 0; i < objlist.length; i++) { for (let i = 0; i < objlist.length; i++) {
codeList.push(objlist[i].code); codeList.push(objlist[i].code);
}
} }
// }
var params = { var params = {
"query": { "query": {
"terms": { "terms": {
...@@ -623,9 +623,9 @@ class TrademarktransactionService extends ServiceBase { ...@@ -623,9 +623,9 @@ class TrademarktransactionService extends ServiceBase {
var tminfos = await this.dao.customQuery(sql); var tminfos = await this.dao.customQuery(sql);
var sources = []; var sources = [];
if (tminfos) { if (tminfos) {
if(tminfos.length<1){ if (tminfos.length < 1) {
return null; return null;
} }
for (var i = 0; i < tminfos.length; i++) { for (var i = 0; i < tminfos.length; i++) {
var tmg = tminfos[i].tm_group; var tmg = tminfos[i].tm_group;
var status = 1; var status = 1;
...@@ -673,7 +673,7 @@ class TrademarktransactionService extends ServiceBase { ...@@ -673,7 +673,7 @@ class TrademarktransactionService extends ServiceBase {
strdate = newdate.toISOString().split("T")[0].replace(/\-/g, "") + "_1.json"; strdate = newdate.toISOString().split("T")[0].replace(/\-/g, "") + "_1.json";
} }
var jsonstr = JSON.stringify(sources, null, "\t"); var jsonstr = JSON.stringify(sources, null, "\t");
var a =await new Promise(function (resv, rej) { var a = await new Promise(function (resv, rej) {
fs.writeFile("/tmp/" + strdate, jsonstr, function (err) { fs.writeFile("/tmp/" + strdate, jsonstr, function (err) {
if (err) { if (err) {
console.error(err); console.error(err);
...@@ -683,11 +683,11 @@ class TrademarktransactionService extends ServiceBase { ...@@ -683,11 +683,11 @@ class TrademarktransactionService extends ServiceBase {
}) })
} }
) )
var rtn=await this.ossClient.upfile(strdate, "/tmp/" + strdate); var rtn = await this.ossClient.upfile(strdate, "/tmp/" + strdate);
return { return {
status:1, status: 1,
msg:"", msg: "",
data:rtn data: rtn
}; };
} }
......
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