Files
huangjingfen/pro_v3.5.1/app/jobs/hjf/PointsReleaseJob.php
apple 78de918c37 Initial commit: queue workspace
Made-with: Cursor
2026-03-21 02:55:24 +08:00

48 lines
1.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace app\jobs\hjf;
use app\services\hjf\PointsReleaseServices;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
use think\facade\Log;
/**
* 积分每日释放 Job
*
* 由定时任务crontab 或 Swoole Timer在每天凌晨 00:01 触发。
* 调用方式PointsReleaseJob::dispatch()
*
* Class PointsReleaseJob
* @package app\jobs\hjf
*/
class PointsReleaseJob extends BaseJobs
{
use QueueTrait;
/**
* 执行积分释放
* @return bool
*/
public function doJob(): bool
{
try {
/** @var PointsReleaseServices $releaseServices */
$releaseServices = app()->make(PointsReleaseServices::class);
$result = $releaseServices->executeRelease();
Log::info('[PointsReleaseJob] 执行完成', $result);
} catch (\Throwable $e) {
response_log_write([
'message' => '积分每日释放任务失败: ' . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
return false;
}
return true;
}
}