improve login notify + migrate torrent purchase to announce

This commit is contained in:
xiaomlove
2023-04-09 14:53:15 +08:00
parent 4535ba94a4
commit 33b16ed7ac
9 changed files with 86 additions and 62 deletions
+2 -2
View File
@@ -19,7 +19,7 @@ class MeiliSearchImport extends Command
*
* @var string
*/
protected $description = 'Command description';
protected $description = 'Import torrents to meilisearch';
/**
* Execute the console command.
@@ -29,7 +29,7 @@ class MeiliSearchImport extends Command
public function handle()
{
$rep = new MeiliSearchRepository();
$this->info("going to import torrents");
$this->info("going to import torrents...");
$total = $rep->import();
$this->info("import $total torrents.");
return Command::SUCCESS;
-15
View File
@@ -97,21 +97,6 @@ class Test extends Command
*/
public function handle()
{
$thisLoginLog = LoginLog::query()->findOrFail(10);
$lastLoginLog = LoginLog::query()->findOrFail(9);
$user = User::query()->findOrFail(1, User::$commonFields);
$locale = $user->locale;
$toolRep = new ToolRepository();
$subject = nexus_trans('message.login_notify.subject', ['site_name' => Setting::get('basic.SITENAME')], $locale);
$body = nexus_trans('message.login_notify.body', [
'this_login_time' => $thisLoginLog->created_at,
'this_ip' => $thisLoginLog->ip,
'this_location' => sprintf('%s·%s', $thisLoginLog->city, $thisLoginLog->country),
'last_login_time' => $lastLoginLog->created_at,
'last_ip' => $lastLoginLog->ip,
'last_location' => sprintf('%s·%s', $lastLoginLog->city, $lastLoginLog->country),
], $locale);
dd($body);
}
}
+6 -7
View File
@@ -13,14 +13,14 @@ class UserLoginNotify extends Command
*
* @var string
*/
protected $signature = 'user:login_notify {--this_id=} {--last_id=}';
protected $signature = 'user:login_notify {--this_id=}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Send login notify, option: --this_id, --last_id';
protected $description = 'Send login notify, option: --this_id';
/**
* Execute the console command.
@@ -30,13 +30,12 @@ class UserLoginNotify extends Command
public function handle()
{
$thisId = $this->option('this_id');
$lastId = $this->option('last_id');
$this->info("thisId: $thisId, lastId: $lastId");
if (!$thisId || !$lastId) {
$this->error("require option --this_id=? and --last_id=?");
$this->info("thisId: $thisId");
if (!$thisId) {
$this->error("require option --this_id=?");
return Command::FAILURE;
}
SendLoginNotify::dispatch($thisId, $lastId);
SendLoginNotify::dispatch($thisId);
return Command::SUCCESS;
}
}