下面補(bǔ)充全部代碼
<?php
namespace process;
use GuzzleHttp\Client;
use Workerman\Crontab\Crontab;
class TaskSocial
{
private $domain = '';
public function onWorkerStart()
{
// 異步內(nèi)容審核 每分鐘執(zhí)行一次
new Crontab('0 */1 * * * *', function () {
$client = new Client();
$response = $client->get($this->domain . '/api_v5/crontab_api/crontab_audit');
echo "異步內(nèi)容審核 " . date('Y-m-d H:i:s') . "\n";
echo $response->getBody() . "\n";
//清除所有過期的心跳 統(tǒng)計等級 每分鐘一次
$response = $client->get($this->domain . '/api/crontab_api/service_crontab');
echo "清除所有過期的心跳 統(tǒng)計等級 " . date('Y-m-d H:i:s') . "\n";
echo $response->getBody() . "\n";
});
// 每5秒執(zhí)行一次 自動打招呼
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";
});
// 財務(wù)記錄 代理數(shù)據(jù)統(tǒng)計 每日統(tǒng)計一次
new Crontab('50 0 * * *', function () {
$client = new Client();
$response = $client->get(($this->domain . '/api_v5/crontab_api/crontab_finance'));
echo "財務(wù)記錄 " . date('Y-m-d H:i:s') . "\n";
echo $response->getBody() . "\n";
$response = $client->get(($this->domain . '/api/crontab_api/add_channel_users'));
echo "代理數(shù)據(jù)統(tǒng)計 " . date('Y-m-d H:i:s') . "\n";
echo $response->getBody() . "\n";
$response = $client->get(($this->domain . '/api/crontab_api/business_day'));
echo "獲取昨天的營業(yè)-每日凌晨統(tǒng)計 " . 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";
});
}
}