Commit c9a8a2e4 by 庄冰

needinfo

parent 2384d5a9
......@@ -11,6 +11,7 @@ class Template extends APIBase {
this.templatelinkSve = system.getObject("service.template.templatelinkSve");
this.formsubmitrecordSve= system.getObject("service.configmag.formsubmitrecordSve");
this.forminfoSve= system.getObject("service.configmag.forminfoSve");
this.needinfoSve= system.getObject("service.aggregation.needinfoSve");
this.redisClient = system.getObject("util.redisClient");
this.formCache={};
}
......@@ -53,6 +54,9 @@ class Template extends APIBase {
case "pushMarketplatFormInfo2Fq"://推送需求表单信息至蜂擎
opResult = await this.formsubmitrecordSve.pushMarketplatFormInfo2Fq(pobj.actionBody);
break;
case "pushAggregationNeedInfo2fq":
opResult = await this.needinfoSve.pushAggregationNeedInfo2fq(pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
......
var system = require("../../../system")
var settings = require("../../../../config/settings");
const CtlBase = require("../../ctl.base");
var cacheBaseComp = null;
class NeedinfoCtl extends CtlBase {
constructor() {
super("aggregation", CtlBase.getServiceName(NeedinfoCtl));
}
}
module.exports = NeedinfoCtl;
const system = require("../../../system");
const settings = require("../../../../config/settings");
const appconfig = system.getSysConfig();
const submit_type={"1":"页面","2":"弹窗"};
/**
* 表单信息表
*/
module.exports = (db, DataTypes) => {
return db.define("needinfo", {
product_type_code:DataTypes.STRING,//产品类型编码
product_type_name:DataTypes.STRING,//产品类型名称
submit_type_name:DataTypes.STRING,//提交方式名称
submit_type:{
type: DataTypes.STRING(60),
set: function (val) {
this.setDataValue("submit_type", val);
this.setDataValue("submit_type_name",submit_type[val]);
}
},
channel_code:DataTypes.STRING,//渠道编码
channel_name:DataTypes.STRING,//渠道名称
page_code:DataTypes.STRING,//页面编码
page_name:DataTypes.STRING,//页面名称
contact_mobile:DataTypes.STRING,//联系电话
contact_name:DataTypes.STRING,//联系人
original_need:DataTypes.STRING,//原始需求
region:DataTypes.STRING,//地区
business_id:DataTypes.STRING,//云服产品id
push_status:DataTypes.INTEGER,
notes: DataTypes.STRING
}, {
paranoid: true,//假的删除
underscored: true,
version: true,
freezeTableName: true,
tableName: 'mc_need_info',
validate: {},
indexes: [
]
});
}
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
const settings = require("../../../../config/settings");
class NeedinfoService extends ServiceBase {
constructor() {
super("aggregation", ServiceBase.getDaoName(NeedinfoService));
this.execClient = system.getObject("util.execClient");
}
//推送聚合页需求至蜂擎
async pushAggregationNeedInfo2fq(ab){
if(!ab || !ab.id){
return ;
}
var needinfo = await this.dao.model.findOne({
where:{
id:ab.id,
push_status:0
},
raw:true
});
if(!needinfo || !needinfo.id || !needinfo.business_id || !needinfo.contact_mobile){
return ;
}
var pobj={
"customer_name": needinfo.contact_name || "未知",
"customer_phone": needinfo.contact_mobile,
"customer_region": "全国",
"demand_list": [{
"product_id": needinfo.business_id,
"region": "全国"
}],
"remark": needinfo.original_need,
"source_keyword":needinfo.channel_name,
"source": "媒体聚合页"
};
console.log(pobj,"pobj###########################2");
var pushRes = await this.fqUtilsSve.pushMediaNeedInfo2Fq(pobj);
console.log(pushRes,"pushRes############################3");
if(pushRes && pushRes.data && pushRes.code && pushRes.code=="200" && pushRes.success ){//推送成功
await this.dao.update({id:needinfo.id,push_status:1});
}else{
await this.dao.update({id:needinfo.id,push_status:2});
}
}
}
module.exports = NeedinfoService;
\ No newline at end of file
......@@ -34,6 +34,9 @@ var settings = {
browsingRecordsLogUrl: function () {
return "http://43.247.184.94:7200/marketplat_browsingrecords_log/_doc?pretty";
},
mediabrowsingRecordsLogUrl: function () {//媒体聚合页访问记录
return "http://43.247.184.94:7200/marketmedia_browsingrecords_log/_doc?pretty";
},
templateLinkUrl: function () {
if (this.env == "dev") {
return "http://192.168.200.208:8081/tfhref";
......
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