add command: calculate_seed_bonus()

This commit is contained in:
xiaomlove
2022-04-21 20:02:08 +08:00
parent 1d3662af36
commit eb0c4cad8a
5 changed files with 99 additions and 15 deletions
+1 -3
View File
@@ -126,9 +126,7 @@ class Test extends Command
// $r = $rep->getContinuousDays($attendance);
// $r = $rep->getContinuousPoints(11);
$rep = new ExamRepository();
$exam = Exam::query()->find(6);
$r = $rep->fetchUserAndDoAssign($exam);
$r = NexusDB::getAll('users', 'id = 1');
dd($r);
}
@@ -0,0 +1,40 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class TrackerCalculateSeedBonus extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'tracker:calculate_seed_bonus {uid}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Calculate user seed bonus.';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$uid = $this->argument('uid');
$result = calculate_seed_bonus($uid);
$log = sprintf(
"[%s], %s, uid: %s, result: \n%s",
nexus()->getRequestId(), __METHOD__, $uid, var_export($result, true)
);
$this->info($log);
do_log($log);
return 0;
}
}