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

46 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\MemberLevelServices;
use crmeb\basic\BaseJobs;
use crmeb\traits\QueueTrait;
use think\facade\Log;
/**
* 会员等级异步检查 Job
*
* 每次订单支付回调完成后,对推荐链上的上级异步派发此 Job 检查是否达到升级条件。
* 调用方式MemberLevelCheckJob::dispatch($uid)
*
* Class MemberLevelCheckJob
* @package app\jobs\hjf
*/
class MemberLevelCheckJob extends BaseJobs
{
use QueueTrait;
/**
* @param int $uid 需要检查升级的用户 ID
* @return bool
*/
public function doJob(int $uid): bool
{
try {
/** @var MemberLevelServices $levelServices */
$levelServices = app()->make(MemberLevelServices::class);
$levelServices->checkUpgrade($uid);
} catch (\Throwable $e) {
response_log_write([
'message' => "会员等级检查失败 uid={$uid}: " . $e->getMessage(),
'file' => $e->getFile(),
'line' => $e->getLine(),
]);
return false;
}
return true;
}
}