fix(attendant): 订单池审查问题修复
接单排除取消中/已取消订单;已取消订单禁止变动共享名单;取消共享补 404;实习脱敏补收货人姓名与诉求并禁用关键词侧信道。
This commit is contained in:
@@ -478,14 +478,14 @@ EscortRecordSchema.statics.findByIdempotencyKey = async function (userId, idempo
|
||||
};
|
||||
|
||||
// 接单:只有「未分配」的订单能被接走,条件更新保证并发下只有一个陪诊师成功。
|
||||
// 与支付状态无关:订单是否付款不影响接单。
|
||||
// 与支付状态无关:订单是否付款不影响接单;取消中(requested)与已取消订单不可接。
|
||||
EscortRecordSchema.statics.acceptRecord = async function (id, attendant) {
|
||||
return await this.findOneAndUpdate(
|
||||
{
|
||||
_id: id,
|
||||
deletedAt: null,
|
||||
"attendant.id": null,
|
||||
cancelStatus: { $ne: "cancelled" },
|
||||
cancelStatus: { $nin: ["cancelled", "requested"] },
|
||||
status: { $ne: "cancelled" },
|
||||
},
|
||||
{
|
||||
@@ -501,10 +501,10 @@ EscortRecordSchema.statics.acceptRecord = async function (id, attendant) {
|
||||
);
|
||||
};
|
||||
|
||||
// 共享 / 取消共享:只有当前接单陪诊师本人能操作
|
||||
// 共享 / 取消共享:只有当前接单陪诊师本人能操作,已取消订单不再变动共享名单
|
||||
EscortRecordSchema.statics.addSharedWith = async function (id, attendantId, employeeIds) {
|
||||
return await this.findOneAndUpdate(
|
||||
{ _id: id, deletedAt: null, "attendant.id": attendantId },
|
||||
{ _id: id, deletedAt: null, "attendant.id": attendantId, cancelStatus: { $ne: "cancelled" }, status: { $ne: "cancelled" } },
|
||||
{
|
||||
$addToSet: { "attendant.sharedWith": { $each: employeeIds } },
|
||||
$set: { "meta.updatetime": Date.now() },
|
||||
@@ -515,7 +515,7 @@ EscortRecordSchema.statics.addSharedWith = async function (id, attendantId, empl
|
||||
|
||||
EscortRecordSchema.statics.removeSharedWith = async function (id, attendantId, employeeIds) {
|
||||
return await this.findOneAndUpdate(
|
||||
{ _id: id, deletedAt: null, "attendant.id": attendantId },
|
||||
{ _id: id, deletedAt: null, "attendant.id": attendantId, cancelStatus: { $ne: "cancelled" }, status: { $ne: "cancelled" } },
|
||||
{
|
||||
$pull: { "attendant.sharedWith": { $in: employeeIds } },
|
||||
$set: { "meta.updatetime": Date.now() },
|
||||
|
||||
Reference in New Issue
Block a user