常规推送
This commit is contained in:
@@ -203,18 +203,18 @@ class HomeService extends Service {
|
||||
let { offset, limit, searchOptions, sortOptions } = body;
|
||||
offset = (offset - 1) * limit;
|
||||
let attributes = ['card_id', 'type', 'created_at'],
|
||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['card_id'], key = ['type'], between = ['created_at'];
|
||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['card_id'], key = ['type'], between = ['created_at'];
|
||||
const uidLastCode = shunt(uid);
|
||||
attributes.forEach(element => {
|
||||
if (searchOptions[element]) {
|
||||
if(searchOptions[element] == '*空') {
|
||||
if(joinSubstring.includes(element)) {
|
||||
where[element] = null;
|
||||
if (searchOptions[element] == '*空') {
|
||||
if (joinSubstring.includes(element)) {
|
||||
where[element] = null;
|
||||
} else {
|
||||
where[element] = [null, ''];
|
||||
where[element] = [null, ''];
|
||||
}
|
||||
} else if(substring.includes(element)) {
|
||||
} else if (substring.includes(element)) {
|
||||
where[element] = { [Op.substring]: searchOptions[element] };
|
||||
} else if (key.includes(element)) {
|
||||
where[element] = searchOptions[element] == "1" ? uidLastCode === 'B' ? 1 : 2 : 0;
|
||||
@@ -275,6 +275,19 @@ class HomeService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
// 保存未知消息
|
||||
async saveUnknown(form) {
|
||||
const { ctx } = this;
|
||||
try {
|
||||
const result = await ctx.model3.UnknownBDCard.create(form);
|
||||
return result || false;
|
||||
} catch (error) {
|
||||
const blockName = fileName + "--" + "saveUnknown";
|
||||
ctx.app.middleware.log('../../serviceLog', blockName + ">>>>" + error);
|
||||
return 'error';
|
||||
}
|
||||
}
|
||||
|
||||
// 获取历史消息
|
||||
async getHistoryMsg(uid, body) {
|
||||
const { ctx } = this;
|
||||
@@ -282,15 +295,15 @@ class HomeService extends Service {
|
||||
let { offset, limit, searchOptions, sortOptions } = body;
|
||||
offset = (offset - 1) * limit;
|
||||
let attributes = ['card_id', 'encode_type', 'msg_data', 'created_at'],
|
||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['card_id', 'msg_data'], key = ['encode_type'], between = ['created_at'];
|
||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['card_id', 'msg_data'], key = ['encode_type'], between = ['created_at'];
|
||||
attributes.forEach(element => {
|
||||
if (searchOptions[element]) {
|
||||
if(searchOptions[element] == '*空') {
|
||||
if(joinSubstring.includes(element)) {
|
||||
where[element] = null;
|
||||
if (searchOptions[element] == '*空') {
|
||||
if (joinSubstring.includes(element)) {
|
||||
where[element] = null;
|
||||
} else {
|
||||
where[element] = [null, ''];
|
||||
where[element] = [null, ''];
|
||||
}
|
||||
} else if (substring.includes(element)) {
|
||||
where[element] = { [Op.substring]: searchOptions[element] };
|
||||
@@ -343,9 +356,9 @@ class HomeService extends Service {
|
||||
for (const key in requestMsg) {
|
||||
requestMsg[key].forEach(element => {
|
||||
card_id.push(element.card_id),
|
||||
encode_type.push(element.encode_type),
|
||||
msg_data.push(element.msg_data),
|
||||
created_at.push(element.origin_time)
|
||||
encode_type.push(element.encode_type),
|
||||
msg_data.push(element.msg_data),
|
||||
created_at.push(element.origin_time)
|
||||
});
|
||||
}
|
||||
where = { user_uid: uid, card_id, encode_type, msg_data, created_at };
|
||||
@@ -358,7 +371,7 @@ class HomeService extends Service {
|
||||
"T": ctx.model4.TShortMsg,
|
||||
};
|
||||
const resetList = await modelName[uidLastCode].destroy({ where });
|
||||
return resetList.length == 0 ? false : resetList;
|
||||
return resetList == 0 ? false : resetList;
|
||||
} catch (error) {
|
||||
const blockName = fileName + "--" + "delHistoryMsg";
|
||||
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||
@@ -375,16 +388,16 @@ class HomeService extends Service {
|
||||
let { offset, limit, searchOptions } = body;
|
||||
offset = (offset - 1) * limit;
|
||||
let attributes = ['account_name', 'user_name', 'phone'],
|
||||
where = { organization: result.organization, role: { [Op.not]: 1 } }, dbOptions, joinSubstring = [];
|
||||
where = { organization: result.organization, role: { [Op.not]: 1 } }, dbOptions, joinSubstring = [];
|
||||
attributes.forEach(element => {
|
||||
if (searchOptions[element]) {
|
||||
if(searchOptions[element] == '*空') {
|
||||
if(joinSubstring.includes(element)) {
|
||||
where[element] = null;
|
||||
if (searchOptions[element] == '*空') {
|
||||
if (joinSubstring.includes(element)) {
|
||||
where[element] = null;
|
||||
} else {
|
||||
where[element] = [null, ''];
|
||||
where[element] = [null, ''];
|
||||
}
|
||||
} else{
|
||||
} else {
|
||||
where[element] = { [Op.substring]: searchOptions[element] };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user