feat:rock增加软删除和恢复删除
This commit is contained in:
@@ -28,7 +28,7 @@ func (s *RockService) CheckBindingAndVerifyUID(ctx context.Context, tokenID uint
|
||||
}
|
||||
|
||||
var token model.RockToken
|
||||
if err := s.db.WithContext(ctx).First(&token, tokenID).Error; err != nil {
|
||||
if err := s.db.WithContext(ctx).Unscoped().First(&token, tokenID).Error; err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func (s *RockService) CheckBindingAndVerifyUID(ctx context.Context, tokenID uint
|
||||
token.MismatchReason = ""
|
||||
token.MismatchAt = nil
|
||||
token.BoundAt = &now
|
||||
_ = s.db.WithContext(ctx).Model(&token).Updates(map[string]interface{}{
|
||||
_ = s.db.WithContext(ctx).Unscoped().Model(&token).Updates(map[string]interface{}{
|
||||
"expected_uid": trimmedExpected,
|
||||
"status": model.RockStatusBound,
|
||||
"mismatch_reason": "",
|
||||
@@ -169,7 +169,7 @@ func (s *RockService) CheckBindingAndVerifyUID(ctx context.Context, tokenID uint
|
||||
if trimmedExpected != "" && actualRoleID != trimmedExpected {
|
||||
// 严禁发货!跃迁为 mismatch
|
||||
mismatchReason := fmt.Sprintf("预期UID(%s) 与 扫码UID(%s/%s) 不一致", trimmedExpected, actualRoleName, actualRoleID)
|
||||
_ = s.db.WithContext(ctx).Model(&token).Updates(map[string]interface{}{
|
||||
_ = s.db.WithContext(ctx).Unscoped().Model(&token).Updates(map[string]interface{}{
|
||||
"status": model.RockStatusMismatch,
|
||||
"actual_role_name": actualRoleName,
|
||||
"actual_role_id": actualRoleID,
|
||||
@@ -194,7 +194,7 @@ func (s *RockService) CheckBindingAndVerifyUID(ctx context.Context, tokenID uint
|
||||
}
|
||||
|
||||
// 4. UID 一致,更新为 bound 成功状态并保存玩家角色名称
|
||||
_ = s.db.WithContext(ctx).Model(&token).Updates(map[string]interface{}{
|
||||
_ = s.db.WithContext(ctx).Unscoped().Model(&token).Updates(map[string]interface{}{
|
||||
"status": model.RockStatusBound,
|
||||
"actual_role_name": actualRoleName,
|
||||
"actual_role_id": actualRoleID,
|
||||
|
||||
Reference in New Issue
Block a user