Commit 2593f63e by 宋毅

tj

parent f37530a5
var WEBBase = require("../../web.base"); var APIBase = require("../../api.base");
var system = require("../../../system"); var system = require("../../../system");
class AccessAuthAPI extends WEBBase { class AccessAuthAPI extends APIBase {
constructor() { constructor() {
super(); super();
this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve"); this.utilsAuthSve = system.getObject("service.utilsSve.utilsAuthSve");
this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve"); this.gatewaypushlogSve = system.getObject("service.common.gatewaypushlogSve");
this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve"); this.utilsPushSve = system.getObject("service.utilsSve.utilsPushSve");
this.pushlogSve = system.getObject("service.common.pushlogSve");
this.aliclient = system.getObject("util.aliyunClient"); this.aliclient = system.getObject("util.aliyunClient");
} }
async taskAliIcapi() { async taskAliIcapi() {
...@@ -14,6 +15,9 @@ class AccessAuthAPI extends WEBBase { ...@@ -14,6 +15,9 @@ class AccessAuthAPI extends WEBBase {
} }
async taskAgainPushOneNewBusInfo(pobj, qobj, req) {//再次推送新rpc业务数据 async taskAgainPushOneNewBusInfo(pobj, qobj, req) {//再次推送新rpc业务数据
var rtn = await this.utilsPushSve.againPushBusInfo(pobj); var rtn = await this.utilsPushSve.againPushBusInfo(pobj);
if (rtn.status == 0) {
this.pushlogSve.delDbPushfaillogById(Number(pobj.id || 0));
}
return rtn; return rtn;
} }
async taskAgainPushOneOldBusInfo(pobj, qobj, req) {//再次推送老rpc业务数据 async taskAgainPushOneOldBusInfo(pobj, qobj, req) {//再次推送老rpc业务数据
......
...@@ -34,6 +34,13 @@ class ProductAPI extends WEBBase { ...@@ -34,6 +34,13 @@ class ProductAPI extends WEBBase {
this.utilsPushSve.pushBusInfo(pobj, "closeAliTmApply", 1); this.utilsPushSve.pushBusInfo(pobj, "closeAliTmApply", 1);
} }
break; break;
case "checkTmNameByAli"://检测商标名称是否合规
var pushInterfaceResult = await this.utilsOpOrderSve.getProductInterface(pobj, pobj.actionBody.product_id);
if (pushInterfaceResult.status != 0) {
pobj.actionBody.product_info.interface_info = pushInterfaceResult.data;
this.utilsPushSve.pushBusInfo(pobj, "closeAliTmApply", 1);
}
break;
case "updateContacts"://修改订单联系人 case "updateContacts"://修改订单联系人
opResult = await this.utilsOpOrderSve.updateContacts(pobj, pobj.actionBody); opResult = await this.utilsOpOrderSve.updateContacts(pobj, pobj.actionBody);
break; break;
......
...@@ -10,7 +10,7 @@ module.exports = (db, DataTypes) => { ...@@ -10,7 +10,7 @@ module.exports = (db, DataTypes) => {
resultInfo: DataTypes.TEXT('long'), resultInfo: DataTypes.TEXT('long'),
clientIp: DataTypes.STRING, clientIp: DataTypes.STRING,
opTitle: DataTypes.STRING(500), opTitle: DataTypes.STRING(500),
failType: DataTypes.INTEGER,//错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志 failType: DataTypes.INTEGER,//错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志,业务处理失败日志
pushNumber: DataTypes.INTEGER,//推送次数 pushNumber: DataTypes.INTEGER,//推送次数
}, { }, {
paranoid: false,//假的删除 paranoid: false,//假的删除
......
...@@ -44,20 +44,50 @@ class AppServiceBase { ...@@ -44,20 +44,50 @@ class AppServiceBase {
return system.getResultSuccess(); return system.getResultSuccess();
} }
async restPostUrl(pobj, url) { async restPostUrl(pobj, url) {
var rtn = await this.restClient.execPost(pobj, url); try {
if (!rtn || !rtn.stdout) { var rtn = await this.restClient.execPost(pobj, url);
return system.getResult(null, "restPost data is empty"); if (!rtn || !rtn.stdout) {
return system.getResult(null, "restPost 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/restPostUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostUrl",
});
return system.getResult(null, errorMsg);
} }
var result = JSON.parse(rtn.stdout);
return result;
} }
async execPostUrl(pobj, url) { async execPostUrl(pobj, url) {
var rtn = await this.execClient.execPost(pobj, url); try {
if (!rtn || !rtn.stdout) { var rtn = await this.execClient.execPost(pobj, url);
return system.getResult(null, "execPost data is empty"); if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost 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/restPostUrl",
content: errorMsg,
// clientIp: pobj.clientIp,
optitle: pobj.opType + "推送操作异常->restPostUrl",
});
return system.getResult(null, errorMsg);
} }
var result = JSON.parse(rtn.stdout);
return result;
} }
async opAliyunRpcVerifyParam(pobj) {//参数信息验证 async opAliyunRpcVerifyParam(pobj) {//参数信息验证
var verify = system.getResultSuccess(); var verify = system.getResultSuccess();
...@@ -128,6 +158,7 @@ class AppServiceBase { ...@@ -128,6 +158,7 @@ class AppServiceBase {
} }
} }
async disposePushResult(pobj, result, opTitleDesc) {//处理结果信息--内部使用 async disposePushResult(pobj, result, opTitleDesc) {//处理结果信息--内部使用
var opType = pobj.opType || "";
if (result.status != 0) { if (result.status != 0) {
this.pushlogSve.createFailLogDb({ this.pushlogSve.createFailLogDb({
appid: pobj.appInfo.uapp_id, appid: pobj.appInfo.uapp_id,
...@@ -137,7 +168,7 @@ class AppServiceBase { ...@@ -137,7 +168,7 @@ class AppServiceBase {
resultInfo: JSON.stringify(result), resultInfo: JSON.stringify(result),
clientIp: pobj.clientIp || "", clientIp: pobj.clientIp || "",
failType: 2, failType: 2,
opTitle: pobj.opType + "推送操作失败->" + opTitleDesc, opTitle: opType + "推送操作失败->" + opTitleDesc,
pushNumber: pobj.pushNumber || 1 pushNumber: pobj.pushNumber || 1
}); });
result.data = null; result.data = null;
...@@ -147,16 +178,24 @@ class AppServiceBase { ...@@ -147,16 +178,24 @@ class AppServiceBase {
appid: pobj.appInfo.uapp_id, appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uapp_key, appkey: pobj.appInfo.uapp_key,
requestId: pobj.requestId || "", requestId: pobj.requestId || "",
op: JSON.stringify(pobj.interface_info),//推送的接口信息 op: "推送业务类型:" + opType,
content: JSON.stringify(pobj),//推送的参数信息 content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result), resultInfo: JSON.stringify(result),
returnType: '1', returnType: '1',
opTitle: pobj.opType + "数据推送成功->" + opTitleDesc opTitle: opType + "数据推送成功->" + opTitleDesc
}); });
result.data = null; result.data = null;
return result; return result;
} }
async disposePushResultFail(pobj, result, opTitleDesc) {//处理失败的结果信息--内部使用 /**
* 处理失败的结果信息--内部使用
* @param {*} pobj
* @param {*} result
* @param {*} opTitleDesc
* @param {*} failType 错误类型,1为old-rpc推送失败日志,2为new-rpc推送失败日志,业务处理失败日志
*/
async disposePushResultFail(pobj, result, opTitleDesc, failType) {//处理失败的结果信息--内部使用
var opType = pobj.opType || "";
this.pushlogSve.createFailLogDb({ this.pushlogSve.createFailLogDb({
appid: pobj.appInfo.uapp_id, appid: pobj.appInfo.uapp_id,
appkey: pobj.appInfo.uapp_key, appkey: pobj.appInfo.uapp_key,
...@@ -164,8 +203,8 @@ class AppServiceBase { ...@@ -164,8 +203,8 @@ class AppServiceBase {
content: JSON.stringify(pobj),//推送的参数信息 content: JSON.stringify(pobj),//推送的参数信息
resultInfo: JSON.stringify(result), resultInfo: JSON.stringify(result),
clientIp: pobj.clientIp || "", clientIp: pobj.clientIp || "",
failType: 2, failType: failType || 2,
opTitle: pobj.opType + "推送操作失败->" + opTitleDesc, opTitle: opType + "推送操作失败->" + opTitleDesc,
pushNumber: pobj.pushNumber || 1 pushNumber: pobj.pushNumber || 1
}); });
result.data = null; result.data = null;
......
...@@ -41,10 +41,8 @@ class PushlogService extends ServiceBase { ...@@ -41,10 +41,8 @@ class PushlogService extends ServiceBase {
}); });
} }
} }
async delDbById(id) { async delDbPushfaillogById(id) {
var sql = "DELETE FROM `c?enter_channel_pushlog` WHERE id=:id"; this.pushfaillogDao.bulkDeleteByWhere({ where: { id: id } });
// var paramWhere = { id: id ??};
this.bulkDeleteByWhere({ where: { id: id } });//customQuery(sql, paramWhere);
} }
} }
module.exports = PushlogService; module.exports = PushlogService;
...@@ -25,7 +25,13 @@ class UtilsOpOrderService extends AppServiceBase { ...@@ -25,7 +25,13 @@ class UtilsOpOrderService extends AppServiceBase {
} }
var reqUrl = this.centerOrderUrl + "opaction/opOrder/springBoard"; var reqUrl = this.centerOrderUrl + "opaction/opOrder/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
this.opUpdatePushInfo(result, pobj, actionBody, "pushUpdateOrderContacts"); if (result.status != 0) {
result.data = null;
return result;
}
if (result.data.orderStatus == 2) {
this.opUpdatePushInfo(result, pobj, actionBody, "pushUpdateOrderContacts");
}//状态为付款的订单进行推送
result.data = null; result.data = null;
return result; return result;
} }
...@@ -35,7 +41,14 @@ class UtilsOpOrderService extends AppServiceBase { ...@@ -35,7 +41,14 @@ class UtilsOpOrderService extends AppServiceBase {
} }
var reqUrl = this.centerOrderUrl + "opaction/opOrder/springBoard"; var reqUrl = this.centerOrderUrl + "opaction/opOrder/springBoard";
var result = await this.restPostUrl(pobj, reqUrl); var result = await this.restPostUrl(pobj, reqUrl);
this.opUpdatePushInfo(result, pobj, "pushUpdateOrder"); if (result.status != 0) {
result.data = null;
return result;
}
if (result.data.orderStatus == 2) {
this.opUpdatePushInfo(result, pobj, "pushUpdateOrder");
this.opUpdatePushInfo(result, pobj, "updateAliTmApplicant");
}//状态为付款的订单进行推送
result.data = null; result.data = null;
return result; return result;
} }
...@@ -56,7 +69,6 @@ class UtilsOpOrderService extends AppServiceBase { ...@@ -56,7 +69,6 @@ class UtilsOpOrderService extends AppServiceBase {
appInfo: pobj.appInfo, appInfo: pobj.appInfo,
actionBody: result.data actionBody: result.data
} }
delete result.data["orderStatus"];
this.utilsPushSve.pushBusInfo(tmpPobj, opType, 1); this.utilsPushSve.pushBusInfo(tmpPobj, opType, 1);
} }
} }
......
...@@ -525,6 +525,7 @@ class UtilsOrderService extends AppServiceBase { ...@@ -525,6 +525,7 @@ class UtilsOrderService extends AppServiceBase {
channel_username: opOrderResult.data.order_info.channelUserId, channel_username: opOrderResult.data.order_info.channelUserId,
channel_nickname: opOrderResult.data.order_info.channelUserId channel_nickname: opOrderResult.data.order_info.channelUserId
}; };
opOrderResult.data.orderNo = opResult.data.orderNo;
var pobj = { var pobj = {
appInfo: opOrderResult.data.appInfo, appInfo: opOrderResult.data.appInfo,
actionBody: opOrderResult.data actionBody: opOrderResult.data
......
...@@ -39,11 +39,9 @@ class UtilsPushService extends AppServiceBase { ...@@ -39,11 +39,9 @@ class UtilsPushService extends AppServiceBase {
if (result.status != 0) { if (result.status != 0) {
return result; return result;
} }
await this.pushlogSve.delDbById(Number(pobj.id || 0));
return system.getResultSuccess(); return system.getResultSuccess();
} }
async reflexAction(interface_info, opType, pobj, isDelProductInfo) { async reflexAction(interface_info, opType, pobj, isDelProductInfo) {
var refResult = null; var refResult = null;
pobj.interface_info = interface_info; pobj.interface_info = interface_info;
......
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