feat: 添加结算功能,更新 TicketItem 模型以支持最新结算详情,增强 DrawTickService 以自动处理结算,更新 TicketWalletService 以支持派彩入账,扩展 API 路由以管理结算批次和奖池
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\Admin\Jackpot;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\JackpotPool;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* PUT /api/v1/admin/jackpot/pools/{pool} — 更新奖池运营参数(蓄水比例、阈值等)。
|
||||
*/
|
||||
final class AdminJackpotPoolUpdateController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, JackpotPool $pool): JsonResponse
|
||||
{
|
||||
$data = $request->validate([
|
||||
'current_amount' => 'sometimes|integer|min:0',
|
||||
'contribution_rate' => 'sometimes|numeric|min:0|max:1',
|
||||
'trigger_threshold' => 'sometimes|integer|min:0',
|
||||
'payout_rate' => 'sometimes|numeric|min:0|max:1',
|
||||
'force_trigger_draw_gap' => 'sometimes|integer|min:0',
|
||||
'min_bet_amount' => 'sometimes|integer|min:0',
|
||||
'status' => 'sometimes|integer|in:0,1',
|
||||
]);
|
||||
|
||||
$pool->fill($data);
|
||||
$pool->save();
|
||||
|
||||
return ApiResponse::success([
|
||||
'id' => (int) $pool->id,
|
||||
'currency_code' => $pool->currency_code,
|
||||
'current_amount' => (int) $pool->current_amount,
|
||||
'contribution_rate' => (string) $pool->contribution_rate,
|
||||
'trigger_threshold' => (int) $pool->trigger_threshold,
|
||||
'payout_rate' => (string) $pool->payout_rate,
|
||||
'force_trigger_draw_gap' => (int) $pool->force_trigger_draw_gap,
|
||||
'min_bet_amount' => (int) $pool->min_bet_amount,
|
||||
'status' => (int) $pool->status,
|
||||
'last_trigger_draw_id' => $pool->last_trigger_draw_id !== null ? (int) $pool->last_trigger_draw_id : null,
|
||||
'updated_at' => $pool->updated_at?->toIso8601String(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user