fix: correct know file issues

This commit is contained in:
xboard 2025-01-09 15:58:32 +08:00
parent cd7c1ca34b
commit 720aa415ac
8 changed files with 17 additions and 7 deletions

View File

@ -89,8 +89,8 @@ class StatController extends Controller
'paid_count' => 0,
'commission_total' => 0,
'commission_count' => 0,
'start_date' => $request->input('start_date', date('Y-m-d', $statistics->last()->record_at)),
'end_date' => $request->input('end_date', date('Y-m-d', $statistics->first()->record_at)),
'start_date' => $request->input('start_date', date('Y-m-d', $statistics->last()?->record_at)),
'end_date' => $request->input('end_date', date('Y-m-d', $statistics->first()?->record_at)),
'avg_paid_amount' => 0,
'avg_commission_amount' => 0
];

View File

@ -185,11 +185,12 @@ class Server extends Model
$this->password = $user->uuid;
if (!isset($this->cipher) || !isset(self::CIPHER_CONFIGURATIONS[$this->cipher])) {
$cipher = data_get($this, 'protocol_settings.cipher');
if (!$cipher || !isset(self::CIPHER_CONFIGURATIONS[$cipher])) {
return;
}
$config = self::CIPHER_CONFIGURATIONS[$this->cipher];
$config = self::CIPHER_CONFIGURATIONS[$cipher];
$serverKey = Helper::getServerKey($this->created_at, $config['serverKeySize']);
$userKey = Helper::uuidToBase64($user->uuid, $config['userKeySize']);
$this->password = "{$serverKey}:{$userKey}";

View File

@ -130,7 +130,7 @@ class ClashMeta implements ProtocolInterface
$array['server'] = $server['host'];
$array['port'] = $server['port'];
$array['cipher'] = data_get($server['protocol_settings'], 'cipher');
$array['password'] = $password;
$array['password'] = data_get($server, 'password', $password);
$array['udp'] = true;
return $array;
}

View File

@ -53,6 +53,7 @@ class General implements ProtocolInterface
{
$protocol_settings = $server['protocol_settings'];
$name = rawurlencode($server['name']);
$password = data_get($server, 'password', $password);
$str = str_replace(
['+', '/', '='],
['-', '_', ''],

View File

@ -44,6 +44,7 @@ class QuantumultX implements ProtocolInterface
public static function buildShadowsocks($password, $server)
{
$protocol_settings = $server['protocol_settings'];
$password = data_get($server, 'password', $password);
$config = [
"shadowsocks={$server['host']}:{$server['port']}",
"method={$protocol_settings['cipher']}",

View File

@ -60,6 +60,7 @@ class Shadowrocket implements ProtocolInterface
{
$protocol_settings = $server['protocol_settings'];
$name = rawurlencode($server['name']);
$password = data_get($server, 'password', $password);
$str = str_replace(
['+', '/', '='],
['-', '_', ''],

View File

@ -107,7 +107,7 @@ class SingBox implements ProtocolInterface
$array['server'] = $server['host'];
$array['server_port'] = $server['port'];
$array['method'] = data_get($server, 'protocol_settings.cipher');
$array['password'] = $password;
$array['password'] = data_get($server, 'password', $password);
return $array;
}

View File

@ -40,7 +40,9 @@ class ServerService
$server->loadParentCreatedAt();
$server->handlePortAllocation();
$server->loadServerStatus();
$server->server_key = Helper::getServerKey($server->created_at, 16);
if ($server->type === 'shadowsocks') {
$server->server_key = Helper::getServerKey($server->created_at, 16);
}
$server->generateShadowsocksPassword($user);
return $server;
@ -48,6 +50,10 @@ class ServerService
->toArray();
}
/**
*
*/
/**
* 根据权限组获取可用的用户列表
* @param array $groupIds