Commit 237f96f9 by zhaoxiqing

gsb

parent 5668dd80
......@@ -63,8 +63,8 @@ class EcontractApi {
if (!etemplate) {
return 0;
}
let errors = [];
let ids = [];
for (var name of names) {
try {
let company = await this.ecompanySve.findOne({name: name});
......@@ -73,17 +73,49 @@ class EcontractApi {
continue;
}
// 创建模板
let etemplate = {
};
await this.etemplateSve.create(etemplate);
var newTemplate = {
ecompany_id:company.id,
name:name,
ecompanyMainId : etemplate.ecompanyMainId,
mainId:etemplate.mainId,
nameA : etemplate.nameA,
templateid:etemplate.templateid,
filekey:etemplate.filekey,//e签宝返回文件key
filepath:etemplate.filepath,//需要在后台补充
placeholderkey:etemplate.placeholderkey,//模板占位信息
isEnabled:true,
};
newTemplate = await this.etemplateSve.create(newTemplate);
ids.push(newTemplate.id);
} catch (e) {
console.log(e);
}
}
console.log(ids)
this.addqrcodeurl({ids: ids});
return errors;
}
async addqrcodeurl(obj){
let ids = obj.ids || [];
if (!ids || ids.length == 0) {
return "no ids";
}
for (let id of ids) {
try {
var newTemplate = await this.etemplateSve.findById(id);
if (newTemplate) {
var qrcodeurl = await this.wxSve.makeQrWithScene("wxf616c0a459d66081", newTemplate.id);
newTemplate.qrcodeurl = qrcodeurl;
await newTemplate.save();
}
} catch (e) {
console.log(e, id, "addqrcodeurl");
}
}
}
async testpushContract(obj, req) {
var ids = obj.ids || [];
for (var id of ids) {
......
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