提交代码
This commit is contained in:
57
app/Console/Commands/PerfBonusCommand.php
Normal file
57
app/Console/Commands/PerfBonusCommand.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Console\Command;
|
||||
use RuLong\UserRelation\Models\UserRelation;
|
||||
|
||||
class PerfBonusCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'rulong:PerfBonusCommand';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = '业绩分润';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$maxLayer = UserRelation::max('layer');
|
||||
for ($i = $maxLayer; $i >= 1; $i--) {
|
||||
$users = User::whereHas('identity.info', function ($query) {
|
||||
$query->where('configs->perf_100', '>', 0)
|
||||
->orWhere('configs->perf_500', '>', 0)
|
||||
->orWhere('configs->perf_1000', '>', 0);
|
||||
})->whereHas('relation', function ($query) use ($i) {
|
||||
$query->where('layer', $i);
|
||||
})->get();
|
||||
foreach ($users as $key => $user) {
|
||||
\App\Jobs\Perf::dispatch($user);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user