卫星通信服务平台
This commit is contained in:
@@ -222,7 +222,10 @@ class HomeController extends Controller {
|
|||||||
}
|
}
|
||||||
const uid = JSON.parse(rdmcode).uid;
|
const uid = JSON.parse(rdmcode).uid;
|
||||||
const body = ctx.request.body;
|
const body = ctx.request.body;
|
||||||
const result = await ctx.service.home.unBindingSN(uid, body);
|
const model = decryptRequest(body.model);
|
||||||
|
const password = decryptRequest(body.password);
|
||||||
|
const requestMsg = body.userMsg;
|
||||||
|
const result = await ctx.service.home.unBindingSN(uid, model, password, requestMsg);
|
||||||
if(result == "error") {
|
if(result == "error") {
|
||||||
setResponse(ctx, 500, '服务器错误', "none");
|
setResponse(ctx, 500, '服务器错误', "none");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -96,13 +96,12 @@ class HomeService extends Service {
|
|||||||
bindUser.push(element.dataValues);
|
bindUser.push(element.dataValues);
|
||||||
});
|
});
|
||||||
const resultData = [];
|
const resultData = [];
|
||||||
|
const bindUserUids = new Set(resultBindUser.map(element => element.dataValues.user_uid));
|
||||||
resultAdminUser.forEach(item => {
|
resultAdminUser.forEach(item => {
|
||||||
resultBindUser.forEach(element => {
|
if (!bindUserUids.has(item.dataValues.uid)) {
|
||||||
if (item.dataValues.uid !== element.dataValues.user_uid) {
|
|
||||||
resultData.push(item);
|
resultData.push(item);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
return resultData;
|
return resultData;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const blockName = fileName + "--" + "searchBindUser";
|
const blockName = fileName + "--" + "searchBindUser";
|
||||||
@@ -160,41 +159,50 @@ class HomeService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 解绑SN号
|
// 解绑SN号
|
||||||
async unBindingSN(uid, body) {
|
async unBindingSN(uid, modelType, password, requestMsg) {
|
||||||
const { ctx } = this;
|
const { ctx } = this;
|
||||||
try {
|
try {
|
||||||
const result = await ctx.model.BSide.findOne({ where: { uid, status: { [Op.not]: 2 }, role: 1 } });
|
const result = await ctx.model.BSide.findOne({ where: { uid, status: { [Op.not]: 2 }, role: 1 } });
|
||||||
if (!result || result.organization == null) return false;
|
if (!result || result.dataValues.password !== this.shaForm(password, this.decryptRequest(result.dataValues.salt))) return false;
|
||||||
const { snNumber, userUid } = body;
|
let where = {};
|
||||||
const snWhere = { sn_number: snNumber };
|
let attributes = ['uid'];
|
||||||
const snResult = await ctx.model3.SNNumber.update({ status: 0 }, { where: snWhere });
|
if (modelType == "single") {
|
||||||
if (snResult[0] !== 0) {
|
where = requestMsg;
|
||||||
const where = {
|
} else if (modelType == "multiple") {
|
||||||
user_uid: userUid,
|
let account_name = [], user_name = [], phone = [];
|
||||||
sn_number: snNumber
|
for (const key in requestMsg) {
|
||||||
};
|
requestMsg[key].forEach(element => {
|
||||||
const form = {
|
account_name.push(element.account_name),
|
||||||
user_uid: userUid,
|
user_name.push(element.user_name),
|
||||||
sn_number: snNumber,
|
phone.push(element.phone)
|
||||||
type: 0,
|
});
|
||||||
created_at: new Date()
|
|
||||||
};
|
|
||||||
const uidLastCode = shunt(userUid);
|
|
||||||
const model = {
|
|
||||||
"B": ctx.model.BuserSNBind,
|
|
||||||
"C": ctx.model2.CuserSNBind,
|
|
||||||
"T": ctx.model2.TuserSNBind,
|
|
||||||
};
|
|
||||||
const modelName = {
|
|
||||||
"B": ctx.model.BindBSNrecord,
|
|
||||||
"C": ctx.model2.BindCSNrecord
|
|
||||||
};
|
|
||||||
const bindResult = await model[uidLastCode].destroy({ where });
|
|
||||||
const recordResult = await modelName[uidLastCode].create(form);
|
|
||||||
return bindResult && recordResult ? true : false;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
where = { account_name, user_name, phone };
|
||||||
|
} else if (modelType == "all") {
|
||||||
|
where = { organization: result.dataValues.organization };
|
||||||
|
}
|
||||||
|
|
||||||
|
const userResult = await ctx.model.BSide.findAll({ attributes, where });
|
||||||
|
if (!userResult[0]) return false;
|
||||||
|
let user_uid = [];
|
||||||
|
userResult.forEach(element => {
|
||||||
|
user_uid.push(element.dataValues.uid);
|
||||||
|
});
|
||||||
|
attributes = ['sn_number'];
|
||||||
|
where = { user_uid };
|
||||||
|
const bindResult = await ctx.model.BuserSNBind.findAll({ attributes, where });
|
||||||
|
if (!bindResult[0]) return false;
|
||||||
|
let sn_number = [], recordForm = [];
|
||||||
|
bindResult.forEach((element, index) => {
|
||||||
|
sn_number.push(element.dataValues.sn_number);
|
||||||
|
recordForm.push({ user_uid: user_uid[index], sn_number: sn_number[index], type: 0, created_at: new Date() });
|
||||||
|
});
|
||||||
|
where = { user_uid, sn_number };
|
||||||
|
const unbindResult = await ctx.model.BuserSNBind.destroy({ where });
|
||||||
|
const recordResult = await ctx.model.BindBSNrecord.bulkCreate(recordForm);
|
||||||
|
where = { sn_number };
|
||||||
|
const cardResult = await ctx.model3.SNNumber.update({ status: 4 }, { where });
|
||||||
|
return unbindResult !== 0 && recordResult[0] && cardResult[0] !== 0 ? true : false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const blockName = fileName + "--" + "unBindingSN";
|
const blockName = fileName + "--" + "unBindingSN";
|
||||||
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
ctx.app.middleware.utils.log('../../../serviceLog', blockName + ">>>>" + error);
|
||||||
@@ -209,7 +217,7 @@ class HomeService extends Service {
|
|||||||
let { offset, limit, searchOptions, sortOptions } = body;
|
let { offset, limit, searchOptions, sortOptions } = body;
|
||||||
offset = (offset - 1) * limit;
|
offset = (offset - 1) * limit;
|
||||||
let attributes = ['user_uid', 'sn_number', 'type', 'created_at'],
|
let attributes = ['user_uid', 'sn_number', 'type', 'created_at'],
|
||||||
where = { user_uid: uid }, order = [], dbOptions, joinSubstring = [],
|
where = {}, order = [], dbOptions, joinSubstring = [],
|
||||||
substring = ['user_uid', 'sn_number'], key = ['type'], between = ['created_at'];
|
substring = ['user_uid', 'sn_number'], key = ['type'], between = ['created_at'];
|
||||||
const uidLastCode = shunt(uid);
|
const uidLastCode = shunt(uid);
|
||||||
attributes.forEach(element => {
|
attributes.forEach(element => {
|
||||||
@@ -393,7 +401,7 @@ class HomeService extends Service {
|
|||||||
let { offset, limit, searchOptions } = body;
|
let { offset, limit, searchOptions } = body;
|
||||||
offset = (offset - 1) * limit;
|
offset = (offset - 1) * limit;
|
||||||
let attributes = ['account_name', 'user_name', 'phone'],
|
let attributes = ['account_name', 'user_name', 'phone'],
|
||||||
where = { organization: result.organization, role: { [Op.not]: 1 } }, dbOptions, joinSubstring = [];
|
where = { organization: result.organization }, dbOptions, joinSubstring = [];
|
||||||
attributes.forEach(element => {
|
attributes.forEach(element => {
|
||||||
if (searchOptions[element]) {
|
if (searchOptions[element]) {
|
||||||
if(searchOptions[element] == '*空') {
|
if(searchOptions[element] == '*空') {
|
||||||
|
|||||||
1
controllerLog/2026/4/8.txt
Normal file
1
controllerLog/2026/4/8.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2026-4-8>>>15:45:36]>>>home--unBindingSN>>>>Error: WHERE parameter "sn_number" has invalid "undefined" value
|
||||||
1
serviceLog/2026/4/8.txt
Normal file
1
serviceLog/2026/4/8.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
[2026-4-8>>>15:28:20]>>>home--unBindingSN>>>>Error: WHERE parameter "sn_number" has invalid "undefined" value
|
||||||
Reference in New Issue
Block a user