完善订单交接结账流程留痕

This commit is contained in:
yml2213
2026-08-28 23:48:32 +08:00
parent a9a9127076
commit c87883cc65
27 changed files with 915 additions and 5 deletions
@@ -5,6 +5,7 @@ import (
"hfb_sys/backend/internal/model"
"hfb_sys/backend/internal/modules/notification"
"hfb_sys/backend/internal/processlog"
"gorm.io/gorm"
"gorm.io/gorm/clause"
@@ -20,6 +21,7 @@ func (r *Repository) SubmitHandoff(ctx context.Context, userID uint64, orderID u
if order.OwnerID != userID {
return ErrPermissionDenied
}
before := orderState(order)
// 号主交接超时(owner_timeout)后仍允许补提交,避免临时延误导致订单卡死。
if order.Status != orderStatusPendingHandoff ||
(order.HandoffStatus != handoffStatusPendingOwner && order.HandoffStatus != handoffStatusOwnerTimeout) {
@@ -37,6 +39,9 @@ func (r *Repository) SubmitHandoff(ctx context.Context, userID uint64, orderID u
return err
}
order.HandoffStatus = handoffStatusPendingRenterConfirm
if err := appendOrderEvent(tx, order, "handoff", "owner_handoff_submitted", processlog.ActorUser, userID, processlog.ActorUser, &order.RenterID, req.Content, "", nil, before, nil); err != nil {
return err
}
orderID := order.ID
renterContent := "请查看交接记录,确认账号可正常登录后点击确认收号。"
if lateSubmit {