Commit b4a4aab5 by 陈思聪

fix:商标注册、商标交易商机 阿里双呼接入

parent 3e6ce91c
......@@ -65,8 +65,10 @@ class UtilsNeedService extends AppServiceBase {
pobj.actionBody.type = "ali.edi";
pobj.actionBody.idempotentSource = "edi_ali";
} else if (pobj.actionBody.channel_type_code == "tmjy") {
// 阿里商标交易
pobj.actionBody.type = "ali.tmd";
pobj.actionBody.idempotentSource = "tmd_ali";
pobj.actionBody.contactsDingtalk = pobj.actionBody.idempotentId;
}else if (pobj.actionBody.channel_type_code == 1) {
// 阿里商标交易
pobj.actionBody.type = "ali.tmd";
......
......@@ -16,7 +16,7 @@ class aliyunClient {
}
getAliTMClient() {
return new RPCClient({
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa',
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa', //对应的aliuid 是 1525276744866147
accessKeySecret: 'hp4FF18IDCSym1prqzxrAjnnhNH3ju',
endpoint: 'https://trademark.aliyuncs.com',
apiVersion: '2018-07-24'
......@@ -97,12 +97,23 @@ class aliyunClient {
//-----------阿里云双呼能力接口接入------start--------chensicong----2022.01.17----------------------
getAliDoubleCallClient() {
// 专家辅助申请(商标注册) 双呼客户端
getAliDoubleCallClientForTMREG() {
return new RPCClient({
accessKeyId: 'LTAI1pJs7KQizBe2',
accessKeySecret: 'MMNibebAPqR9AnX5YWHnSL2tHMSIoL',
accessKeyId: "LTAI1pJs7KQizBe2",//对应的aliuid 是 30039057
accessKeySecret: "MMNibebAPqR9AnX5YWHnSL2tHMSIoL",
endpoint: "https://companyreg.aliyuncs.com",
apiVersion: '2020-03-06'
apiVersion: "2020-03-06"
});
}
// 商标交易(商标优选) 双呼客户端
getAliDoubleCallClientForTMTRADE() {
return new RPCClient({
accessKeyId: 'LTAI4FmyipY1wuLHjLhMWiPa', // 对应的aliuid 是 1525276744866147
accessKeySecret: 'hp4FF18IDCSym1prqzxrAjnnhNH3ju',
endpoint: "https://companyreg.aliyuncs.com",
apiVersion: "2020-03-06"
});
}
......@@ -111,26 +122,33 @@ class aliyunClient {
let res = null;
try{
console.log(`开始调用阿里云-获取可用外呼号码列表接口。参数bizType=${bizType}`)
// let reqAliclient = this.getAliDoubleCallClient()
var client = new RPCClient({
accessKeyId: 'LTAI1pJs7KQizBe2',
accessKeySecret: 'MMNibebAPqR9AnX5YWHnSL2tHMSIoL',
endpoint: "https://companyreg.aliyuncs.com",
apiVersion: '2020-03-06'
});
if(!bizType){
return system.getResultFail(-200, "bizType不能为空");
}
let reqAliclient = null
if(bizType == 'TM_TRADE'){
reqAliclient = this.getAliDoubleCallClientForTMTRADE();
}else if(bizType == 'EXPERT_APPLY'){
reqAliclient = this.getAliDoubleCallClientForTMREG();
}else {
return system.getResultFail(-200, `不支持的bizType=${bizType}`);
}
let obj = { bizType:bizType }
res = await client.request("QueryAvailableNumbers", obj, {
res = await reqAliclient.request("QueryAvailableNumbers", obj, {
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: 'POST', // set the http method, default is GET
headers: {}, // set the http request headers
});
console.log(`结束调用阿里云-获取可用外呼号码列表接口。参数bizType=${bizType},结果=${res}`)
console.log(`结束调用阿里云-获取可用外呼号码列表接口。参数bizType=${bizType},结果=${JSON.stringify(res)}`)
this.execClientNew.execLogs(`获取可用外呼号码列表成功`, {bizType:bizType}, "center-channel-aliyunClient-queryAvailabelNumbers", res, null);
return system.getResultSuccess(res.data);
return system.getResultSuccess(res.Data||res.data);
}catch (e){
console.log(`调用异常:阿里云-获取可用外呼号码列表接口。参数bizType=${bizType},结果=${res},异常信息=${e.stack}`)
console.log(`调用异常:阿里云-获取可用外呼号码列表接口。参数bizType=${bizType},结果=${JSON.stringify(res)},异常信息=${e.stack}`)
this.execClientNew.execLogs(`获取可用外呼号码列表失败接口`, {bizType:bizType}, "center-channel-aliyunClient-queryAvailabelNumbers", res, JSON.stringify(e.stack));
return system.getResultFail(-200, "api调用出现异常,error:" + e.stack);
}
......@@ -145,7 +163,19 @@ class aliyunClient {
let res = null;
try{
console.log(`开始调用阿里云-发起双呼接口。参数reqbody`,reqbody)
let reqAliclient = this.getAliDoubleCallClient()
if(!reqbody.bizType){
return system.getResultFail(-200, "bizType不能为空");
}
let reqAliclient = null
if(reqbody.bizType == 'TM_TRADE'){
reqAliclient = this.getAliDoubleCallClientForTMTRADE();
}else if(reqbody.bizType == 'EXPERT_APPLY'){
reqAliclient = this.getAliDoubleCallClientForTMREG();
}else {
return system.getResultFail(-200, `不支持的bizType=${reqbody.bizType}`);
}
res = await reqAliclient.request("StartBackToBackCall",reqbody, {
timeout: 10000, // default 3000 ms 2020 0916 lin修改3000为10000,原因ConfirmIcpIntention BizIds 超过5条会超时
formatAction: true, // default true, format the action to Action
......@@ -153,13 +183,13 @@ class aliyunClient {
method: 'POST', // set the http method, default is GET
headers: {}, // set the http request headers
});
console.log(`结束调用阿里云-发起双呼接口。参数reqbody=`,reqbody,'结果=',res)
console.log(`结束调用阿里云-发起双呼接口。参数reqbody=`,reqbody,'结果=',JSON.stringify(res))
this.execClientNew.execLogs(`获取可用外呼号码列表成功`, reqbody, "center-channel-aliyunClient-queryAvailabelNumbers", res, null);
return system.getResultSuccess(res.data);
return system.getResultSuccess(res.Data||res.data);
}catch (e){
console.log(`调用异常:阿里云-发起双呼接口。参数reqbody=`,reqbody,'结果=',res,`异常信息=${e.stack}`)
console.log(`调用异常:阿里云-发起双呼接口。参数reqbody=`,reqbody,'结果=',JSON.stringify(res),`异常信息=${e.stack}`)
this.execClientNew.execLogs(`调用阿里云发起双呼接口失败`, reqbody, "center-channel-aliyunClient-startBackToBackCall", res, JSON.stringify(e.stack));
return system.getResultFail(-200, "api调用出现异常,error:" + e.stack);
return system.getResultFail(-200, "api调用出现异常,error:" + JSON.stringify(e.data));
}
}
......
......@@ -28,7 +28,7 @@ module.exports = {
],
apiMustUserpinList: [
"icpOrderClose",
"submitNeed", "paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme", "serviceProviderSubmitMaterial", "abolishIcpProgramme",
"paySuccess", "icpNotify", "getLoginInfo", "icpNotifyNew", "submitIcpProgramme", "serviceProviderSubmitMaterial", "abolishIcpProgramme",
"submitService", "serviceProviderNotification",
"ncSubmitMaterial", "ncNotification", "ncSubmitSolution", "ncCloseNeed", "ncClosePlan",
"rtSubmitMaterial", "rtNotification", "rtSubmitSolution", "rtCloseNeed", "rtClosePlan",
......
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