deploy: auto commit repo-root changes 2026-06-13 12:42:06

This commit is contained in:
hajimi
2026-06-13 12:42:06 +08:00
parent ed1733e49d
commit 127475e539
2 changed files with 92 additions and 2 deletions
@@ -0,0 +1,70 @@
<?php
namespace app\common\service\user;
use app\common\enum\user\UserTerminalEnum;
class UserAccountTypeService
{
public const SCOPE_REGISTERED = 'registered';
public const SCOPE_SYSTEM = 'system';
public const TYPE_REGISTERED = 'registered';
public const TYPE_COMMENT = 'comment';
public const TYPE_TRUMP = 'trump';
public const TYPE_LOTTERY = 'lottery';
public const TYPE_SYSTEM = 'system';
public static function registeredChannels(): array
{
return UserTerminalEnum::ALL_TERMINAL;
}
public static function isRegisteredAccount(array $user): bool
{
return in_array((int) ($user['channel'] ?? 0), self::registeredChannels(), true);
}
public static function isSystemAccount(array $user): bool
{
return !self::isRegisteredAccount($user);
}
public static function resolveType(array $user): array
{
$account = trim((string) ($user['account'] ?? ''));
$lowerAccount = strtolower($account);
if (self::isRegisteredAccount($user)) {
return [
'account_scope' => self::SCOPE_REGISTERED,
'account_scope_desc' => '自注册账号',
'account_type' => self::TYPE_REGISTERED,
'account_type_desc' => '自注册账号',
'is_system_account' => 0,
];
}
if (str_starts_with($account, 'ai_comment_')) {
$type = self::TYPE_COMMENT;
$desc = '评论账号';
} elseif ($account === 'realDonaldTrump' || str_contains($lowerAccount, 'trump') || str_contains($lowerAccount, 'truth')) {
$type = self::TYPE_TRUMP;
$desc = '特朗普特殊账号';
} elseif (str_contains($lowerAccount, 'lottery')) {
$type = self::TYPE_LOTTERY;
$desc = '彩票账号';
} else {
$type = self::TYPE_SYSTEM;
$desc = '系统账号';
}
return [
'account_scope' => self::SCOPE_SYSTEM,
'account_scope_desc' => '系统账号',
'account_type' => $type,
'account_type_desc' => $desc,
'is_system_account' => 1,
];
}
}