<?php


namespace App\Http\Controllers\admin;
use App\Http\Controllers\Controller;
use App\Models\Collect;
use App\Services\CollectService;
use App\Services\RechargeService;
use App\Services\RoomService;
use App\Services\IssueService;
use App\Services\ConfigService;
use Google\Service\ServiceManagement\ConfigSource;

class Sync extends Controller 
{
    public function collect()
    {
        $result = CollectService::syncCollectStay();
        return $this->success($result);
    }

    public function recharge()
    {
        $synced = RechargeService::syncPendingUsdtRechargeRecords();
        RechargeService::syncRechargeStay();
        return $this->success($synced);
    }


    public function settle()
    {
        RoomService::noticeSettle();
        return $this->success();
    }

    public function five()
    {
        // IssueService::syncCountdownIssue(); // 提前20秒提醒

        // IssueService::syncCloseIssue(); // 同步停止
        // Log::error('✅ 获取到最新期号: ' . ($latestIssue ?? '无'));

        // 你的业务逻辑
        // IssueService::getLatestIssue2(); // 获取最新的期号

        // IssueService::syncCountdownIssue(); // 提前20秒提醒

        // IssueService::syncCloseIssue(); // 同步停止
            // Log::error('✅ 获取到最新期号: ' . ($latestIssue ?? '无'));

            // 你的业务逻辑
       $res = IssueService::getLatestIssue(); // 获取最新的期号
        return $this->success($res);
    }

    public function close()
    {
        IssueService::syncCountdownIssue(); // 提前20秒提醒

        IssueService::syncCloseIssue(); // 同步停止
        return $this->success();
    }

    public function cd()
    {
        IssueService::syncCountdownIssue(); // 
        return $this->success();
    }

    public function exchange()
    {
        ConfigService::syncExchangeRate();
        return $this->success();
    }

}