improve approval notify

This commit is contained in:
xiaomlove
2022-06-18 23:17:34 +08:00
parent 88a92f745d
commit 00d7dc6c37
2 changed files with 15 additions and 12 deletions

View File

@@ -33,19 +33,12 @@ class TorrentOperationLog extends NexusModel
}
public static function add(array $params)
public static function add(array $params, $notifyUser = false)
{
$log = self::query()->create($params);
$notifyActionTypes = [
self::ACTION_TYPE_APPROVAL_ALLOW,
self::ACTION_TYPE_APPROVAL_DENY,
self::ACTION_TYPE_APPROVAL_NONE,
];
if (!in_array($params['action_type'], $notifyActionTypes)) {
do_log("actionType: {$params['action_type']}, do not notify");
return $log;
if ($notifyUser) {
self::notifyUser($log);
}
self::notifyUser($log);
return $log;
}