Commit 2384d5a9 by 兰国旗

Merge branch 'gsb-marketplat-mag' of gitlab.gongsibao.com:jiangyong/zhichan into gsb-marketplat-mag

parents fea6c177 75fe4af1
......@@ -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;
......
......@@ -7,22 +7,62 @@ class FqUtilsService {
this.execClient = system.getObject("util.execClient");
this.logClient = system.getObject("util.logClient");
}
/**
* 推送投放落地页需求至蜂擎
* @param {*} pobj
* @param {*} code
*/
async pushNeedInfo2Fq(pobj,code){
try {
var url = fqBaseUrl+"/open/ex/flux/advisory?code="+code;
var rtn = await this.execClient.execPost(pobj, url);
var data = JSON.parse(rtn.stdout);
this.logClient.pushlog("测试数据---推送需求数据至蜂擎返回结果-pushNeedInfo2Fq-success",pobj, rtn, null);
this.logClient.pushlog("推送投放落地页需求数据至蜂擎返回结果-pushNeedInfo2Fq-success",pobj, rtn, null);
return data;
} catch (e) {
this.logClient.pushlog("测试数据---推送需求数据至蜂擎返回异常-pushNeedInfo2Fq-error", pobj, null, e.stack);
this.logClient.pushlog("推送投放落地页需求数据至蜂擎返回异常-pushNeedInfo2Fq-error", pobj, null, e.stack);
return null;
}
}
/**
* 推送媒体聚合页需求至蜂擎
* @param {*} pobj
*/
async pushMediaNeedInfo2Fq(pobj) {
try {
var url = "https://yunfuapi-dev.gongsibao.com/cloudapi/cyg/lead/fluxAllot";
var rc = system.getObject("util.aliyunClient");
console.log(rc,"aliyunClient++++++++++++++++++++++++++");
var rtn = await rc.post(url, pobj);
console.log(rtn,"rtn+++++++++++++++++++++++++++++++++++++")
this.logClient.pushlog("推送媒体聚合页需求数据至蜂擎返回结果-pushMediaNeedInfo2Fq-success",pobj, rtn, null);
return rtn;
} catch (e) {
console.log(e,"e+++++++++++++++++++++++++++++++++++++++")
this.logClient.pushlog("推送投放落地页需求数据至蜂擎返回异常-pushMediaNeedInfo2Fq-error", pobj, null, e.stack);
return null;
}
}
}
module.exports = FqUtilsService;
\ No newline at end of file
module.exports = FqUtilsService;
// var task = new FqUtilsService();
// var pobj=
// {
// "customer_name": "庄冰测试",
// "customer_phone": "13075556693",
// "customer_region": "全国",
// "demand_list": [{
// "product_id": "5f4f662fcd9796000a513bdd",
// "region": "全国"
// }],
// "remark": "测试数据",
// "source_keyword":"百度",
// "source": "媒体聚合页"
// };
// task.pushMediaNeedInfo2Fq(pobj).then(d=>{
// console.log(d,"res++++++++++++++++++++++++++");
// })
\ No newline at end of file
......@@ -115,7 +115,11 @@ class ForminfoService extends ServiceBase {
return system.getResultFail(-1,'表单已投入使用,不能修改')
}
//获取相关表单项
let itemData = await this.formitemDao.findAll({form_id:pobj.id},[]);
// let itemData = await this.formitemDao.findAll({form_id:pobj.id},[]);
let itemData = await this.formitemDao.model.findAll({
where:{form_id:pobj.id},raw:true,
order:[["sequence","asc"]]
});
let form_items = '';
if(itemData.length>0){
itemData.forEach(v=>{
......
......@@ -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
const Client = require('aliyun-api-gateway').Client;
var RPCClient = require('@alicloud/pop-core').RPCClient;
const client = new Client('203756805', 'crkyej0xlmqa6bmvqijun6ltxparllyn');//开发
// const client = new Client('203763771', 'e5e2ytnn6nrkr9qnqk4w5e6z0xlhkznu');//线上
class aliyunClient {
constructor() {
// this.aliReqUrl = "https://aliapi.gongsibao.com/tm/springboard";
this.aliclient = new RPCClient({
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa',
accessKeySecret: 'hp4FF18IDCSym1prqzxrAjnnhNH3ju',
endpoint: 'https://trademark.aliyuncs.com',
apiVersion: '2018-07-24'
});
}
async post(aliReqUrl, actionBody) {
var param = {
data: actionBody,
timeout: 20000,
headers: {
accept: 'application/json'
}
};
console.log(JSON.stringify(param), "______________峰擎---阿里云参数_______");
var result = await client.post(aliReqUrl, param);
console.log(JSON.stringify(result), "______________峰擎---阿里云返回结果_______");
return result;
}
//阿里接口
async reqbyget(obj, cbk) {
var self = this;
var action = obj.action;
var reqbody = obj.reqbody;
return self.aliclient.request(action, reqbody, {
timeout: 3000, // default 3000 ms
formatAction: true, // default true, format the action to Action
formatParams: true, // default true, format the parameter name to first letter upper case
method: 'GET', // set the http method, default is GET
headers: {}, // set the http request headers
});
}
}
module.exports = aliyunClient;
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><meta content=yes name=apple-mobile-web-app-capable><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/ccc.png><link rel=stylesheet href=//at.alicdn.com/t/font_1996389_21r6b2e5cqci.css><title></title><link href=/css/chunk-04497344.c9ab9860.css rel=prefetch><link href=/css/chunk-0fb760a4.5c30cb40.css rel=prefetch><link href=/css/chunk-14b9857b.0dc416de.css rel=prefetch><link href=/css/chunk-2c359864.0dc416de.css rel=prefetch><link href=/css/chunk-2e4d9032.317ad784.css rel=prefetch><link href=/css/chunk-30f318ec.8ffc90d9.css rel=prefetch><link href=/css/chunk-3385141a.0dc416de.css rel=prefetch><link href=/css/chunk-3cca9940.6014cc43.css rel=prefetch><link href=/css/chunk-6b77ef07.70decc8e.css rel=prefetch><link href=/css/chunk-cc77621c.8797b2b5.css rel=prefetch><link href=/js/chunk-04497344.0c8a3138.js rel=prefetch><link href=/js/chunk-0fb760a4.56bf0a09.js rel=prefetch><link href=/js/chunk-14b9857b.ae43b7c1.js rel=prefetch><link href=/js/chunk-1f11ec07.766ad876.js rel=prefetch><link href=/js/chunk-2c359864.f1f45686.js rel=prefetch><link href=/js/chunk-2d210f61.9e612a95.js rel=prefetch><link href=/js/chunk-2e4d9032.15b89a87.js rel=prefetch><link href=/js/chunk-30f318ec.cf854129.js rel=prefetch><link href=/js/chunk-3385141a.16d7705b.js rel=prefetch><link href=/js/chunk-3cca9940.f6b28725.js rel=prefetch><link href=/js/chunk-5a4e13d5.6ebd883c.js rel=prefetch><link href=/js/chunk-6b77ef07.83a59a2a.js rel=prefetch><link href=/js/chunk-780401d4.2594e2ad.js rel=prefetch><link href=/js/chunk-cc77621c.209c3f4a.js rel=prefetch><link href=/js/chunk-d710b6d2.9eff4b27.js rel=prefetch><link href=/css/app.a0c5a847.css rel=preload as=style><link href=/css/chunk-vendors.a0428467.css rel=preload as=style><link href=/js/app.48724c61.js rel=preload as=script><link href=/js/chunk-vendors.e5330d6b.js rel=preload as=script><link href=/css/chunk-vendors.a0428467.css rel=stylesheet><link href=/css/app.a0c5a847.css rel=stylesheet></head><body><noscript><strong>We're sorry but iview-admin doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.e5330d6b.js></script><script src=/js/app.48724c61.js></script></body></html>
\ No newline at end of file
<!DOCTYPE html><html><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><meta content=yes name=apple-mobile-web-app-capable><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=/ccc.png><link rel=stylesheet href=//at.alicdn.com/t/font_1996389_21r6b2e5cqci.css><title></title><link href=/css/chunk-04497344.c9ab9860.css rel=prefetch><link href=/css/chunk-0fb760a4.5c30cb40.css rel=prefetch><link href=/css/chunk-14b9857b.0dc416de.css rel=prefetch><link href=/css/chunk-2c359864.0dc416de.css rel=prefetch><link href=/css/chunk-30f318ec.8ffc90d9.css rel=prefetch><link href=/css/chunk-3385141a.0dc416de.css rel=prefetch><link href=/css/chunk-3c222dce.0546a3a4.css rel=prefetch><link href=/css/chunk-3cca9940.6014cc43.css rel=prefetch><link href=/css/chunk-6b77ef07.70decc8e.css rel=prefetch><link href=/css/chunk-cc77621c.8797b2b5.css rel=prefetch><link href=/js/chunk-04497344.0c8a3138.js rel=prefetch><link href=/js/chunk-0fb760a4.56bf0a09.js rel=prefetch><link href=/js/chunk-14b9857b.ae43b7c1.js rel=prefetch><link href=/js/chunk-1f11ec07.766ad876.js rel=prefetch><link href=/js/chunk-2c359864.f1f45686.js rel=prefetch><link href=/js/chunk-2d210f61.9e612a95.js rel=prefetch><link href=/js/chunk-30f318ec.cf854129.js rel=prefetch><link href=/js/chunk-3385141a.16d7705b.js rel=prefetch><link href=/js/chunk-3c222dce.06e974c5.js rel=prefetch><link href=/js/chunk-3cca9940.f6b28725.js rel=prefetch><link href=/js/chunk-5a4e13d5.6ebd883c.js rel=prefetch><link href=/js/chunk-6b77ef07.83a59a2a.js rel=prefetch><link href=/js/chunk-780401d4.2594e2ad.js rel=prefetch><link href=/js/chunk-cc77621c.209c3f4a.js rel=prefetch><link href=/js/chunk-d710b6d2.9eff4b27.js rel=prefetch><link href=/css/app.e3db6847.css rel=preload as=style><link href=/css/chunk-vendors.a0428467.css rel=preload as=style><link href=/js/app.c4351be8.js rel=preload as=script><link href=/js/chunk-vendors.e5330d6b.js rel=preload as=script><link href=/css/chunk-vendors.a0428467.css rel=stylesheet><link href=/css/app.e3db6847.css rel=stylesheet></head><body><noscript><strong>We're sorry but iview-admin doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.e5330d6b.js></script><script src=/js/app.c4351be8.js></script></body></html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -14,6 +14,7 @@
"MD5": "^1.3.0",
"after": "^0.8.2",
"ali-oss": "^4.12.2",
"aliyun-api-gateway": "^1.1.6",
"babel-polyfill": "^6.26.0",
"base64id": "^1.0.0",
"bluebird": "^3.5.1",
......
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