Skip to content

Commit

Permalink
Merge pull request #989 from pxgo/master
Browse files Browse the repository at this point in the history
优化,修复
  • Loading branch information
pxgo authored Oct 10, 2024
2 parents d3e9474 + b808ad5 commit c6a5525
Show file tree
Hide file tree
Showing 24 changed files with 5,859 additions and 5,137 deletions.
27 changes: 21 additions & 6 deletions dataModels/DocumentModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1731,19 +1731,34 @@ schema.statics.insertSystemRecordContent = async (type, user, ctx) => {
const SettingModel = mongoose.model('settings');
const KcbsRecordModel = mongoose.model('kcbsRecords');
const UserModel = mongoose.model('users');
const KcbsTypeModel = mongoose.model('kcbsTypes');
// const KcbsTypeModel = mongoose.model('kcbsTypes');
const ScoreOperationLogModel = mongoose.model('scoreOperationLogs');
const { address: ip, port, data } = ctx;
if (!user) {
return;
}
// 获取积分策略对象
const operation = await SettingModel.getScoreOperationsByType(type);
if (!operation) return;
//获取后台积分设置
const enabledScores = await SettingModel.getEnabledScores();
const scores = {};
// 获取当天此人当前操作执行的次数
const operationLogCount = await ScoreOperationLogModel.getOperationLogCount(
user,
type,
);
if (operation.count !== -1 && operation.count <= operationLogCount) return;
for (const e of enabledScores) {
const scoreType = e.type;
scores[scoreType] = operation[scoreType];
}
let recordsId = [];
for (const enabledScore of enabledScores) {
const scoreType = enabledScore.type;
const kcbsType = await KcbsTypeModel.findOnly({ _id: type });
const number = kcbsType.num * 100;
// const kcbsType = await KcbsTypeModel.findOnly({ _id: type });
const number = scores[scoreType];
// const number = kcbsType.num * 100;
if (number === undefined) {
continue;
}
Expand Down Expand Up @@ -1828,9 +1843,9 @@ schema.statics.disabledToDraftDocuments = async function () {
delType: faultyStatus,
postType: { $in: [articleSource, commentSource] },
modifyType: false,
toc: {
$lte: Date.now() - 3 * 24 * 60 * 1000,
},
toc: {
$lte: Date.now() - 3 * 24 * 60 * 1000,
},
};
//查找对document的退修记录
const onLog = await DelPostLogModel.find(match);
Expand Down
8 changes: 8 additions & 0 deletions dataModels/MomentModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1834,6 +1834,7 @@ schema.statics.extendCommentsDataCommentsData = async function (
commentsData,
uid,
mode = momentCommentModes.simple,
managementMoment = false,
) {
const MomentModel = mongoose.model('moments');
const momentStatus = await MomentModel.getMomentStatus();
Expand Down Expand Up @@ -1872,6 +1873,13 @@ schema.statics.extendCommentsDataCommentsData = async function (
};
}

if (managementMoment) {
match.$or.push({
status: {
$in: [momentStatus.disabled, momentStatus.faulty, momentStatus.unknown],
},
});
}
const latestComments = await MomentModel.find(match);
const latestCommentsDataObj = {};
let latestCommentsData = await MomentModel.extendCommentsData(
Expand Down
Loading

0 comments on commit c6a5525

Please sign in to comment.