离婚流程全面升级:①发起方专属确认弹窗(含对方拒绝后果+魅力/金币惩罚实时值)②被申请方三选弹窗(同意/不同意/稍后)③不同意=强制离婚申请人赔一半金币④所有惩罚数值从后台实时查询
This commit is contained in:
@@ -20,6 +20,7 @@ use App\Events\MarriageProposed;
|
||||
use App\Events\MarriageRejected;
|
||||
use App\Models\Marriage;
|
||||
use App\Models\UserPurchase;
|
||||
use App\Services\MarriageConfigService;
|
||||
use App\Services\MarriageService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
@@ -28,8 +29,23 @@ class MarriageController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly MarriageService $marriage,
|
||||
private readonly MarriageConfigService $config,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* 获取离婚相关惩罚配置(供前端展示风险提示)。
|
||||
* 返回协议离婚魅力惩罚、强制离婚魅力惩罚及各冷静期天数。
|
||||
*/
|
||||
public function divorceConfig(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'mutual_charm_penalty' => (int) $this->config->get('divorce_mutual_charm', 100),
|
||||
'forced_charm_penalty' => (int) $this->config->get('divorce_forced_charm', 300),
|
||||
'mutual_cooldown_days' => (int) $this->config->get('divorce_mutual_cooldown', 70),
|
||||
'forced_cooldown_days' => (int) $this->config->get('divorce_forced_cooldown', 90),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的婚姻状态(名片/用户列表用)。
|
||||
*/
|
||||
@@ -221,4 +237,20 @@ class MarriageController extends Controller
|
||||
|
||||
return response()->json($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 拒绝协议离婚申请(被申请方选择不同意 = 视为强制离婚)。
|
||||
* 申请人赔偿一半金币给对方,婚姻以 forced 类型解除。
|
||||
*/
|
||||
public function rejectDivorce(Request $request, Marriage $marriage): JsonResponse
|
||||
{
|
||||
$result = $this->marriage->rejectDivorce($marriage, $request->user());
|
||||
|
||||
if ($result['ok']) {
|
||||
$marriage->refresh();
|
||||
broadcast(new MarriageDivorced($marriage, 'forced'));
|
||||
}
|
||||
|
||||
return response()->json($result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user