mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 20:17:24 +08:00
improve GenerateTemporaryInvite log
This commit is contained in:
@@ -57,14 +57,18 @@ class GenerateTemporaryInvite implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
$beginTimestamp = microtime(true);
|
||||||
$toolRep = new ToolRepository();
|
$toolRep = new ToolRepository();
|
||||||
$idStr = NexusDB::cache_get($this->idRedisKey);
|
$idStr = NexusDB::cache_get($this->idRedisKey);
|
||||||
|
$logPrefix = "idRedisKey: " . $this->idRedisKey;
|
||||||
if (empty($idStr)) {
|
if (empty($idStr)) {
|
||||||
do_log("no idStr of idRedisKey: {$this->idRedisKey}...");
|
do_log("$logPrefix, no idStr...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$idArr = explode(",", $idStr);
|
$idArr = explode(",", $idStr);
|
||||||
do_log(sprintf("going to handle %d uid...", count($idArr)));
|
$count = count($idArr);
|
||||||
|
$logPrefix .= ", count: $count";
|
||||||
|
do_log("$logPrefix, going to handle...");
|
||||||
$now = Carbon::now();
|
$now = Carbon::now();
|
||||||
$expiredAt = Carbon::now()->addDays($this->days);
|
$expiredAt = Carbon::now()->addDays($this->days);
|
||||||
foreach ($idArr as $uid) {
|
foreach ($idArr as $uid) {
|
||||||
@@ -84,12 +88,13 @@ class GenerateTemporaryInvite implements ShouldQueue
|
|||||||
if (!empty($data)) {
|
if (!empty($data)) {
|
||||||
Invite::query()->insert($data);
|
Invite::query()->insert($data);
|
||||||
}
|
}
|
||||||
do_log("success add $this->count temporary invite ($this->days days) to $uid");
|
do_log("$logPrefix, success add $this->count temporary invite ($this->days days) to $uid");
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
do_log("fail add $this->count temporary invite ($this->days days) to $uid: " . $exception->getMessage(), 'error');
|
do_log("$logPrefix, fail add $this->count temporary invite ($this->days days) to $uid: " . $exception->getMessage(), 'error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
NexusDB::cache_del($this->idRedisKey);
|
||||||
|
do_log("$logPrefix, handle done, cost time: " . (microtime(true) - $beginTimestamp) . " seconds.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.9');
|
defined('VERSION_NUMBER') || define('VERSION_NUMBER', '1.8.9');
|
||||||
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-02-23');
|
defined('RELEASE_DATE') || define('RELEASE_DATE', '2024-02-27');
|
||||||
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
defined('IN_TRACKER') || define('IN_TRACKER', false);
|
||||||
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
defined('PROJECTNAME') || define("PROJECTNAME","NexusPHP");
|
||||||
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
defined('NEXUSPHPURL') || define("NEXUSPHPURL","https://nexusphp.org");
|
||||||
|
|||||||
Reference in New Issue
Block a user