<?php

namespace process;

use GuzzleHttp\Client;
use Workerman\Crontab\Crontab;

class TaskSocial
{
    private $domain = '';
    public function onWorkerStart()
    {
        // 异步内容审核 每分钟执行一次
        new Crontab('0 */1 * * * *', function () {
            $client = new Client();
            $response = $client->get($this->domain . '/api_v5/crontab_api/crontab_audit');
            echo "异步内容审核 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
            //清除所有过期的心跳 统计等级 每分钟一次
            $response = $client->get($this->domain . '/api/crontab_api/service_crontab');
            echo "清除所有过期的心跳 统计等级 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
        });

        // 每5秒执行一次 自动打招呼
        new Crontab('*/5 * * * * *', function () {
            $client = new Client();
            $response = $client->get($this->domain . '/api/crontab_api/service_see_hi_crontab');
            echo "自动打招呼 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
        });

        // 财务记录 代理数据统计 每日统计一次
        new Crontab('50 0 * * *', function () {
            $client = new Client();
            $response = $client->get(($this->domain . '/api_v5/crontab_api/crontab_finance'));
            echo "财务记录 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
            $response = $client->get(($this->domain . '/api/crontab_api/add_channel_users'));
            echo "代理数据统计 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
            $response = $client->get(($this->domain . '/api/crontab_api/business_day'));
            echo "获取昨天的营业-每日凌晨统计 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
            // 聊天记录
            $response = $client->get(($this->domain . '/api_v5/crontab_api/chat_log'));
            echo "聊天记录保存文件 " . date('Y-m-d H:i:s') . "\n";
            echo $response->getBody() . "\n";
        });
    }
}

https://www.workerman.net/q/9516

标签: none

添加新评论