Commit 790e5ce8 by 王栋源

Merge branch 'center-channel' of gitlab.gongsibao.com:jiangyong/zhichan into center-channel

parents 6fd1d012 f3d3b5bb
...@@ -33,28 +33,28 @@ class FgbusinesschanceAPI extends WEBBase { ...@@ -33,28 +33,28 @@ class FgbusinesschanceAPI extends WEBBase {
opResult = await this.utilsFgbusinesschancSve.getInfo(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.getInfo(pobj, pobj.actionBody);
break; break;
// ------ 对蜂擎页面 ------- // ------ 对蜂擎页面 -------
case "getCompanyInfo": // 获取工商信息 case "getCompanyInfo": // 获取工商信息--ok
opResult = await this.toolSve.getEntregistryByCompanyName(pobj.actionBody, req); opResult = await this.toolSve.getEntregistryByCompanyName(pobj.actionBody, req);
break; break;
case "getProductServiceLabel": // 获取产品服务标签 case "getCompanyLabel":// 三十秒认知客户--ok
opResult = await this.utilsFgbusinesschancSve.getCompanyLabel(pobj, pobj.actionBody);
break
case "getProductServiceLabel": // 获取产品服务标签--TODO:模拟
opResult = await this.utilsFgbusinesschancSve.getProductServiceLabel(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.getProductServiceLabel(pobj, pobj.actionBody);
break; break;
case "getRecommendProducts": // 获取推荐产品列表 case "getRecommendProducts": // 获取推荐产品列表--TODO:模拟
opResult = await this.utilsFgbusinesschancSve.getRecommendProducts(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.getRecommendProducts(pobj, pobj.actionBody);
break; break;
case "getTalkContent": // 获取营销话术 case "getTalkContent": // 获取营销话术--TODO:模拟
opResult = await this.utilsFgbusinesschancSve.getTalkContent(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.getTalkContent(pobj, pobj.actionBody);
break; break;
case "getOldOrder": // 获取已购产品 case "getOldOrder": // 获取已购产品--TODO:模拟
opResult = await this.utilsFgbusinesschancSve.getOldOrder(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.getOldOrder(pobj, pobj.actionBody);
break; break;
case "updateStatus"://更新商机跟进状态 case "updateStatus"://更新商机跟进状态 TODO:模拟
opResult = await this.utilsFgbusinesschancSve.updateStatus(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.updateStatus(pobj, pobj.actionBody);
break; break;
case "getCompanyLabel":// 三十秒认知客户 case "getMoreInfoUrl":// 更多客户信息链接地址--TODO:模拟
opResult = await this.utilsFgbusinesschancSve.getCompanyLabel(pobj, pobj.actionBody);
break
case "getMoreInfoUrl":// 更多客户信息链接地址
opResult = await this.utilsFgbusinesschancSve.getMoreInfoUrl(pobj, pobj.actionBody); opResult = await this.utilsFgbusinesschancSve.getMoreInfoUrl(pobj, pobj.actionBody);
break break
default: default:
......
...@@ -67,6 +67,32 @@ class AppServiceBase { ...@@ -67,6 +67,32 @@ class AppServiceBase {
return system.getResult(null, errorMsg); return system.getResult(null, errorMsg);
} }
} }
async restPostWithHValueUrl(pobj, url, hValue) {//curl请求带请求头信息
try {
if (!hValue) {
hValue = "YLc6GsgLtuRGaVA5Om848x18NxLtHlyA";
}
var rtn = await this.restClient.execPostWithHValue(pobj, url, hValue);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPostWithHValue data is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
} catch (e) {
var errorMsg = "error:" + e.stack;
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "service/app.base.js/restPostWithHValueUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostWithHValueUrl",
});
return system.getResult(null, errorMsg);
}
}
async execPostUrl(pobj, url) { async execPostUrl(pobj, url) {
try { try {
var rtn = await this.execClient.execPost(pobj, url); var rtn = await this.execClient.execPost(pobj, url);
...@@ -296,6 +322,21 @@ class AppServiceBase { ...@@ -296,6 +322,21 @@ class AppServiceBase {
var productItemInterfaceResult = await this.restPostUrl(getProductInterfaceObj, getProductInterfaceUrl); var productItemInterfaceResult = await this.restPostUrl(getProductInterfaceObj, getProductInterfaceUrl);
return productItemInterfaceResult; return productItemInterfaceResult;
} }
async getConvertSemiangleStr(str) {//去除空格及全角转半角
var result = "";
str = str.replace(/\s+/g, "");
var len = str.length;
for (var i = 0; i < len; i++) {
var cCode = str.charCodeAt(i);
//全角与半角相差(除空格外):65248(十进制)
cCode = (cCode >= 0xFF01 && cCode <= 0xFF5E) ? (cCode - 65248) : cCode;
//处理空格
cCode = (cCode == 0x03000) ? 0x0020 : cCode;
result += String.fromCharCode(cCode);
}
return result;
}
/* /*
返回20位业务订单号 返回20位业务订单号
prefix:业务前缀 prefix:业务前缀
......
...@@ -43,28 +43,67 @@ class UtilsFgbusinesschancService extends AppServiceBase { ...@@ -43,28 +43,67 @@ class UtilsFgbusinesschancService extends AppServiceBase {
} }
async getCompanyInfo(pobj, actionBody) { // async getCompanyInfo(pobj, actionBody) {
if (!actionBody.companyName) { // if (!actionBody.companyName) {
return system.getResult(null, "actionBody.companyName can not be empty,100290"); // return system.getResult(null, "actionBody.companyName can not be empty,100290");
} // }
} // }
async getCompanyLabel(pobj, actionBody) { async getCompanyLabel(pobj, actionBody) {
if (!actionBody.companyName) { if (!actionBody.companyName) {
return system.getResult(null, "actionBody.companyName can not be empty,100290"); return system.getResult(null, "actionBody.companyName can not be empty,100290");
} }
actionBody.companyName = await this.getConvertSemiangleStr(actionBody.companyName);
var url = settings.entProfileUrl() + "lable";
var reqParam = {
company_name: actionBody.companyName
}
var result = await this.restPostWithHValueUrl(reqParam, url);
if (result.code != 200) {
return system.getResult(null, result.message || "req is error");
}
return system.getResultSuccess(result.data);
} }
async getRecommendProducts(pobj, actionBody) { async getRecommendProducts(pobj, actionBody) {
if (!actionBody.businessId) { if (!actionBody.businessId) {
return system.getResult(null, "actionBody.businessId can not be empty,100290"); return system.getResult(null, "actionBody.businessId can not be empty,100290");
} }
return system.getResultSuccess([
{
"accountId": "客户ID",
"recommendId": "00000001",//推荐唯一码
"typeName": "知识产权",//推荐类型
"productName": "软件著作权",//推荐产品
"buyRate": "80%"//购买概率
},
{
"accountId": "客户ID",
"recommendId": "00000001",//推荐唯一码
"typeName": "知识产权",//推荐类型
"productName": "软件著作权",//推荐产品
"buyRate": "80%"//购买概率
}
]);
} }
async getOldOrder(pobj, actionBody) { async getOldOrder(pobj, actionBody) {
if (!actionBody.companyName) { if (!actionBody.companyName) {
return system.getResult(null, "actionBody.companyName can not be empty,100290"); return system.getResult(null, "actionBody.companyName can not be empty,100290");
} }
return system.getResultSuccess([{
"source": "阿里云",//购买渠道
"productName": "公司注册",//购买产品名称
"orderAmount": 680,//订单金额
"createTime": "2019-12-12",//购买日期
"statusName": "已完成"//购买状态名称
}, {
"source": "阿里云",//购买渠道
"productName": "公司注册",//购买产品名称
"orderAmount": 680,//订单金额
"createTime": "2019-12-12",//购买日期
"statusName": "已完成"//购买状态名称
}]);
} }
async updateStatus(pobj, actionBody) { async updateStatus(pobj, actionBody) {
...@@ -77,18 +116,32 @@ class UtilsFgbusinesschancService extends AppServiceBase { ...@@ -77,18 +116,32 @@ class UtilsFgbusinesschancService extends AppServiceBase {
if (!actionBody.businessId) { if (!actionBody.businessId) {
return system.getResult(null, "actionBody.businessId can not be empty,100290"); return system.getResult(null, "actionBody.businessId can not be empty,100290");
} }
if (!actionBody.userId) {
return system.getResult(null, "actionBody.userId can not be empty,100290");
}
return system.getResultSuccess();
} }
async getTalkContent(pobj, actionBody) { async getTalkContent(pobj, actionBody) {
if (!actionBody.recommendId) { if (!actionBody.recommendId) {
return system.getResult(null, "actionBody.recommendId can not be empty,100290"); return system.getResult(null, "actionBody.recommendId can not be empty,100290");
} }
return system.getResultSuccess([
"老板,您好,我是公司宝XXX,我们是阿里云(钉钉)的战略合作伙伴。",
"首先非常感谢您在阿里云(钉钉)上购买了商标注册服务,您的商标正在办理过程中,在办理过程中您有任何问题和需求,都可以随时与公司宝联系,您可以关注我们的服务号,我们会随时推送您的商标申请进度反馈给您。\r\n另外,由于商标申请驳回率较高,目前接近50%,公司宝现推出商标驳回宝产品套餐,针对像您这样已经购买商标注册的客户,您只需加+500元,即送送驳回复审提交服务(不含官费750元及举证撰写费1500元起),确保您的商标在驳回的第一时间我们即会自动向商评委提交驳回复审申请,避免耽误您的驳回复审提交时间。后续您还有三个月的时间搜集整理举证证据,时间也是非常充足,目前公司宝针对阿里云(钉钉)的客户给予特价优惠,购买该项服务仅需258元,优惠幅度高达50%,您看您是否需要?",
"question:你们公司宝与阿里(钉钉)什么关系?---\nanswer:我们公司宝主体是汉唐信通(北京)咨询股份有限公司,致力于企业全生命周期的一站式服务平台。阿里(钉钉)在全国甄选优质合作伙伴时独占鳌头,成为阿里(钉钉)的直营合作伙伴。|\nquestion:你们的驳回宝的优势是什么?---\nanswer:在商标接收到驳回通知后,专家老师及时分析案件情况;与您沟通商标使用情况等细节问题;出具复审的方案,并及时整理材料进行复审操作。提交后三个月内辅助您整理收集各类证据,专业的律师团队撰写案件理由,积极复审,使复审的成功率更高。|\nquestion:价格能便宜点吗?---\nanswer:您好,因为我们目前这个驳回宝套餐,已经是优惠后的特价产品;我们负责做这件事的团队都是层层考试竞选出来的,有多年专业经验的老师负责方案分析、材料整理、律师撰写等等。我们打造的是专业,靠谱;而不是随便收您点钱,事情没好好办,走个过程。相信您做公司也能明白这个道理,专人专岗跟一个人干百样工作,他的专注度和专业性肯定不一样的;相信您复审,肯定和我们的目标是一致的,我们都是希望这个商标能注册下来的。|\nquestion:你们有多大把握能帮我复审成功?---\nanswer:您好,首先拿到案件,我们会成立专家小组给您进行专业性的案件分析。然后,我们与您沟通商标的具体使用情况及哪些可以做为复审证据等综合情况。之后,专家团队会出具本商标的具体复审实施方案。在律师撰写案件理由时,肯定也是放大我们的优势,尽力为您争取。但是由于驳回复审,是商标评审委员会的老师人为审理,也和商标注册一样,可能带有自己的主观判断;所以驳回复审也没有人敢承诺100%,我们能保证的是尽最大努力,认认真真做事,帮您争取拿下商标。|",
"推荐成功结束语:好的,老板,很高兴您选择这款套餐,我马上帮您系统生成订单,您后续登录IC并进行付款即可。您也可以同步关注我们的服务号,我们会随时推送您的商标申请进度反馈给您。\r\n不成功结束语:好的,老板,公司宝有公司注册、财税代理、知识产权、行业资质认证、薪 税服务、公司交易多达三百余项产品,贵公司在业务开展过程中,如果有其他上述的服务需求,随时欢迎找我们。感谢您的支持。(也可以继续推荐其他套餐)"
]);
} }
async getMoreInfoUrl(pobj, actionBody) { async getMoreInfoUrl(pobj, actionBody) {
if (!actionBody.companyName) { if (!actionBody.companyName) {
return system.getResult(null, "actionBody.companyName can not be empty,100290"); return system.getResult(null, "actionBody.companyName can not be empty,100290");
} }
return system.getResultSuccess({
url: "https://www.gongsibao.com"
})
} }
......
...@@ -11,8 +11,10 @@ class RestClient { ...@@ -11,8 +11,10 @@ class RestClient {
this.cmdPostPatternWithAK = "curl -k -H 'Content-type: application/json' -H 'AccessKey:{ak}' -H 'request-id:{requestId}' -d '{data}' {url}"; this.cmdPostPatternWithAK = "curl -k -H 'Content-type: application/json' -H 'AccessKey:{ak}' -H 'request-id:{requestId}' -d '{data}' {url}";
this.cmdPostWithHValue = "curl -k -H 'Content-type: application/json' -H 'ak:{ak}' -d '{data}' {url}";
this.cmdDownLoadFilePattern = "curl -G -o {fileName} {url}"; this.cmdDownLoadFilePattern = "curl -G -o {fileName} {url}";
this.cmdPostPattern2 = "curl -k -H 'Content-type: application/x-www-form-urlencoded' -d '{data}' {url}"; this.cmdPostPattern2 = "curl -k -H 'Content-type: application/x-www-form-urlencoded' -d '{data}' {url}";
// form-data形式post data参数类型 md5=2&data=1 // form-data形式post data参数类型 md5=2&data=1
this.cmdPostPattern5 = "curl -k --data '{data}' {url}"; this.cmdPostPattern5 = "curl -k --data '{data}' {url}";
...@@ -40,6 +42,12 @@ class RestClient { ...@@ -40,6 +42,12 @@ class RestClient {
data).replace(/\{url\}/g, url).replace(/\{ak\}/g, acck).replace(/\{requestId\}/g, requestId); data).replace(/\{url\}/g, url).replace(/\{ak\}/g, acck).replace(/\{requestId\}/g, requestId);
return cmd; return cmd;
} }
FetchPostCmdWithHValue(subData, url, hValue) {
var data = JSON.stringify(subData);
var cmd = this.cmdPostWithHValue.replace(/\{data\}/g,
data).replace(/\{url\}/g, url).replace(/\{ak\}/g, hValue);
return cmd;
}
FetchPostCmd2(subData, url) { FetchPostCmd2(subData, url) {
var data = subData; var data = subData;
var cmd = this.cmdPostPattern2.replace(/\{data\}/g, var cmd = this.cmdPostPattern2.replace(/\{data\}/g,
...@@ -88,7 +96,7 @@ class RestClient { ...@@ -88,7 +96,7 @@ class RestClient {
} }
async execPost(subData, url) { async execPost(subData, url) {
let cmd = this.FetchPostCmd(subData, url); let cmd = this.FetchPostCmd(subData, url);
console.log(cmd,"cmd............"); console.log(cmd, "cmd............");
var result = await this.exec(cmd, { var result = await this.exec(cmd, {
maxBuffer: 10000 * 1024 maxBuffer: 10000 * 1024
}); });
...@@ -106,6 +114,14 @@ class RestClient { ...@@ -106,6 +114,14 @@ class RestClient {
return null; return null;
} }
} }
async execPostWithHValue(subData, url, hValue) {
let cmd = this.FetchPostCmdWithHValue(subData, url, hValue);
console.log(cmd, "cmd............");
var result = await this.exec(cmd, {
maxBuffer: 1024 * 1024 * 15
});
return result;
}
async execPost2(subData, url) { async execPost2(subData, url) {
let cmd = this.FetchPostCmd2(subData, url); let cmd = this.FetchPostCmd2(subData, url);
console.log(cmd); console.log(cmd);
......
...@@ -19,7 +19,14 @@ var settings = { ...@@ -19,7 +19,14 @@ var settings = {
cacheprefix: "centerChannel", cacheprefix: "centerChannel",
usertimeout: 3600,//单位秒 usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')), basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4012, port: process.env.NODE_PORT || 4012,
entProfileUrl: function () {
if (this.env == "dev") {
return "https://entprofile.gongsibao.com/";
} else {
return "https://entprofile.gongsibao.com/";
}
},
aliossjavaUrl: function () { aliossjavaUrl: function () {
if (this.env == "dev") { if (this.env == "dev") {
return "http://192.168.2.109:8080/uploadfile"; return "http://192.168.2.109:8080/uploadfile";
......
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