mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-28 06:57:22 +08:00
fire_event add log
This commit is contained in:
@@ -7,6 +7,7 @@ use App\Jobs\SettleClaim;
|
|||||||
use App\Jobs\UpdateUserDownloadPrivilege;
|
use App\Jobs\UpdateUserDownloadPrivilege;
|
||||||
use App\Models\ExamUser;
|
use App\Models\ExamUser;
|
||||||
use App\Models\Language;
|
use App\Models\Language;
|
||||||
|
use App\Models\Message;
|
||||||
use App\Models\PersonalAccessToken;
|
use App\Models\PersonalAccessToken;
|
||||||
use App\Models\Torrent;
|
use App\Models\Torrent;
|
||||||
use App\Models\TorrentExtra;
|
use App\Models\TorrentExtra;
|
||||||
@@ -17,6 +18,7 @@ use App\Repositories\SeedBoxRepository;
|
|||||||
use App\Repositories\UploadRepository;
|
use App\Repositories\UploadRepository;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Nexus\Database\NexusDB;
|
||||||
use Nexus\PTGen\PTGen;
|
use Nexus\PTGen\PTGen;
|
||||||
use NexusPlugin\Menu\Filament\MenuItemResource\Pages\ManageMenuItems;
|
use NexusPlugin\Menu\Filament\MenuItemResource\Pages\ManageMenuItems;
|
||||||
use NexusPlugin\Menu\MenuRepository;
|
use NexusPlugin\Menu\MenuRepository;
|
||||||
@@ -76,7 +78,15 @@ class Test extends Command
|
|||||||
// $res = unserialize("O:36:\"App\\Jobs\\UpdateUserDownloadPrivilege\":3:{s:6:\"userId\";i:1;s:6:\"status\";s:3:\"yes\";s:9:\"reasonKey\";s:8:\"test_key\";}");
|
// $res = unserialize("O:36:\"App\\Jobs\\UpdateUserDownloadPrivilege\":3:{s:6:\"userId\";i:1;s:6:\"status\";s:3:\"yes\";s:9:\"reasonKey\";s:8:\"test_key\";}");
|
||||||
// $res = unserialize("O:36:\"App\\Jobs\\UpdateUserDownloadPrivilege\":3:{s:6:\"userId\";i:1;s:6:\"status\";s:3:\"yes\";s:9:\"reasonKey\";s:8:\"test_key\";}");
|
// $res = unserialize("O:36:\"App\\Jobs\\UpdateUserDownloadPrivilege\":3:{s:6:\"userId\";i:1;s:6:\"status\";s:3:\"yes\";s:9:\"reasonKey\";s:8:\"test_key\";}");
|
||||||
// dd($res);
|
// dd($res);
|
||||||
UpdateUserDownloadPrivilege::dispatch(1, "yes", "test_key");
|
NexusDB::transaction(function () {
|
||||||
|
User::query()->where("id", 1)->update(["last_access" => now()]);
|
||||||
|
Message::add([
|
||||||
|
'receiver' => 1,
|
||||||
|
'subject' => 'test',
|
||||||
|
'msg' => microtime(true),
|
||||||
|
'added' => now()
|
||||||
|
]);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ class PluginStore extends Model
|
|||||||
{
|
{
|
||||||
$list = self::listAll(true);
|
$list = self::listAll(true);
|
||||||
$enabled = Plugin::listEnabled();
|
$enabled = Plugin::listEnabled();
|
||||||
foreach ($list as &$row) {
|
foreach ($list as $key => $row) {
|
||||||
$row['installed_version'] = $enabled[$row['plugin_id']] ?? '';
|
$list[$key]['installed_version'] = $enabled[$row['plugin_id']] ?? '';
|
||||||
}
|
}
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1356,6 +1356,7 @@ function fire_event(string $name, \Illuminate\Database\Eloquent\Model $model, ?\
|
|||||||
}
|
}
|
||||||
// executeCommand("event:fire --name=$name --idKey=$idKey --idKeyOld=$idKeyOld", "string", true, false);
|
// executeCommand("event:fire --name=$name --idKey=$idKey --idKeyOld=$idKeyOld", "string", true, false);
|
||||||
\Nexus\Nexus::dispatchQueueJob(new \App\Jobs\FireEvent($name, $idKey, $idKeyOld));
|
\Nexus\Nexus::dispatchQueueJob(new \App\Jobs\FireEvent($name, $idKey, $idKeyOld));
|
||||||
|
do_log("success fire_event in nexus, name: $name, idKey: $idKey, idKeyOld: $idKeyOld");
|
||||||
} else {
|
} else {
|
||||||
$eventClass = \App\Enums\ModelEventEnum::$eventMaps[$name]['event'];
|
$eventClass = \App\Enums\ModelEventEnum::$eventMaps[$name]['event'];
|
||||||
if (str_ends_with($name, '_deleted')) {
|
if (str_ends_with($name, '_deleted')) {
|
||||||
@@ -1372,6 +1373,7 @@ function fire_event(string $name, \Illuminate\Database\Eloquent\Model $model, ?\
|
|||||||
}
|
}
|
||||||
call_user_func_array([$eventClass, "dispatch"], $params);
|
call_user_func_array([$eventClass, "dispatch"], $params);
|
||||||
publish_model_event($name, $model->id);
|
publish_model_event($name, $model->id);
|
||||||
|
do_log("success fire_event in laravel, name: $name, id: $model->id, oldId: " . ($oldModel ? $oldModel->id : ""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user