mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
self enable
This commit is contained in:
@@ -21,6 +21,7 @@ class BonusLogs extends NexusModel
|
||||
const DEFAULT_BONUS_BUY_TEMPORARY_INVITE = 500;
|
||||
const DEFAULT_BONUS_BUY_RAINBOW_ID = 5000;
|
||||
const DEFAULT_BONUS_BUY_CHANGE_USERNAME_CARD = 100000;
|
||||
const DEFAULT_BONUS_SELF_ENABLE = 100000;
|
||||
|
||||
//扣除类,1开始
|
||||
const BUSINESS_TYPE_CANCEL_HIT_AND_RUN = 1;
|
||||
@@ -46,6 +47,7 @@ class BonusLogs extends NexusModel
|
||||
const BUSINESS_TYPE_TASK_PASS_REWARD = 21;
|
||||
const BUSINESS_TYPE_REWARD_TORRENT = 22;
|
||||
const BUSINESS_TYPE_CLAIMED_UNREACHED = 23;
|
||||
const BUSINESS_TYPE_SELF_ENABLE = 24;
|
||||
|
||||
//获得类,普通获得,1000 起步
|
||||
const BUSINESS_TYPE_ROLE_WORK_SALARY = 1000;
|
||||
@@ -87,6 +89,7 @@ class BonusLogs extends NexusModel
|
||||
self::BUSINESS_TYPE_TASK_PASS_REWARD => ['text' => 'Task success reward'],
|
||||
self::BUSINESS_TYPE_REWARD_TORRENT => ['text' => 'Reward torrent'],
|
||||
self::BUSINESS_TYPE_CLAIMED_UNREACHED => ['text' => 'Claimed torrent unreached'],
|
||||
self::BUSINESS_TYPE_SELF_ENABLE => ['text' => 'Self enable'],
|
||||
|
||||
self::BUSINESS_TYPE_ROLE_WORK_SALARY => ['text' => 'Role work salary'],
|
||||
self::BUSINESS_TYPE_TORRENT_BE_DOWNLOADED => ['text' => 'Torrent be downloaded'],
|
||||
|
||||
@@ -334,4 +334,9 @@ class Setting extends NexusModel
|
||||
{
|
||||
return self::get('main.showimdbinfo') == 'yes';
|
||||
}
|
||||
|
||||
public static function getSelfEnableBonus(): int
|
||||
{
|
||||
return (int)self::get("bonus.self_enable", BonusLogs::DEFAULT_BONUS_SELF_ENABLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ class UserBanLog extends NexusModel
|
||||
|
||||
protected $fillable = ['uid', 'username', 'operator', 'reason'];
|
||||
|
||||
public $timestamps = true;
|
||||
|
||||
public static function clearUserBanLogDuplicate()
|
||||
{
|
||||
$lists = UserBanLog::query()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
namespace App\Repositories;
|
||||
|
||||
use App\Enums\ModelEventEnum;
|
||||
use App\Enums\RedisKeysEnum;
|
||||
use App\Exceptions\InsufficientPermissionException;
|
||||
use App\Exceptions\NexusException;
|
||||
use App\Http\Resources\ExamUserResource;
|
||||
@@ -29,7 +28,6 @@ use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Arr;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Str;
|
||||
use Nexus\Database\NexusDB;
|
||||
@@ -228,9 +226,9 @@ class UserRepository extends BaseRepository
|
||||
'operator' => $operator->id,
|
||||
];
|
||||
$modCommentText = sprintf("%s - Disable by %s, reason: %s.", now()->format('Y-m-d'), $operator->username, $reason);
|
||||
DB::transaction(function () use ($targetUser, $banLog, $modCommentText) {
|
||||
NexusDB::transaction(function () use ($targetUser, $banLog, $modCommentText) {
|
||||
$targetUser->updateWithModComment(['enabled' => User::ENABLED_NO], $modCommentText);
|
||||
UserBanLog::query()->insert($banLog);
|
||||
UserBanLog::query()->create($banLog);
|
||||
});
|
||||
do_log("user: $uid, $modCommentText");
|
||||
$this->clearCache($targetUser);
|
||||
|
||||
Reference in New Issue
Block a user