Commit fd411021 by 庄冰

push2fq

parent a0d14664
......@@ -50,6 +50,9 @@ class Template extends APIBase {
case "pushFormInfo2Fq"://推送需求表单信息至蜂擎
opResult = await this.formsubmitrecordSve.pushFormInfo2Fq();
break;
case "pushMarketplatFormInfo2Fq"://推送需求表单信息至蜂擎
opResult = await this.formsubmitrecordSve.pushMarketplatFormInfo2Fq(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
const system = require("../../../system");
const settings = require("../../../../config/settings");
const fqBaseUrl="https://fq.gongsibao.com";//生产环境
// const fqBaseUrl="https://fqdev.gongsibao.com";//测试环境
// const fqBaseUrl="https://fq.gongsibao.com";//生产环境
const fqBaseUrl="https://fqdev.gongsibao.com";//测试环境
class FqUtilsService {
constructor() {
this.execClient = system.getObject("util.execClient");
......@@ -52,14 +52,15 @@ module.exports = FqUtilsService;
// var pobj=
// {
// "customer_name": "庄冰测试",
// "customer_phone": "1371307555669384839864",
// "customer_region": "北京市",
// "customer_phone": "13075556693",
// "customer_region": "全国",
// "demand_list": [{
// "product_id": "5df73b903949e1000990f078",
// "region": "北京市 北京市 朝阳区"
// "product_id": "5f4f662fcd9796000a513bdd",
// "region": "全国"
// }],
// "remark": "测试数据",
// "source": "marketmedia"
// "source_keyword":"百度",
// "source": "媒体聚合页"
// };
// task.pushMediaNeedInfo2Fq(pobj).then(d=>{
......
......@@ -76,7 +76,8 @@ class FormsubmitrecordService extends ServiceBase {
// if(ab.push_status==1){
// addObj.push_status=1;
// }
await this.dao.create(addObj);//创建记录
var createRes = await this.dao.create(addObj);//创建记录
return system.getResultSuccess();
}
/**
......@@ -173,6 +174,34 @@ class FormsubmitrecordService extends ServiceBase {
}
return recordList;
}
//将投放页需求信息推送至蜂擎
async pushMarketplatFormInfo2Fq(ab){
if(!ab || !ab.id){
return ;
}
var formRecord = await this.dao.model.findOne({
attributes:["id","templatelink_snapshot","form_snapshot","ali_code","record_content"],
where:{
id:ab.id,
push_status:0
},
raw:true
});
if(!formRecord || !formRecord.id || !formRecord.templatelink_snapshot || !formRecord.form_snapshot || !formRecord.ali_code ||!formRecord.record_content){
return;
}
var recordList = await this.packageRecordList([formRecord]);
for(var a=0;a<recordList.length;a++){
var pushRes = await this.fqUtilsSve.pushNeedInfo2Fq(recordList[a],recordList[a].code);
console.log(pushRes,"pushRes############################3");
if(pushRes && pushRes.data && pushRes.data=="success"){//推送成功
await this.dao.update({id:recordList[a].id,push_status:1});
}else{
await this.dao.update({id:recordList[a].id,push_status:2});
}
}
}
}
module.exports = FormsubmitrecordService;
\ No newline at end of file
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