mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-17 07:00:49 +08:00
approval change to single action
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
class TorrentOperationLog extends NexusModel
|
||||
{
|
||||
protected $table = 'torrent_operation_logs';
|
||||
@@ -10,12 +12,14 @@ class TorrentOperationLog extends NexusModel
|
||||
|
||||
protected $fillable = ['uid', 'torrent_id', 'action_type', 'comment'];
|
||||
|
||||
const ACTION_TYPE_BAN = 'ban';
|
||||
const ACTION_TYPE_CANCEL_BAN = 'cancel_ban';
|
||||
const ACTION_TYPE_APPROVAL_NONE = 'approval_none';
|
||||
const ACTION_TYPE_APPROVAL_ALLOW = 'approval_allow';
|
||||
const ACTION_TYPE_APPROVAL_DENY = 'approval_deny';
|
||||
|
||||
public static array $actionTypes = [
|
||||
self::ACTION_TYPE_BAN => ['text' => 'Ban'],
|
||||
self::ACTION_TYPE_CANCEL_BAN => ['text' => 'Cancel ban'],
|
||||
self::ACTION_TYPE_APPROVAL_NONE => ['text' => 'Approval none'],
|
||||
self::ACTION_TYPE_APPROVAL_ALLOW => ['text' => 'Approval allow'],
|
||||
self::ACTION_TYPE_APPROVAL_DENY => ['text' => 'Approval deny'],
|
||||
];
|
||||
|
||||
public function user()
|
||||
@@ -32,7 +36,7 @@ class TorrentOperationLog extends NexusModel
|
||||
public static function add(array $params)
|
||||
{
|
||||
$log = self::query()->create($params);
|
||||
if (!in_array($params['action_type'], [self::ACTION_TYPE_CANCEL_BAN, self::ACTION_TYPE_BAN])) {
|
||||
if (!in_array($params['action_type'], [self::ACTION_TYPE_APPROVAL_ALLOW, self::ACTION_TYPE_APPROVAL_DENY])) {
|
||||
do_log("actionType: {$params['action_type']}, do not notify");
|
||||
return $log;
|
||||
}
|
||||
@@ -60,5 +64,6 @@ class TorrentOperationLog extends NexusModel
|
||||
'added' => now(),
|
||||
];
|
||||
Message::query()->insert($message);
|
||||
NexusDB::cache_del("user_{$receiver->id}_inbox_count");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user