Commit 0166bafe by 任晓松

推送失败日志

parent 6d5e0e33
......@@ -5,6 +5,7 @@ const logCtl = system.getObject("service.common.oplogSve");
class opLog extends WEBBase {
constructor() {
super();
this.pushlogSve = system.getObject("service.common.pushlogSve");
}
async info(pobj, qobj, req) {
this.logCtl.info(pobj);
......@@ -12,5 +13,29 @@ class opLog extends WEBBase {
async error(pobj, qobj, req) {
this.logCtl.error(pobj);
}
/**
* 获取推送失败日志列表
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async getPushFailLogList(pobj,qobj,req){
let list = await this.pushlogSve.getPushFailLogList(pobj.actionBody);
return list;
}
/**
* 重新推送
* @param pobj
* @param qobj
* @param req
* @returns {Promise<void>}
*/
async rePush(pobj,qobj,req){
let result = await this.pushlogSve.rePush(pobj.actionBody);
return result;
}
}
module.exports = opLog;
\ No newline at end of file
......@@ -51,6 +51,45 @@ class PushlogService extends ServiceBase {
return result;
}
async getPushFailLogList(actionBody) {
var sql = "SELECT id,appid,`content`,failType,pushNumber,opTitle,resultInfo,created_at FROM `center_channel_pushfaillog` WHERE pushNumber=10 ";
let whereParams = {};
if(actionBody.appid){
sql += " and appid = :appid";
whereParams.appid = actionBody.appid;
}
if(actionBody.likeStr){
sql += " and content like :likeStr";
whereParams.likeStr = "%"+ actionBody.likeStr +"%";
}
sql += " order by created_at desc"
var list = await this.pushfaillogDao.customQuery(sql,whereParams);
var result = system.getResultSuccess(list);
return result;
}
/**
* 重新推送
* @param actionBody
* @returns {Promise<void>}
*/
async rePush(actionBody){
let content = actionBody.content;
let sql = 'update `center_channel_pushfaillog` set pushNumber = :pushNumber';
let params = {
pushNumber: actionBody.pushNumber || 9
}
if(Object.keys(content).length>0){
sql += ',content=: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)" +
"VALUES(:appkey,:pushUrl,:pushContent,:resultInfo,:pushNumber,:clientIp,:created_at)";
......
......@@ -169,6 +169,9 @@ class ServiceBase {
async customQuery(sql, paras, t) {
return this.dao.customQuery(sql, paras, t);
}
async customUpdate(sql, paras, t) {
return this.dao.customUpdate(sql, paras, t);
}
async findCount(whereObj = null) {
return this.dao.findCount(whereObj);
}
......
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