mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
add back to top
This commit is contained in:
@@ -12,14 +12,14 @@ class BackupCronjob extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'backup:cronjob';
|
||||
protected $signature = 'backup:cronjob {--force=}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Backup all data cronjob, and upload to Google drive.';
|
||||
protected $description = 'Backup all data cronjob, and upload to Google drive. options: --force';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
@@ -38,11 +38,13 @@ class BackupCronjob extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
$force = $this->option('force');
|
||||
$this->info("force: $force");
|
||||
$rep = new ToolRepository();
|
||||
$result = $rep->cronjobBackup();
|
||||
$result = $rep->cronjobBackup($force);
|
||||
$log = sprintf(
|
||||
'[%s], %s, result: %s',
|
||||
nexus()->getRequestId(), __METHOD__, var_export($result, true)
|
||||
nexus()->getRequestId(), __METHOD__, var_export($result, true)
|
||||
);
|
||||
$this->info($log);
|
||||
do_log($log);
|
||||
|
||||
@@ -13,14 +13,14 @@ class ExamUpdateProgress extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'exam:update_progress {uid}';
|
||||
protected $signature = 'exam:update_progress {--uid} {--bulk}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Update exam progress.';
|
||||
protected $description = 'Update exam progress. options: --uid, --bulk';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
@@ -39,10 +39,22 @@ class ExamUpdateProgress extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$uid = $this->argument('uid');
|
||||
$uid = $this->option('uid');
|
||||
$bulk = $this->option('bulk');
|
||||
$examRep = new ExamRepository();
|
||||
$result = $examRep->updateProgress($uid);
|
||||
$this->info(nexus()->getRequestId() . ", result: " . var_export($result, true));
|
||||
$log = "uid: $uid, bulk: $bulk";
|
||||
$this->info($log);
|
||||
if (is_numeric($uid) && $uid) {
|
||||
$log .= ", do updateProgress";
|
||||
$result = $examRep->updateProgress($uid);
|
||||
} elseif ($bulk) {
|
||||
$result = $examRep->updateProgressBulk();
|
||||
$log .= ", do updateProgressBulk";
|
||||
} else {
|
||||
$this->error("specific uid or bulk.");
|
||||
return 0;
|
||||
}
|
||||
$this->info(nexus()->getRequestId() . ", $log, result: " . var_export($result, true));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,10 +70,11 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
// $searchRep = new SearchRepository();
|
||||
// $r = $searchRep->deleteIndex();
|
||||
// $r = $searchRep->createIndex();
|
||||
// $r = $searchRep->import();
|
||||
$searchRep = new SearchRepository();
|
||||
$r = $searchRep->deleteIndex();
|
||||
$r = $searchRep->createIndex();
|
||||
$r = $searchRep->import();
|
||||
dd($r);
|
||||
//
|
||||
// $arr = [
|
||||
// 'cat' => 'category',
|
||||
@@ -116,12 +117,18 @@ class Test extends Command
|
||||
// $r = $searchRep->deleteBookmark(1);
|
||||
// $r = $searchRep->addBookmark(1);
|
||||
|
||||
$rep = new AttendanceRepository();
|
||||
$uid = 1;
|
||||
$attendance = $rep->getAttendance($uid);
|
||||
// $rep = new AttendanceRepository();
|
||||
// $uid = 1;
|
||||
// $attendance = $rep->getAttendance($uid);
|
||||
// $r = $rep->migrateAttendanceLogs($uid);
|
||||
$r = $rep->getContinuousDays($attendance);
|
||||
dd($r);
|
||||
// $r = $rep->getContinuousDays($attendance);
|
||||
// $r = $rep->getContinuousPoints(30);
|
||||
// $today = Carbon::today();
|
||||
// $tomorrow = Carbon::tomorrow();
|
||||
// $yesterday = Carbon::parse('+10 days');
|
||||
// dd($today->diffInDays($yesterday));
|
||||
// $r = get_smile(12);
|
||||
// dd($r);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class Kernel extends ConsoleKernel
|
||||
{
|
||||
$schedule->command('exam:assign_cronjob')->everyMinute();
|
||||
$schedule->command('exam:checkout_cronjob')->everyMinute();
|
||||
$schedule->command('exam:update_progress --bulk=1')->hourly();
|
||||
$schedule->command('backup:cronjob')->everyMinute();
|
||||
$schedule->command('hr:update_status')->everyMinute();
|
||||
$schedule->command('hr:update_status --ignore_time=1')->hourly();
|
||||
|
||||
Reference in New Issue
Block a user