Commit d30d6203 by 宋毅

tj

parent 63de000a
......@@ -5,6 +5,7 @@ class ChannelAccessAuthAPI extends WEBBase {
super();
this.utilsChannelAuthSve = system.getObject("service.utilsSve.utilsChannelAuthSve");
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
this.utilsTmAliyunSve = system.getObject("service.utilsSve.utilsTmAliyunSve");//测试用
}
/**
* 接口跳转-POST请求
......@@ -28,7 +29,192 @@ class ChannelAccessAuthAPI extends WEBBase {
switch (action_type) {
// sy
case "test"://测试
opResult = system.getResultSuccess(null, "测试成功");
var rpcParam = {
accessKeyId: "LTAI4Fgz1uoUpfHpa79iq3XV",
accessKeySecret: "up8vlX0wzwCVtRAjKRXsCrFta6CHOY",
endpoint: "https://trademark.aliyuncs.com",
apiVersion: "2019-09-02"
};
var nclones = [
{
"code": "01",
"name": "化学原料",
"tbCode": "TB342020031820309Unv",
"nclCount": 1,
"nclThree": [
{
"code": "010018",
"name": "锕",
"pcode": "0103",
"disabled": true,
"fullname": "010018 锕"
}
],
"tmStatus": "dsccl",
"submitTime": "",
"tmRegistNum": "",
"deliveryType": "10",
"tmStatusName": "待上传材料",
"nclPublicExpense": 270
},
{
"code": "02",
"name": "颜料油漆",
"tbCode": "TB34202003182030ygCe",
"nclCount": 1,
"nclThree": [
{
"code": "020005",
"name": "食品用着色剂",
"pcode": "0203",
"disabled": true,
"fullname": "020005 食品用着色剂"
}
],
"tmStatus": "dsccl",
"submitTime": "",
"tmRegistNum": "",
"deliveryType": "10",
"tmStatusName": "待上传材料",
"nclPublicExpense": 270
},
{
"code": "04",
"name": "燃料油脂",
"tbCode": "TB342020031820301WD7",
"nclCount": 14,
"nclThree": [
{
"code": "040031",
"name": "焦炭",
"pcode": "0403",
"disabled": true,
"fullname": "040031 焦炭"
},
{
"code": "040032",
"name": "矿物燃料",
"pcode": "0403",
"disabled": true,
"fullname": "040032 矿物燃料"
},
{
"code": "040062",
"name": "褐煤",
"pcode": "0403",
"disabled": true,
"fullname": "040062 褐煤"
},
{
"code": "040072",
"name": "煤屑(燃料)",
"pcode": "0403",
"disabled": true,
"fullname": "040072 煤屑(燃料)"
},
{
"code": "040111",
"name": "生物质燃料",
"pcode": "0403",
"disabled": true,
"fullname": "040111 生物质燃料"
},
{
"code": "040117",
"name": "水烟炭",
"pcode": "0403",
"disabled": true,
"fullname": "040117 水烟炭"
},
{
"code": "",
"name": "熏制食品用木屑",
"pcode": "0403",
"disabled": true,
"fullname": "熏制食品用木屑"
},
{
"code": "",
"name": "烹饪用燃料",
"pcode": "0403",
"disabled": true,
"fullname": "烹饪用燃料"
},
{
"code": "",
"name": "炭球",
"pcode": "0403",
"disabled": true,
"fullname": "炭球"
},
{
"code": "",
"name": "加热用木球燃料",
"pcode": "0403",
"disabled": true,
"fullname": "加热用木球燃料"
},
{
"code": "",
"name": "固体燃料",
"pcode": "0403",
"disabled": true,
"fullname": "固体燃料"
},
{
"code": "",
"name": "壁炉用木柴",
"pcode": "0403",
"disabled": true,
"fullname": "壁炉用木柴"
},
{
"code": "",
"name": "木质颗粒燃料",
"pcode": "0403",
"disabled": true,
"fullname": "木质颗粒燃料"
},
{
"code": "",
"name": "燃料锭块",
"pcode": "0403",
"disabled": true,
"fullname": "燃料锭块"
}
],
"tmStatus": "dsccl",
"submitTime": "",
"tmRegistNum": "",
"deliveryType": "10",
"tmStatusName": "待上传材料",
"nclPublicExpense": 270
},
{
"code": "03",
"name": "日化用品",
"tbCode": "TB34202003182030FLnc",
"nclCount": 1,
"nclThree": [
{
"code": "030030",
"name": "香木",
"pcode": "0308",
"disabled": true,
"fullname": "030030 香木"
}
],
"tmStatus": "dsccl",
"submitTime": "",
"tmRegistNum": "",
"deliveryType": "10",
"tmStatusName": "待上传材料",
"nclPublicExpense": 270
}
];
opResult = await this.utilsTmAliyunSve.getClassifications(null, nclones, rpcParam);
var tmo = 0;
// opResult = system.getResultSuccess(null, "测试成功");
break;
case "getUserPinByAliCode"://渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var aliUserResult = await this.utilsChannelAuthSve.getH5AliDingUserByCode(pobj, pobj.actionBody);
......
......@@ -86,23 +86,23 @@ class AppServiceBase {
return rtn;
} catch (e) {
this.pushlogSve.createDb({
appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uapp_key,
op: JSON.stringify(pobj.interface_info),//推送的接口信息
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
op: pobj.interface_info ? JSON.stringify(pobj.interface_info) : "",//推送的接口信息
content: JSON.stringify(pobj),//推送的参数信息
resultInfo: "error:" + e.stack,
returnType: '0',
opTitle: pobj.opType + "推送操作异常->opAliyunClientPost"
opTitle: pobj.opType + "推送操作异常->opAliyunRpcReq"
});
//日志记录
this.logCtl.error({
appid: pobj.appInfo ? pobj.appInfo.uapp_id || "" : "",
appkey: pobj.appInfo ? pobj.appInfo.uapp_key || "" : "",
requestId: pobj.requestId || "",
op: "center-channel/app/base/service/impl/utilsSve/opAliyunClientPost.js/" + methodName,
op: "center-channel/app/base/service/impl/utilsSve/opAliyunClientPost.js/opAliyunRpcReq",
content: "error:" + e.stack,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->opAliyunClientPost",
optitle: pobj.opType + "推送操作异常->opAliyunRpcReq",
});
return system.getResult(null, "推送error");
}
......
const AppServiceBase = require("../../app.base");
const system = require("../../../system");
//此类用来db中配置来进行调用-主要功能是商标业务
class UtilsTmAliyunService extends AppServiceBase {
......@@ -76,25 +77,10 @@ class UtilsTmAliyunService extends AppServiceBase {
reqbody: actionBody,
rpcParam: rpcParam
}
this.opAliyunRpcReq(pobj, params);
}
async getAliOssFileUrl(pobj, fileType, selfFileUrl, rpcParam) {
var fileUrl = "";
var resultInfo = await this.getAliOssInfo(pobj, fileType, rpcParam);
if (resultInfo.status != 0) {
return fileUrl;
}
//TODO:上传文件到阿里云
}
async getAliOssInfo(pobj, fileType, rpcParam) {
var params = {
action: "GenerateUploadFilePolicy",
reqbody: { FileType: fileType },
rpcParam: rpcParam
}
var resultInfo = this.opAliyunRpcReq(pobj, params);
return resultInfo;
var applicantResult = await this.opAliyunRpcReq(pobj, params);
var classifications = await this.getClassifications(pobj, pobj.actionBody.delivery_content.nclones, rpcParam);
var tmCreateResult = await this.tmCreate(pobj, rpcParam, apply.gzwtsUrl, classifications, 1);
var tmp = 0;
}
async tmCreate(pobj, rpcParam, gzwtsUrl, classifications, applicantId) {//创建商标申请信息
var tmInfo = pobj.actionBody.delivery_content.tm;
......@@ -139,5 +125,77 @@ class UtilsTmAliyunService extends AppServiceBase {
}
this.opAliyunRpcReq(pobj, params);
}
async getAliOssFileUrl(pobj, fileType, selfFileUrl, rpcParam) {
var fileUrl = "";
var resultInfo = await this.getAliOssInfo(pobj, fileType, rpcParam);
if (resultInfo.status != 0) {
return fileUrl;
}
//TODO:上传文件到阿里云
}
async getAliOssInfo(pobj, fileType, rpcParam) {
var params = {
action: "GenerateUploadFilePolicy",
reqbody: { FileType: fileType },
rpcParam: rpcParam
}
var resultInfo = this.opAliyunRpcReq(pobj, params);
return resultInfo;
}
async getClassifications(pobj, nclones, rpcParam) {
var self = this;
var aliNclThreesList = {};
var aliNclTwosList = [];
for (let i = 0; i < nclones.length; i++) {
const nclOneItem = nclones[i];
var nclThreeList = nclOneItem.nclThree;
var getAliThreeList = [];
for (let j = 0; j < nclThreeList.length; j++) {
const nclThreeItem = nclThreeList[j];
var aliThreeList = null;
var aliNclTwosListIndex = aliNclTwosList.findIndex(f => f.pcode === nclThreeItem.pcode);
if (aliNclTwosListIndex < 0) {
var aliNclDataResult = await self.getAliNclInfo(pobj, nclThreeItem.pcode, rpcParam);
if (aliNclDataResult.status == 0) {
aliThreeList = aliNclDataResult.data;
aliNclTwosList.push({
pcode: nclThreeItem.pcode,
nclThree: aliThreeList
});
}
}//获取ali 的信息
else {
aliThreeList = aliNclTwosList[aliNclTwosListIndex].nclThree;
}
if (!aliThreeList) {
continue;
}
for (let k = 0; k < aliThreeList.length; k++) {
const aliNclThree = aliThreeList[k];
if (aliNclThree.ClassificationName == nclThreeItem.name) {
getAliThreeList.push(aliNclThree.ClassificationCode);
break;
}
}
}//一个大类下小项组装完毕
aliNclThreesList["\"" + nclOneItem.code + "\""] = "\"" + getAliThreeList.join(',') + "\"";
}
return aliNclThreesList;
}
async getAliNclInfo(pobj, parentCode, rpcParam) {
var params = {
action: "ListClassifications",
reqbody: { ParentCode: parentCode },
rpcParam: rpcParam
}
var nclInfoResult = await this.opAliyunRpcReq(pobj, params);
if (nclInfoResult.status != 0 || !nclInfoResult.data || nclInfoResult.data.TotalCount == 0) {
return system.getResult(null, "ali ncl is empty,100465")
}
return system.getResultSuccess(nclInfoResult.data.Classifications.Classification);
}
}
module.exports = UtilsTmAliyunService;
......@@ -75,19 +75,14 @@ class aliyunClient {
if (rpcParam.apiVersion) {
this.aliclient.apiVersion = rpcParam.apiVersion;
}
try {
var res = await this.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
});
return system.getResultSuccess(res);
} catch (e) {
return system.getResultFail(-200, "出现异常,error:" + e.stack);
}
var res = await this.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
});
return system.getResultSuccess(res);
}
}
......
已经使用的编码汇总:
已经使用的编码汇总:
......@@ -42,4 +42,6 @@
100410
100420
100430
100440
\ No newline at end of file
100440
100450
100460
\ No newline at end of file
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