卫星通信服务平台
This commit is contained in:
@@ -217,18 +217,18 @@ class HomeService extends Service {
|
||||
let { offset, limit, searchOptions, sortOptions } = body;
|
||||
offset = (offset - 1) * limit;
|
||||
let attributes = ['user_uid', 'sn_number', 'type', 'created_at'],
|
||||
where = {}, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['user_uid', 'sn_number'], key = ['type'], between = ['created_at'];
|
||||
where = {}, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['user_uid', 'sn_number'], 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;
|
||||
@@ -302,6 +302,19 @@ class HomeService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
// 保存未知消息
|
||||
async saveUnknown(form) {
|
||||
const { ctx } = this;
|
||||
try {
|
||||
const result = await ctx.model3.Unknown.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;
|
||||
@@ -309,15 +322,15 @@ class HomeService extends Service {
|
||||
let { offset, limit, searchOptions, sortOptions } = body;
|
||||
offset = (offset - 1) * limit;
|
||||
let attributes = ['original_msg', 'sn_number', 'msg_data', 'created_at'],
|
||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['original_msg', 'sn_number', 'msg_data'], key = [], between = ['created_at'];
|
||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
||||
substring = ['original_msg', 'sn_number', 'msg_data'], key = [], 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] };
|
||||
@@ -370,8 +383,8 @@ class HomeService extends Service {
|
||||
for (const key in requestMsg) {
|
||||
requestMsg[key].forEach(element => {
|
||||
sn_number.push(element.sn_number),
|
||||
msg_data.push(element.msg_data),
|
||||
created_at.push(element.origin_time)
|
||||
msg_data.push(element.msg_data),
|
||||
created_at.push(element.origin_time)
|
||||
});
|
||||
}
|
||||
where = { user_uid: uid, sn_number, msg_data, created_at };
|
||||
@@ -401,16 +414,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 }, dbOptions, joinSubstring = [];
|
||||
where = { organization: result.organization }, 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] };
|
||||
}
|
||||
}
|
||||
@@ -432,7 +445,7 @@ class HomeService extends Service {
|
||||
const result = await ctx.model.BSide.findOne({ where: { uid, status: { [Op.not]: 2 }, role: 1 } });
|
||||
if (!result || result.organization == null) return false;
|
||||
let attributes = ['length', 'sn_set'],
|
||||
where = { user_uid: uid }, dbOptions;
|
||||
where = { user_uid: uid }, dbOptions;
|
||||
dbOptions = { attributes, where };
|
||||
const snMsg = await ctx.model.BuserSNAdmin.findOne(dbOptions);
|
||||
if (!snMsg) return false;
|
||||
|
||||
Reference in New Issue
Block a user