Commit fcfe5ca7 by 兰国旗

getGatewayPushLog

parent 408028a5
......@@ -15,7 +15,7 @@ class opLog extends WEBBase {
}
/**
* 获取推送失败日志列表
* 获取channel推送失败日志列表
* @param pobj
* @param qobj
* @param req
......@@ -27,7 +27,7 @@ class opLog extends WEBBase {
}
/**
* 重新推送
* channel重新推送
* @param pobj
* @param qobj
* @param req
......@@ -37,5 +37,29 @@ class opLog extends WEBBase {
let result = await this.pushlogSve.rePush(pobj.actionBody);
return result;
}
/**
* 获取gateway推送失败日志列表
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async getGatewayPushFailLogList(pobj,qobj,req){
let list = await this.pushlogSve.getGatewayPushFailLogList(pobj.actionBody);
return list;
}
/**
* gateway重新推送
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async reGatewayPush(pobj,qobj,req){
let result = await this.pushlogSve.reGatewayPush(pobj.actionBody);
return result;
}
}
module.exports = opLog;
\ No newline at end of file
......@@ -6,6 +6,7 @@ class PushlogService extends ServiceBase {
super("common", ServiceBase.getDaoName(PushlogService));
this.logCtl = system.getObject("service.common.oplogSve");
this.pushfaillogDao = system.getObject("db.common.pushfaillogDao");
this.gatewaypushlogDao = system.getObject("db.common.gatewaypushlogDao");
}
async createDb(qobj) {
try {
......@@ -51,6 +52,7 @@ class PushlogService extends ServiceBase {
return result;
}
//获取channel推送失败记录
async getPushFailLogList(actionBody) {
var sql = "SELECT id,appid,`content`,failType,pushNumber,opTitle,resultInfo,created_at FROM `center_channel_pushfaillog` WHERE pushNumber=10 ";
let whereParams = {};
......@@ -69,7 +71,7 @@ class PushlogService extends ServiceBase {
}
/**
* 重新推送
* channel重新推送
* @param actionBody
* @returns {Promise<void>}
*/
......@@ -89,6 +91,45 @@ class PushlogService extends ServiceBase {
return system.getResult(result);
}
//获取Gateway推送失败记录
async getGatewayPushFailLogList(actionBody) {
var sql = "SELECT id,requestUrl,requestjson,pushUrl,pushActionType,pushtimes,pushStatus,created_at,error FROM `gateway_pushlog` WHERE pushtimes=4 and pushStatus='wts'";
let whereParams = {};
if(actionBody.likeParams){
sql += " and requestjson like :likeParams";
whereParams.likeParams = "%"+ actionBody.likeParams +"%";
}
if(actionBody.likeError){
sql += " and error like :likeError";
whereParams.likeError = "%"+ actionBody.likeError +"%";
}
sql += " order by created_at desc"
var list = await this.gatewaypushlogDao.customQuery(sql,whereParams);
var result = system.getResultSuccess(list);
return result;
}
/**
* Gateway重新推送
* @param actionBody
* @returns {Promise<void>}
*/
async reGatewayPush(actionBody){
let content = actionBody.content;
let sql = 'update `gateway_pushlog` set pushtimes = :pushtimes';
let params = {
pushtimes: actionBody.pushNumber || 3
}
if(Object.keys(content).length>0){
sql += ',requestjson=:content';
params.content = JSON.stringify(actionBody.content);
}
sql += ' where id = :id';
params.id = actionBody.id;
let result = await this.customUpdate(sql,params);
return system.getResult(result);
}
async addPublicServiceLog(pobj, req) {
var sql = "INSERT INTO `igirl_api`.`center_channel_public_servicelog` (`appkey`,`pushUrl`,`pushContent`,`resultInfo`,`pushNumber`,`clientIp`,created_at)" +
......
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