Commit d9be0933 by 宋毅

tj

parent 3678af0c
......@@ -156,34 +156,34 @@ class AppServiceBase {
return system.getResult(null, errorMsg);
}
}
/**
* 阿里RPC调用-post请求
* @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
* @param {*} params {为阿里的接口参数}
*/
async opAliyunRpcReqByPost(pobj, params) {
try {
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
var aliyunClient = system.getObject("util.aliyunClient");
var rtn = await aliyunClient.reqCustomByPost(params);
return rtn;
} 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/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->opAliyunRpcReqByPost",
});
return system.getResult(null, errorMsg);
}
}
// /**
// * 阿里RPC调用-post请求
// * @param {*} pobj {action: rpcParam.action,reqbody: pobj.actionBody,rpcParam: rpcParam}
// * @param {*} params {为阿里的接口参数}
// */
// async opAliyunRpcReqByPost(pobj, params) {
// try {
// // var action = obj.action;
// // var reqbody = obj.reqbody;
// // var rpcParam = obj.rpcParam;
// var aliyunClient = system.getObject("util.aliyunClient");
// var rtn = await aliyunClient.reqCustomByPost(params);
// return rtn;
// } 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/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReqByPost",
// content: errorMsg,
// // clientIp: pobj.clientIp,
// optitle: pobj.opType + "推送操作异常->opAliyunRpcReqByPost",
// });
// return system.getResult(null, errorMsg);
// }
// }
/**
* 处理成功后的信息
* @param {*} pobj
......
......@@ -657,18 +657,24 @@ class UtilsTmAliyunService extends AppServiceBase {
self.disposePushResultFail(pobj, getDingTmStatusResult, "ali->opAliTmUpdateTask->getDingTmStatusResult", self.pushlogFailType.FAILLOG);
break;
}
if (getDingTmStatusResult.data.TrademarkApplications.TrademarkApplication[0].Note) {
var opNoteInfo = JSON.parse(getDingTmStatusResult.data.TrademarkApplications.TrademarkApplication[0].Note);
if (opNoteInfo.txt) {
var txtList = opNoteInfo.txt.split('\n');
var txtStr = "";
for (let l = 0; l < txtList.length; l++) {
const temptxtStr = txtList[l];
if (temptxtStr) {
txtStr = txtStr + temptxtStr;
var noteStr = getDingTmStatusResult.data.TrademarkApplications.TrademarkApplication[0].Note;
if (noteStr) {
if (noteStr.lastIndexOf('}') < 0) {
element.deliveryContent.tm[i].Note = noteStr;
}
else {
var opNoteInfo = JSON.parse(noteStr);
if (opNoteInfo.txt) {
var txtList = opNoteInfo.txt.split('\n');
var txtStr = "";
for (let l = 0; l < txtList.length; l++) {
const temptxtStr = txtList[l];
if (temptxtStr) {
txtStr = txtStr + temptxtStr;
}
}
element.deliveryContent.tm[i].Note = txtStr;
}
element.deliveryContent.tm[i].Note = txtStr;
}
}
element.deliveryContent.tm[i].BizId = getDingTmStatusResult.data.TrademarkApplications.TrademarkApplication[0].BizId;
......
......@@ -3,13 +3,16 @@ var RPCClient = require('@alicloud/pop-core').RPCClient;
const system = require("../system");
class aliyunClient {
constructor() {
this.aliclient = new RPCClient({
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
getAliClient() {
return new RPCClient({
accessKeyId: "LTAI1pJs7KQizBe2",//对应的aliuid 是 30039057
accessKeySecret: "MMNibebAPqR9AnX5YWHnSL2tHMSIoL",
endpoint: "https://companyreg.aliyuncs.com",
apiVersion: "2020-03-06"
});
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
async post(aliReqUrl, key, secret, actionBody) {
const client = new Client(key, secret);
......@@ -30,7 +33,7 @@ class aliyunClient {
var action = obj.action;
var reqbody = obj.reqbody;
try {
var reqAliclient = { ... this.aliclient };
var reqAliclient = this.getAliClient();// { ... this.aliclient };
if (obj.apiVersion) {
reqAliclient.apiVersion = obj.apiVersion;
}
......@@ -70,7 +73,7 @@ class aliyunClient {
var action = obj.action;
var reqbody = obj.reqbody;
var rpcParam = obj.rpcParam;
var reqAliclient = { ... this.aliclient };
var reqAliclient = this.getAliClient();// { ...self.aliclient };
if (rpcParam.accessKeyId) {
reqAliclient.accessKeyId = rpcParam.accessKeyId;
}
......@@ -94,31 +97,31 @@ class aliyunClient {
console.log(reqbody, "reqbody...........");
return system.getResultSuccess(res);
}
async reqCustomByPost(obj, cbk) {
var action = obj.action;
var reqbody = obj.reqbody;
var rpcParam = obj.rpcParam;
var reqAliclient = { ... this.aliclient };
if (rpcParam.accessKeyId) {
reqAliclient.accessKeyId = rpcParam.accessKeyId;
}
if (rpcParam.accessKeySecret) {
reqAliclient.accessKeySecret = rpcParam.accessKeySecret;
}
if (rpcParam.endpoint) {
reqAliclient.endpoint = rpcParam.endpoint;
}
if (rpcParam.apiVersion) {
reqAliclient.apiVersion = rpcParam.apiVersion;
}
var res = await reqAliclient.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: 'POST', // set the http method, default is GET
headers: {}, // set the http request headers
});
return system.getResultSuccess(res);
}
// async reqCustomByPost(obj, cbk) {
// var action = obj.action;
// var reqbody = obj.reqbody;
// var rpcParam = obj.rpcParam;
// var reqAliclient = { ... this.aliclient };
// if (rpcParam.accessKeyId) {
// reqAliclient.accessKeyId = rpcParam.accessKeyId;
// }
// if (rpcParam.accessKeySecret) {
// reqAliclient.accessKeySecret = rpcParam.accessKeySecret;
// }
// if (rpcParam.endpoint) {
// reqAliclient.endpoint = rpcParam.endpoint;
// }
// if (rpcParam.apiVersion) {
// reqAliclient.apiVersion = rpcParam.apiVersion;
// }
// var res = await reqAliclient.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: 'POST', // set the http method, default is GET
// headers: {}, // set the http request headers
// });
// return system.getResultSuccess(res);
// }
}
module.exports = aliyunClient;
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