Commit 9ff451d1 by 宋毅

tj

parent 0c8679f1
......@@ -29,15 +29,7 @@ class AccessAuthAPI extends WEBBase {
switch (action_type) {
// sy
case "test"://测试
var rpcParam = {
accessKeyId: "LTAI4Fgz1uoUpfHpa79iq3XV",
accessKeySecret: "up8vlX0wzwCVtRAjKRXsCrFta6CHOY",
endpoint: "https://trademark.aliyuncs.com",
apiVersion: "2019-09-02"
};
opResult = await this.utilsTmAliyunSve.getAliOssInfo(null, "ICON", rpcParam);
var tmo = 0;
// opResult = system.getResultSuccess(null, "测试成功");
opResult = system.getResultSuccess(null, "测试成功");
break;
case "getNeedUserPinByChannelUserId"://渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var tmpOpResult = await this.utilsAuthSve.getLoginByUserName(pobj, pobj.actionBody);
......
......@@ -29,192 +29,7 @@ class ChannelAccessAuthAPI extends WEBBase {
switch (action_type) {
// sy
case "test"://测试
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, "测试成功");
opResult = system.getResultSuccess(null, "测试成功");
break;
case "getUserPinByAliCode"://渠道通过账户进行登录,有则返回用户信息,没有则创建用户
var aliUserResult = await this.utilsChannelAuthSve.getH5AliDingUserByCode(pobj, pobj.actionBody);
......
......@@ -26,6 +26,7 @@ class utilsTlBankSve extends AppServiceBase {
return orderResult;
}
pobj.actionBody.body_desc = orderResult.data.orderProduct.channelItemName;
pobj.actionBody.product_id = orderResult.data.orderProduct.id;
pobj.actionBody.total_fee = Number(orderResult.data.receiptVoucher.totalSum);
pobj.actionBody.order_num = orderResult.data.receiptVoucher.sourceOrderNo;
......
......@@ -406,7 +406,7 @@ class UtilsOrderService extends AppServiceBase {
return resultSign;
}
//获取充值业务锁
await this.cacheManager["TlPayLocker"].init(parmas.out_trade_no);//---测试时放开
// await this.cacheManager["TlPayLocker"].init(parmas.out_trade_no);//---测试时放开
var locker = await this.cacheManager["TlPayLocker"].enter(parmas.out_trade_no);
if (!locker || locker != "1") {
this.logCtl.info({
......@@ -462,7 +462,86 @@ class UtilsOrderService extends AppServiceBase {
return system.getResultFail(-200, e.stack);
}
}
async opH5AliDingPayBackNotify(parmas, client_ip) { //操作回调业务逻辑
try {
//日志记录
this.logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "阿里钉钉支付回调参数信息",
op: "center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/opH5AliDingPayBackNotify",
content: JSON.stringify(parmas),
clientIp: client_ip || ""
});
if (!parmas.app_id) {
return system.getResult(null, "app_id参数不能为空,100470");
}
var url = this.centerAppUrl + "payment/paymentApi/getAppInfo";
var opResult = await this.restPostUrl({ uappId: parmas.uappid }, url);
if (opResult.status != 0) {
opResult.msg = opResult.msg + ",100270";
return opResult;
}
var appInfo = opResult.data;
var resultSign = await this.verifySign(parmas, appInfo.uapp_secret);
if (!resultSign || resultSign.status != 0) {
return resultSign;
}
//获取充值业务锁
// await this.cacheManager["TlPayLocker"].init(parmas.out_trade_no);//---测试时放开
var locker = await this.cacheManager["TlPayLocker"].enter(parmas.out_trade_no);
if (!locker || locker != "1") {
this.logCtl.info({
appid: appInfo.uapp_id,
appkey: appInfo.uapp_key,
op: "center-channel/app/base/service/impl/utilsSve/utilsOrderSve.js/opBackNotify",
content: "参数=" + JSON.stringify(parmas),
clientIp: parmas.client_ip || "",
optitle: "通联回调操作频繁---太频繁了,太频繁了"
});
return system.getResultFail(-200, "回调操作频繁---太频繁了,太频繁了");
}
if (parmas.trxcode == "VSP501") {
parmas.pay_type = "wx";
} else {
parmas.pay_type = "alipay";
}
parmas.appInfo = appInfo;
parmas.orderNo = parmas.out_trade_no;
//修改并返回订单支付状态,创建收款单
var url = this.centerOrderUrl + "opaction/opPayOrder/receivePayCallBackNotify";
var opResult = await this.restPostUrl(parmas, url);
if (opResult.status == 0) {
opResult.data.appInfo = {
uapp_id: appInfo.uapp_id,
uapp_key: appInfo.uapp_key,
app_code: appInfo.app_code,
app_name: appInfo.app_name
}; interface_info
opResult.data.userInfo = {
channel_userid: opResult.data.order_info.channelUserId,
channel_username: opResult.data.order_info.channelUserId,
channel_nickname: opResult.data.order_info.channelUserId
};
var pobj = {
appInfo: opResult.data.appInfo,
actionBody: opResult.data
}
// this.utilsPushSve.pushBusInfo(opResult.data, "pushOrderBusiness",0);
this.utilsPushSve.pushBusInfo(pobj, "pushOrder", 0);
}
opResult.data = null;
return opResult;
} catch (e) {
await this.cacheManager["TlPayLocker"].release(parmas.out_trade_no);
this.logCtl.error({
optitle: "回调处理订单---error异常",
op: "center-app/app/base/service/impl/utilsSve/utilstlbankSve.js/opBackNotify",
content: "参数=" + JSON.stringify(parmas) + ",error:" + e.stack,
clientIp: client_ip || ""
});
return system.getResultFail(-200, e.stack);
}
}
async orderClose(pobj) {//阿里退款
if (!pobj.actionBody.orderNo) {
return system.getResult(null, "actionBody.prderNo can not be empty");
......
const AppServiceBase = require("../../app.base");
var settings = require("../../../../config/settings");
const system = require("../../../system");
//此类用来db中配置来进行调用-主要功能是商标业务
......@@ -40,14 +41,14 @@ class UtilsTmAliyunService extends AppServiceBase {
var businessLicenceOssKey = "";
var legalNoticeOssKey = "";
if (apply.customerType != "ent" && apply.identityCardPic) {
idCardOssKey = await this.getAliOssFileUrl(pobj, this.aliOssFileType.CARD, apply.identityCardPic, rpcParam);
idCardOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.CARD, apply.identityCardPic, rpcParam);
}
if (apply.customerType == "ent" && apply.businessLicensePic) {
businessLicenceOssKey = await this.getAliOssFileUrl(pobj, this.aliOssFileType.BUSINESS_LICENSE, apply.businessLicensePic, rpcParam);
businessLicenceOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.BUSINESS_LICENSE, apply.businessLicensePic, rpcParam);
}
if (apply.smwjUrl) {
legalNoticeOssKey = await this.getAliOssFileUrl(pobj, this.aliOssFileType.LEGAL_NOTICE, apply.smwjUrl, rpcParam);
legalNoticeOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.LEGAL_NOTICE, apply.smwjUrl, rpcParam);
}
var actionBody = {
ContactName: orderContact.contactName || "",//String 否 张三 联系人姓名
......@@ -90,10 +91,10 @@ class UtilsTmAliyunService extends AppServiceBase {
var picUrl = "";
var authorizationOssKey = "";
if (tmInfo.picUrl) {
picUrl = await this.getAliOssFileUrl(pobj, this.aliOssFileType.ICON, tmInfo.picUrl, rpcParam);
picUrl = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.ICON, tmInfo.picUrl, rpcParam);
}
if (gzwtsUrl) {
authorizationOssKey = await this.getAliOssFileUrl(pobj, this.aliOssFileType.ATTORNEY, gzwtsUrl, rpcParam);
authorizationOssKey = await this.getAliOssFileUrl("trade-mark-user-upload", pobj, this.aliOssFileType.ATTORNEY, gzwtsUrl, rpcParam);
}
// 商标类型形式: 3: 字, 4: 图, 5: 字图
var trademarkNameType = 1;
......@@ -134,14 +135,26 @@ class UtilsTmAliyunService extends AppServiceBase {
// }
// }
async getAliOssFileUrl(pobj, fileType, selfFileUrl, rpcParam) {
async getAliOssFileUrl(bucketName, pobj, fileType, selfFileUrl, rpcParam) {
var fileUrl = "";
var resultInfo = await this.getAliOssInfo(pobj, fileType, rpcParam);
if (resultInfo.status != 0) {
return fileUrl;
}
//TODO:上传文件到阿里云
let lastHostLength = resultInfo.data.Host.lastIndexOf('/');
let lastFileLength = selfFileUrl.lastIndexOf('/');
var params = {
"ossurl": selfFileUrl,
"endpoint": "https:" + resultInfo.data.Host.substring(0, lastHostLength),
"accessKeyId": resultInfo.data.AccessId,
"bucketName": bucketName,//"trade-mark-user-upload",
"filedir": resultInfo.data.FileDir,
"objectName": selfFileUrl.substring(lastFileLength + 1, selfFileUrl.length),
"encodePolicy": resultInfo.data.EncodedPolicy,
"signature": resultInfo.data.Signature
}
var aliOssFileInfo = await this.execPostUrl(params, settings.aliossjavaUrl());
return aliOssFileInfo;
}
async getAliOssInfo(pobj, fileType, rpcParam) {
var params = {
......
......@@ -10,20 +10,20 @@ module.exports = function (app) {
app.use('/tlpay/aliPayNotify', async function (req, res) {
try {
var client_ip = system.get_client_ip(req);
// var result = await utilsOrderSve.receiveCallBackNotify(req.body, client_ip);
var result = await utilsOrderSve.opH5AliDingPayBackNotify(req.body, client_ip);
logCtl.info({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "aliPayNotify记录回调",
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "记录阿里钉钉支付回调处理结果",
op: "center-channel/tlpay/aliPayNotify",
content: "回调参数:body=" + JSON.stringify(req.body) + ",query=" + JSON.stringify(req.query),
content: "支付回调处理结果:" + JSON.stringify(result),
clientIp: client_ip || ""
});
// if (result.status != 0) {
// return res.end("FAIL");
// }
if (result.status != 0) {
return res.end("FAIL");
}
return res.end("success");
} catch (error) {
logCtl.error({
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "aliPayNotify记录回调异常",
optitle: (new Date()).Format("yyyy-MM-dd hh:mm:ss") + "阿里钉钉支付回调处理异常",
op: "center-channel/tlpay/aliPayNotify",
content: "回调参数:req=" + JSON.stringify(req) + "error:" + error.stack,
clientIp: client_ip || ""
......
......@@ -20,6 +20,13 @@ var settings = {
usertimeout: 3600,//单位秒
basepath: path.normalize(path.join(__dirname, '../..')),
port: process.env.NODE_PORT || 4012,
aliossjavaUrl: function () {
if (this.env == "dev") {
return "http://192.168.0.102:8080/uploadfile";
} else {
return "http://aliossjava-service/uploadfile";
}
},
qifuPayAfterH5JumpUrl: function () {
if (this.env == "dev") {
return "http://tm.qifu.gongsibao.com:4012/#/home/indent_list";
......
已经使用的编码汇总:
已经使用的编码汇总:
......@@ -44,4 +44,5 @@
100430
100440
100450
100460
\ No newline at end of file
100460
100470
\ 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