fix: 部分收付累计释额并扩展结算 E2E 与 CI
账期收付改为按累计已付同步 credit_ledger,修复多笔 partial_paid 与坏账核销重复释额;新增 API E2E(占成、权限、部分收付/坏账)与 GitHub Actions e2e-api job。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,8 +3,10 @@
|
||||
namespace E2E\Seeders;
|
||||
|
||||
use App\Models\AdminSite;
|
||||
use App\Models\AdminUser;
|
||||
use App\Models\Player;
|
||||
use App\Models\PlayerWallet;
|
||||
use App\Services\Agent\AgentNodeService;
|
||||
use App\Support\PlayerAuthSource;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -28,6 +30,7 @@ final class E2EPlayerSeeder extends Seeder
|
||||
$mockWalletPort = (string) env('E2E_MOCK_WALLET_PORT', '5555');
|
||||
|
||||
$this->ensureDemoIntegrationSite($siteCode, $currency, $mockWalletPort);
|
||||
$this->ensureE2ELeafAgent($siteCode, $password);
|
||||
|
||||
// LocalDemoSeeder 可能已建无 password_hash 的 demo_player;合并为一条可登录行。
|
||||
Player::query()
|
||||
@@ -135,4 +138,42 @@ final class E2EPlayerSeeder extends Seeder
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function ensureE2ELeafAgent(string $siteCode, string $password): void
|
||||
{
|
||||
$siteId = (int) AdminSite::query()->where('code', $siteCode)->value('id');
|
||||
if ($siteId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$exists = DB::table('admin_users')->where('username', 'e2e_leaf_agent')->exists();
|
||||
if ($exists) {
|
||||
return;
|
||||
}
|
||||
|
||||
$rootId = (int) DB::table('agent_nodes')
|
||||
->where('admin_site_id', $siteId)
|
||||
->where('depth', 0)
|
||||
->value('id');
|
||||
if ($rootId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$super = AdminUser::query()->where('username', 'admin')->first();
|
||||
if ($super === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
app(AgentNodeService::class)->createChild($super, [
|
||||
'parent_id' => $rootId,
|
||||
'code' => 'e2e_leaf',
|
||||
'name' => 'E2E Leaf Agent',
|
||||
'username' => 'e2e_leaf_agent',
|
||||
'password' => $password,
|
||||
'total_share_rate' => 25,
|
||||
'credit_limit' => 200_000,
|
||||
'rebate_limit' => 0.01,
|
||||
'default_player_rebate' => 0.005,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user