<?php

namespace app\listens;

use app\common\repositories\user\UserExtractRepository;
use crmeb\interfaces\ListenerInterface;
use Swoole\Timer;
use think\facade\Log;

/**
 * Class WechatExtractListen
 * @package app\listens
 * 微信提现的定时审核 3分钟执行1次
 */
class WechatExtractListen implements ListenerInterface
{

    public function handle($event): void
    {
        $UserExtractRepository = app()->make(UserExtractRepository::class);
        Timer::tick(60000*3, function () use ( $UserExtractRepository) {
            try {
                $UserExtractRepository->wechat_extract();
            } catch (\Exception $e) {
                Log::error('微信提现的定时审核 执行失败:' . $e->getMessage());
            }
        });
    }
}
