修复:reject() 事务闭包未 return 导致函数返回 null 违反类型声明的类型报错
This commit is contained in:
@@ -91,7 +91,7 @@ class MarriageService
|
|||||||
$tier = \App\Models\WeddingTier::find($weddingTierId);
|
$tier = \App\Models\WeddingTier::find($weddingTierId);
|
||||||
if ($tier && $tier->is_active) {
|
if ($tier && $tier->is_active) {
|
||||||
if (($proposer->jjb ?? 0) < $tier->amount) {
|
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);
|
$weddingService = app(WeddingService::class);
|
||||||
// 预扣冻结:payerType=groom, ceremonyType=scheduled
|
// 预扣冻结:payerType=groom, ceremonyType=scheduled
|
||||||
$setupRes = $weddingService->setup($marriage, $weddingTierId, 'groom', 'scheduled');
|
$setupRes = $weddingService->setup($marriage, $weddingTierId, 'groom', 'scheduled');
|
||||||
if (!$setupRes['ok']) {
|
if (! $setupRes['ok']) {
|
||||||
throw new \Exception($setupRes['message']);
|
throw new \Exception($setupRes['message']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -227,9 +227,9 @@ class MarriageService
|
|||||||
if ($proposer = $marriage->user) {
|
if ($proposer = $marriage->user) {
|
||||||
$this->currency->change($proposer, 'gold', 0, CurrencySource::RING_LOST, "求婚被拒,戒指消失({$marriage->ringItem?->name})");
|
$this->currency->change($proposer, 'gold', 0, CurrencySource::RING_LOST, "求婚被拒,戒指消失({$marriage->ringItem?->name})");
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return ['ok' => true, 'message' => '已拒绝求婚。'];
|
return ['ok' => true, 'message' => '已拒绝求婚。'];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ──────────────────────────── 离婚 ──────────────────────────────────
|
// ──────────────────────────── 离婚 ──────────────────────────────────
|
||||||
|
|||||||
Reference in New Issue
Block a user