mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
[exam] schedule
This commit is contained in:
51
app/Console/Commands/ExamAssign.php
Normal file
51
app/Console/Commands/ExamAssign.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Repositories\ExamRepository;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ExamAssign extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'exam:assign {--uid=} {--exam_id=} {--begin=} {--end=}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Assign exam to user, options: --uid, --exam_id, --begin, --end';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$examRep = new ExamRepository();
|
||||
$uid = $this->option('uid');
|
||||
$examId = $this->option('exam_id');
|
||||
$begin = $this->option('begin');
|
||||
$end = $this->option('end');
|
||||
$this->info(sprintf('uid: %s, examId: %s, begin: %s, end: %s', $uid, $examId, $begin, $end));
|
||||
$result = $examRep->assignToUser($uid, $examId, $begin, $end);
|
||||
$this->info(sprintf('%s, [assignToUser], result: %s, request_id: %s', __METHOD__, var_export($result, true), REQUEST_ID));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
46
app/Console/Commands/ExamAssignCronjob.php
Normal file
46
app/Console/Commands/ExamAssignCronjob.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Repositories\ExamRepository;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ExamAssignCronjob extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'exam:assign_cronjob';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Assign exam cronjob';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$examRep = new ExamRepository();
|
||||
$result = $examRep->cronjonAssign();
|
||||
$this->info(sprintf('%s, [cronjonAssign], result: %s, request_id: %s', __METHOD__, var_export($result, true), REQUEST_ID));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
48
app/Console/Commands/ExamCheckoutCronjob.php
Normal file
48
app/Console/Commands/ExamCheckoutCronjob.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Repositories\ExamRepository;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class ExamCheckoutCronjob extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'exam:checkout_cronjob {--ignore-time-range}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Checkout exam cronjob, options: --ignore-time-range';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$examRep = new ExamRepository();
|
||||
$ignoreTimeRange = $this->option('ignore-time-range');
|
||||
$this->info('ignore-time-range: ' . var_export($ignoreTimeRange, true));
|
||||
$result = $examRep->cronjobCheckout($ignoreTimeRange);
|
||||
$this->info(sprintf('%s, [cronjobCheckout], result: %s, request_id: %s', __METHOD__, var_export($result, true), REQUEST_ID));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -44,12 +44,19 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$user = User::query()->findOrFail(1);
|
||||
dd(nexus_trans('exam.checkout_pass_message_content', ['exam_name' => '年中考核', 'begin' => 1, 'end' => 2]));
|
||||
$rep = new ExamRepository();
|
||||
// $r = $rep->assignToUser(1, 1);
|
||||
// $r = $rep->addProgress(27, 4, 1025, 1);
|
||||
// dd($r);
|
||||
$r = $rep->addProgress(3, 1, [
|
||||
1 => 25*1024*1024*1024,
|
||||
2 => 55*3600,
|
||||
3 => 100*1024*1024*1024,
|
||||
4 => 1252
|
||||
]);
|
||||
dd($r);
|
||||
// $rep->assignCronjob();
|
||||
$rep->cronjobCheckout();
|
||||
// $rep->cronjobCheckout();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user