fix(settlement): 操作记录分页、流水动作与坏账幂等加固
- 新增 settlement-operations 合并列表 API,收付/调账接口改为标准分页 - actionable_only 流水在内存过滤后正确分页 - 已结账单流水不再展示补差/冲正快捷动作 - 坏账核销支持 idempotency_key 并写入 result_bill_id - 补充操作记录、流水与坏账幂等相关测试
This commit is contained in:
@@ -2,11 +2,14 @@
|
||||
|
||||
namespace App\Http\Controllers\Api\V1\E2E;
|
||||
|
||||
use App\Lottery\ErrorCode;
|
||||
use App\Lottery\DrawStatus;
|
||||
use App\Support\ApiResponse;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
/**
|
||||
* E2E 辅助:期号时间/状态快进。
|
||||
@@ -19,13 +22,13 @@ use Illuminate\Support\Facades\DB;
|
||||
*
|
||||
* 严格仅在 LOTTERY_E2E=true 时由 E2EServiceProvider 注册。
|
||||
*/
|
||||
final class E2EDrawController extends \App\Http\Controllers\Controller
|
||||
final class E2EDrawController extends Controller
|
||||
{
|
||||
public function closeNow(Request $request, string $drawNo): JsonResponse
|
||||
{
|
||||
$draw = DB::table('draws')->where('draw_no', $drawNo)->first();
|
||||
if (! $draw) {
|
||||
return ApiResponse::error('draw not found', 'e2e_draw_missing', null, 404);
|
||||
return ApiResponse::error('draw not found', ErrorCode::NotFound->value, null, 404);
|
||||
}
|
||||
|
||||
DB::table('draws')
|
||||
@@ -44,7 +47,7 @@ final class E2EDrawController extends \App\Http\Controllers\Controller
|
||||
{
|
||||
$draw = DB::table('draws')->where('draw_no', $drawNo)->first();
|
||||
if (! $draw) {
|
||||
return ApiResponse::error('draw not found', 'e2e_draw_missing', null, 404);
|
||||
return ApiResponse::error('draw not found', ErrorCode::NotFound->value, null, 404);
|
||||
}
|
||||
|
||||
DB::table('draws')
|
||||
@@ -62,7 +65,7 @@ final class E2EDrawController extends \App\Http\Controllers\Controller
|
||||
{
|
||||
$draw = DB::table('draws')->where('draw_no', $drawNo)->first();
|
||||
if (! $draw) {
|
||||
return ApiResponse::error('draw not found', 'e2e_draw_missing', null, 404);
|
||||
return ApiResponse::error('draw not found', ErrorCode::NotFound->value, null, 404);
|
||||
}
|
||||
|
||||
DB::table('draws')
|
||||
@@ -82,8 +85,9 @@ final class E2EDrawController extends \App\Http\Controllers\Controller
|
||||
{
|
||||
$draw = DB::table('draws')->where('draw_no', $drawNo)->first();
|
||||
if (! $draw) {
|
||||
return ApiResponse::error('draw not found', 'e2e_draw_missing', null, 404);
|
||||
return ApiResponse::error('draw not found', ErrorCode::NotFound->value, null, 404);
|
||||
}
|
||||
|
||||
return $this->inspectById((int) $draw->id);
|
||||
}
|
||||
|
||||
@@ -91,11 +95,11 @@ final class E2EDrawController extends \App\Http\Controllers\Controller
|
||||
public function tick(Request $request): JsonResponse
|
||||
{
|
||||
try {
|
||||
$exit = \Illuminate\Support\Facades\Artisan::call('lottery:draw-tick');
|
||||
$exit = Artisan::call('lottery:draw-tick');
|
||||
} catch (\Throwable $e) {
|
||||
return ApiResponse::error(
|
||||
'draw-tick failed: '.$e->getMessage(),
|
||||
'e2e_tick_failed',
|
||||
ErrorCode::InternalError->value,
|
||||
['trace' => array_slice(explode("\n", $e->getTraceAsString()), 0, 5)],
|
||||
500,
|
||||
);
|
||||
@@ -103,13 +107,14 @@ final class E2EDrawController extends \App\Http\Controllers\Controller
|
||||
|
||||
return ApiResponse::success([
|
||||
'exit_code' => $exit,
|
||||
'output' => \Illuminate\Support\Facades\Artisan::output(),
|
||||
'output' => Artisan::output(),
|
||||
]);
|
||||
}
|
||||
|
||||
private function inspectById(int $id): JsonResponse
|
||||
{
|
||||
$d = DB::table('draws')->where('id', $id)->first();
|
||||
|
||||
return ApiResponse::success([
|
||||
'id' => (int) $d->id,
|
||||
'draw_no' => $d->draw_no,
|
||||
|
||||
Reference in New Issue
Block a user