修复:reject() 事务闭包未 return 导致函数返回 null 违反类型声明的类型报错

This commit is contained in:
2026-03-01 18:29:19 +08:00
parent a60a2c8173
commit 00231e0836
+4 -4
View File
@@ -91,7 +91,7 @@ class MarriageService
$tier = \App\Models\WeddingTier::find($weddingTierId);
if ($tier && $tier->is_active) {
if (($proposer->jjb ?? 0) < $tier->amount) {
return ['ok' => false, 'message' => "金币不足,该婚礼档位需要 {$tier->amount} 金币。", 'marriage_id' => null];
return ['ok' => false, 'message' => "金币不足,该婚礼档位需要 {$tier->amount} 金币。", 'marriage_id' => null];
}
}
}
@@ -117,7 +117,7 @@ class MarriageService
$weddingService = app(WeddingService::class);
// 预扣冻结:payerType=groom, ceremonyType=scheduled
$setupRes = $weddingService->setup($marriage, $weddingTierId, 'groom', 'scheduled');
if (!$setupRes['ok']) {
if (! $setupRes['ok']) {
throw new \Exception($setupRes['message']);
}
}
@@ -227,9 +227,9 @@ class MarriageService
if ($proposer = $marriage->user) {
$this->currency->change($proposer, 'gold', 0, CurrencySource::RING_LOST, "求婚被拒,戒指消失({$marriage->ringItem?->name}");
}
});
return ['ok' => true, 'message' => '已拒绝求婚。'];
return ['ok' => true, 'message' => '已拒绝求婚。'];
});
}
// ──────────────────────────── 离婚 ──────────────────────────────────