成长值 >= 650 为会员
parent
e41ad193c7
commit
c7f88e3d53
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Console\Commands\Distribution;
|
||||
|
||||
use App\Exceptions\BizException;
|
||||
use App\Models\DistributionPreIncomeJob;
|
||||
use App\Services\DistributionPreIncomeJobService;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Throwable;
|
||||
|
||||
class PreIncomeJobCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'distribution:pre-income-job';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '分销预收益任务';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @param \App\Services\DistributionPreIncomeJobService $jobService
|
||||
* @return int
|
||||
*/
|
||||
public function handle(DistributionPreIncomeJobService $jobService)
|
||||
{
|
||||
DistributionPreIncomeJob::with('jobable')->pending()->chunkById(200, function ($jobs) use ($jobService) {
|
||||
foreach ($jobs as $job) {
|
||||
try {
|
||||
DB::beginTransaction();
|
||||
|
||||
$jobService->run($job);
|
||||
|
||||
DB::commit();
|
||||
} catch (Throwable $e) {
|
||||
DB::rollBack();
|
||||
|
||||
report($e);
|
||||
|
||||
if ($e instanceof BizException) {
|
||||
$job->update([
|
||||
'status' => DistributionPreIncomeJob::STATUS_FAILED,
|
||||
'failed_reason' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ class User extends Model implements AuthorizableContract, AuthenticatableContrac
|
|||
*/
|
||||
public function isVip(): bool
|
||||
{
|
||||
return true;
|
||||
return $this->userInfo?->growth_value >= 650;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue