mirror of
https://github.com/cedar2025/Xboard.git
synced 2025-02-02 07:28:13 -05:00
fix: correct know file issues
This commit is contained in:
parent
0de998dc25
commit
51664a4da0
@ -12,8 +12,8 @@ class NoticeController extends Controller
|
|||||||
{
|
{
|
||||||
$current = $request->input('current') ? $request->input('current') : 1;
|
$current = $request->input('current') ? $request->input('current') : 1;
|
||||||
$pageSize = 5;
|
$pageSize = 5;
|
||||||
$model = Notice::orderBy('created_at', 'DESC')
|
$model = Notice::orderBy('sort', 'ASC')
|
||||||
->where('show', 1);
|
->where('show', true);
|
||||||
$total = $model->count();
|
$total = $model->count();
|
||||||
$res = $model->forPage($current, $pageSize)
|
$res = $model->forPage($current, $pageSize)
|
||||||
->get();
|
->get();
|
||||||
|
@ -7,12 +7,17 @@ use App\Http\Controllers\Controller;
|
|||||||
use App\Http\Requests\Admin\NoticeSave;
|
use App\Http\Requests\Admin\NoticeSave;
|
||||||
use App\Models\Notice;
|
use App\Models\Notice;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
class NoticeController extends Controller
|
class NoticeController extends Controller
|
||||||
{
|
{
|
||||||
public function fetch(Request $request)
|
public function fetch(Request $request)
|
||||||
{
|
{
|
||||||
return $this->success(Notice::orderBy('id', 'DESC')->get());
|
return $this->success(
|
||||||
|
Notice::orderBy('sort', 'ASC')
|
||||||
|
->orderBy('id', 'DESC')
|
||||||
|
->get()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save(NoticeSave $request)
|
public function save(NoticeSave $request)
|
||||||
@ -72,4 +77,25 @@ class NoticeController extends Controller
|
|||||||
}
|
}
|
||||||
return $this->success(true);
|
return $this->success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function sort(Request $request)
|
||||||
|
{
|
||||||
|
$params = $request->validate([
|
||||||
|
'ids' => 'required|array'
|
||||||
|
]);
|
||||||
|
|
||||||
|
try {
|
||||||
|
DB::beginTransaction();
|
||||||
|
foreach ($params['ids'] as $k => $v) {
|
||||||
|
$notice = Notice::findOrFail($v);
|
||||||
|
$notice->update(['sort' => $k + 1]);
|
||||||
|
}
|
||||||
|
DB::commit();
|
||||||
|
return $this->success(true);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
DB::rollBack();
|
||||||
|
\Log::error($e);
|
||||||
|
return $this->fail([500, '排序保存失败']);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ use App\Services\UserService;
|
|||||||
use App\Utils\Helper;
|
use App\Utils\Helper;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
class OrderController extends Controller
|
class OrderController extends Controller
|
||||||
{
|
{
|
||||||
@ -57,24 +58,80 @@ class OrderController extends Controller
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function applyFiltersAndSorts(Request $request, $builder)
|
private function applyFiltersAndSorts(Request $request, Builder $builder): void
|
||||||
{
|
{
|
||||||
$request->collect('filter')->each(function ($filter) use ($builder) {
|
$this->applyFilters($request, $builder);
|
||||||
$key = $filter['id'];
|
$this->applySorting($request, $builder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function applyFilters(Request $request, Builder $builder): void
|
||||||
|
{
|
||||||
|
if (!$request->has('filter')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
collect($request->input('filter'))->each(function ($filter) use ($builder) {
|
||||||
|
$field = $filter['id'];
|
||||||
$value = $filter['value'];
|
$value = $filter['value'];
|
||||||
|
|
||||||
$builder->where(function ($query) use ($key, $value) {
|
$builder->where(function ($query) use ($field, $value) {
|
||||||
is_array($value)
|
$this->buildFilterQuery($query, $field, $value);
|
||||||
? $query->whereIn($key, $value)
|
|
||||||
: $query->where($key, 'like', "%{$value}%");
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$request->collect('sort')->each(function ($sort) use ($builder) {
|
private function buildFilterQuery(Builder $query, string $field, mixed $value): void
|
||||||
$builder->orderBy(
|
{
|
||||||
$sort['id'],
|
// Handle array values for 'in' operations
|
||||||
$sort['desc'] ? 'DESC' : 'ASC'
|
if (is_array($value)) {
|
||||||
);
|
$query->whereIn($field, $value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle operator-based filtering
|
||||||
|
if (!is_string($value) || !str_contains($value, ':')) {
|
||||||
|
$query->where($field, 'like', "%{$value}%");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[$operator, $filterValue] = explode(':', $value, 2);
|
||||||
|
|
||||||
|
// Convert numeric strings to appropriate type
|
||||||
|
if (is_numeric($filterValue)) {
|
||||||
|
$filterValue = strpos($filterValue, '.') !== false
|
||||||
|
? (float) $filterValue
|
||||||
|
: (int) $filterValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Apply operator
|
||||||
|
$query->where($field, match (strtolower($operator)) {
|
||||||
|
'eq' => '=',
|
||||||
|
'gt' => '>',
|
||||||
|
'gte' => '>=',
|
||||||
|
'lt' => '<',
|
||||||
|
'lte' => '<=',
|
||||||
|
'like' => 'like',
|
||||||
|
'notlike' => 'not like',
|
||||||
|
'null' => static fn($q) => $q->whereNull($queryField),
|
||||||
|
'notnull' => static fn($q) => $q->whereNotNull($queryField),
|
||||||
|
default => 'like'
|
||||||
|
}, match (strtolower($operator)) {
|
||||||
|
'like', 'notlike' => "%{$filterValue}%",
|
||||||
|
'null', 'notnull' => null,
|
||||||
|
default => $filterValue
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private function applySorting(Request $request, Builder $builder): void
|
||||||
|
{
|
||||||
|
if (!$request->has('sort')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
collect($request->input('sort'))->each(function ($sort) use ($builder) {
|
||||||
|
$field = $sort['id'];
|
||||||
|
$direction = $sort['desc'] ? 'DESC' : 'ASC';
|
||||||
|
$builder->orderBy($field, $direction);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,6 +139,7 @@ class AdminRoute
|
|||||||
$router->post('/update', [NoticeController::class, 'update']);
|
$router->post('/update', [NoticeController::class, 'update']);
|
||||||
$router->post('/drop', [NoticeController::class, 'drop']);
|
$router->post('/drop', [NoticeController::class, 'drop']);
|
||||||
$router->post('/show', [NoticeController::class, 'show']);
|
$router->post('/show', [NoticeController::class, 'show']);
|
||||||
|
$router->post('/sort', [NoticeController::class, 'sort']);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ticket
|
// Ticket
|
||||||
|
@ -14,6 +14,5 @@ class Notice extends Model
|
|||||||
'updated_at' => 'timestamp',
|
'updated_at' => 'timestamp',
|
||||||
'tags' => 'array',
|
'tags' => 'array',
|
||||||
'show' => 'boolean',
|
'show' => 'boolean',
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -166,10 +166,10 @@ class Clash implements ProtocolInterface
|
|||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts'] = [
|
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path', '/');
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
'headers' => ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')]
|
$array['ws-opts']['headers'] = ['Host' => $host];
|
||||||
];
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
@ -200,10 +200,10 @@ class Clash implements ProtocolInterface
|
|||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts'] = [
|
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path', '/');
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
'headers' => ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')]
|
$array['ws-opts']['headers'] = ['Host' => $host];
|
||||||
];
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
|
@ -167,7 +167,7 @@ class ClashMeta implements ProtocolInterface
|
|||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts'] = [
|
$array['ws-opts'] = [
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
'path' => data_get($protocol_settings, 'network_settings.path'),
|
||||||
'headers' => ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')]
|
'headers' => ['Host' => data_get($protocol_settings, 'network_settings.headers.Host', $server['host'])]
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
@ -221,10 +221,10 @@ class ClashMeta implements ProtocolInterface
|
|||||||
switch (data_get($protocol_settings, 'network')) {
|
switch (data_get($protocol_settings, 'network')) {
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts'] = [
|
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path', '/');
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
'headers' => ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')]
|
$array['ws-opts']['headers'] = ['Host' => $host];
|
||||||
];
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
@ -248,7 +248,7 @@ class ClashMeta implements ProtocolInterface
|
|||||||
|
|
||||||
public static function buildTrojan($password, $server)
|
public static function buildTrojan($password, $server)
|
||||||
{
|
{
|
||||||
$settings = data_get($server, 'protocol_settings', []);
|
$protocol_settings = data_get($server, 'protocol_settings', []);
|
||||||
$array = [
|
$array = [
|
||||||
'name' => $server['name'],
|
'name' => $server['name'],
|
||||||
'type' => 'trojan',
|
'type' => 'trojan',
|
||||||
@ -256,23 +256,23 @@ class ClashMeta implements ProtocolInterface
|
|||||||
'port' => $server['port'],
|
'port' => $server['port'],
|
||||||
'password' => $password,
|
'password' => $password,
|
||||||
'udp' => true,
|
'udp' => true,
|
||||||
'sni' => data_get($settings, 'server_name'),
|
'sni' => data_get($protocol_settings, 'server_name'),
|
||||||
'skip-cert-verify' => (bool) data_get($settings, 'allow_insecure', false)
|
'skip-cert-verify' => (bool) data_get($protocol_settings, 'allow_insecure', false)
|
||||||
];
|
];
|
||||||
|
|
||||||
switch (data_get($settings, 'network')) {
|
switch (data_get($protocol_settings, 'network')) {
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
$array['grpc-opts'] = [
|
$array['grpc-opts'] = [
|
||||||
'grpc-service-name' => data_get($settings, 'network_settings.serviceName')
|
'grpc-service-name' => data_get($protocol_settings, 'network_settings.serviceName')
|
||||||
];
|
];
|
||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts'] = [
|
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path', '/');
|
||||||
'path' => data_get($settings, 'network_settings.path'),
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
'headers' => ['Host' => data_get($settings, 'network_settings.headers.Host')]
|
$array['ws-opts']['headers'] = ['Host' => $host];
|
||||||
];
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -83,13 +83,15 @@ class General implements ProtocolInterface
|
|||||||
switch ($protocol_settings['network']) {
|
switch ($protocol_settings['network']) {
|
||||||
case 'tcp':
|
case 'tcp':
|
||||||
$config['type'] = 'http';
|
$config['type'] = 'http';
|
||||||
$config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', []));
|
$config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']));
|
||||||
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host') ? \Arr::random(data_get($protocol_settings, 'network_settings.headers.Host')) : null;
|
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host') ? \Arr::random(data_get($protocol_settings, 'network_settings.headers.Host'),['/']) : null;
|
||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$config['type'] = 'ws';
|
$config['type'] = 'ws';
|
||||||
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host') ? \Arr::random(data_get($protocol_settings, 'network_settings.headers.Host')) : null;
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
|
$config['host'] = $host;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$config['type'] = 'grpc';
|
$config['type'] = 'grpc';
|
||||||
@ -137,7 +139,9 @@ class General implements ProtocolInterface
|
|||||||
switch ($server['protocol_settings']['network']) {
|
switch ($server['protocol_settings']['network']) {
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host');
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
|
$config['host'] = $host;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$config['serviceName'] = data_get($protocol_settings, 'network_settings.serviceName');
|
$config['serviceName'] = data_get($protocol_settings, 'network_settings.serviceName');
|
||||||
@ -148,11 +152,11 @@ class General implements ProtocolInterface
|
|||||||
break;
|
break;
|
||||||
case 'httpupgrade':
|
case 'httpupgrade':
|
||||||
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host');
|
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host', $server['host']);
|
||||||
break;
|
break;
|
||||||
case 'xhttp':
|
case 'xhttp':
|
||||||
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host');
|
$config['host'] = data_get($protocol_settings, 'network_settings.headers.Host', $server['host']);
|
||||||
$config['mode'] = data_get($protocol_settings, 'network_settings.mode', 'auto');
|
$config['mode'] = data_get($protocol_settings, 'network_settings.mode', 'auto');
|
||||||
$config['extra'] = data_get($protocol_settings, 'network_settings.extra') ? Helper::encodeURIComponent(data_get($protocol_settings, 'network_settings.extra')) : null;
|
$config['extra'] = data_get($protocol_settings, 'network_settings.extra') ? Helper::encodeURIComponent(data_get($protocol_settings, 'network_settings.extra')) : null;
|
||||||
break;
|
break;
|
||||||
|
@ -102,7 +102,9 @@ class Shadowrocket implements ProtocolInterface
|
|||||||
case 'ws':
|
case 'ws':
|
||||||
$config['obfs'] = "websocket";
|
$config['obfs'] = "websocket";
|
||||||
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$config['obfsParam'] = data_get($protocol_settings, 'network_settings.headers.Host');
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
|
$config['obfsParam'] = $host;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$config['obfs'] = "grpc";
|
$config['obfs'] = "grpc";
|
||||||
@ -159,12 +161,14 @@ class Shadowrocket implements ProtocolInterface
|
|||||||
case 'tcp':
|
case 'tcp':
|
||||||
$config['obfs'] = data_get($protocol_settings, 'network_settings.header.type');
|
$config['obfs'] = data_get($protocol_settings, 'network_settings.header.type');
|
||||||
$config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']));
|
$config['path'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']));
|
||||||
$config['obfsParam'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.headers.Host', ['']));
|
$config['obfsParam'] = \Arr::random(data_get($protocol_settings, 'network_settings.header.request.headers.Host', ['/']));
|
||||||
break;
|
break;
|
||||||
case 'ws':
|
case 'ws':
|
||||||
$config['obfs'] = "websocket";
|
$config['obfs'] = "websocket";
|
||||||
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
$config['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$config['obfsParam'] = data_get($protocol_settings, 'network_settings.headers.Host');
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
|
$config['obfsParam'] = $host;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$config['obfs'] = "grpc";
|
$config['obfs'] = "grpc";
|
||||||
|
@ -135,12 +135,12 @@ class SingBox implements ProtocolInterface
|
|||||||
$transport = match ($protocol_settings['network']) {
|
$transport = match ($protocol_settings['network']) {
|
||||||
'tcp' => [
|
'tcp' => [
|
||||||
'type' => 'http',
|
'type' => 'http',
|
||||||
'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', []))
|
'path' => \Arr::random(data_get($protocol_settings, 'network_settings.header.request.path', ['/']))
|
||||||
],
|
],
|
||||||
'ws' => [
|
'ws' => [
|
||||||
'type' => 'ws',
|
'type' => 'ws',
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
'path' => data_get($protocol_settings, 'network_settings.path'),
|
||||||
'headers' => data_get($protocol_settings, 'network_settings.headers.Host') ? ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')] : null,
|
'headers' => ($host = data_get($protocol_settings, 'network_settings.headers.Host')) ? ['Host' => $host] : null,
|
||||||
'max_early_data' => 2048,
|
'max_early_data' => 2048,
|
||||||
'early_data_header_name' => 'Sec-WebSocket-Protocol'
|
'early_data_header_name' => 'Sec-WebSocket-Protocol'
|
||||||
],
|
],
|
||||||
@ -196,13 +196,13 @@ class SingBox implements ProtocolInterface
|
|||||||
'type' => 'http',
|
'type' => 'http',
|
||||||
'path' => data_get($protocol_settings, 'network_settings.header.request.path')
|
'path' => data_get($protocol_settings, 'network_settings.header.request.path')
|
||||||
] : null,
|
] : null,
|
||||||
'ws' => [
|
'ws' => array_filter([
|
||||||
'type' => 'ws',
|
'type' => 'ws',
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
'path' => data_get($protocol_settings, 'network_settings.path'),
|
||||||
'headers' => data_get($protocol_settings, 'network_settings.headers.Host') ? ['Host' => [data_get($protocol_settings, 'network_settings.headers.Host')]] : null,
|
'headers' => ($host = data_get($protocol_settings, 'network_settings.headers.Host')) ? ['Host' => $host] : null,
|
||||||
'max_early_data' => 2048,
|
'max_early_data' => 2048,
|
||||||
'early_data_header_name' => 'Sec-WebSocket-Protocol'
|
'early_data_header_name' => 'Sec-WebSocket-Protocol'
|
||||||
],
|
], fn($value) => !is_null($value)),
|
||||||
'grpc' => [
|
'grpc' => [
|
||||||
'type' => 'grpc',
|
'type' => 'grpc',
|
||||||
'service_name' => data_get($protocol_settings, 'network_settings.serviceName')
|
'service_name' => data_get($protocol_settings, 'network_settings.serviceName')
|
||||||
@ -215,7 +215,7 @@ class SingBox implements ProtocolInterface
|
|||||||
'httpupgrade' => [
|
'httpupgrade' => [
|
||||||
'type' => 'httpupgrade',
|
'type' => 'httpupgrade',
|
||||||
'path' => data_get($protocol_settings, 'network_settings.path'),
|
'path' => data_get($protocol_settings, 'network_settings.path'),
|
||||||
'host' => data_get($protocol_settings, 'network_settings.headers.Host'),
|
'host' => data_get($protocol_settings, 'network_settings.headers.Host', $server['host']),
|
||||||
'headers' => data_get($protocol_settings, 'network_settings.headers')
|
'headers' => data_get($protocol_settings, 'network_settings.headers')
|
||||||
],
|
],
|
||||||
default => null
|
default => null
|
||||||
|
@ -152,7 +152,9 @@ class Stash implements ProtocolInterface
|
|||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$array['ws-opts']['headers'] = data_get($protocol_settings, 'network_settings.headers.Host') ? ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')] : null;
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
|
$array['ws-opts']['headers'] = ['Host' => $host];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
@ -205,7 +207,9 @@ class Stash implements ProtocolInterface
|
|||||||
case 'ws':
|
case 'ws':
|
||||||
$array['network'] = 'ws';
|
$array['network'] = 'ws';
|
||||||
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
$array['ws-opts']['path'] = data_get($protocol_settings, 'network_settings.path');
|
||||||
$array['ws-opts']['headers'] = data_get($protocol_settings, 'network_settings.headers.Host') ? ['Host' => data_get($protocol_settings, 'network_settings.headers.Host')] : null;
|
if ($host = data_get($protocol_settings, 'network_settings.headers.Host')) {
|
||||||
|
$array['ws-opts']['headers'] = ['Host' => $host];
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'grpc':
|
case 'grpc':
|
||||||
$array['network'] = 'grpc';
|
$array['network'] = 'grpc';
|
||||||
|
@ -67,6 +67,7 @@ class OrderService
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->setSpeedLimit($plan->speed_limit);
|
$this->setSpeedLimit($plan->speed_limit);
|
||||||
|
$this->setDeviceLimit($plan->device_limit);
|
||||||
|
|
||||||
if (!$this->user->save()) {
|
if (!$this->user->save()) {
|
||||||
throw new \Exception('用户信息保存失败');
|
throw new \Exception('用户信息保存失败');
|
||||||
@ -272,6 +273,11 @@ class OrderService
|
|||||||
$this->user->speed_limit = $speedLimit;
|
$this->user->speed_limit = $speedLimit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function setDeviceLimit($deviceLimit)
|
||||||
|
{
|
||||||
|
$this->user->device_limit = $deviceLimit;
|
||||||
|
}
|
||||||
|
|
||||||
private function buyByResetTraffic()
|
private function buyByResetTraffic()
|
||||||
{
|
{
|
||||||
$this->user->u = 0;
|
$this->user->u = 0;
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('v2_notice', function (Blueprint $table) {
|
||||||
|
$table->integer('sort')->nullable()->after('id')->index();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('v2_notice', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('sort');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
DB::table('v2_order')->where('commission_status', null)->update([
|
||||||
|
'commission_status' => 0
|
||||||
|
]);
|
||||||
|
Schema::table('v2_order', function (Blueprint $table) {
|
||||||
|
$table->boolean('commission_status')->default(value: 0)->comment('0待确认1发放中2有效3无效')->change();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('v2_order', function (Blueprint $table) {
|
||||||
|
$table->boolean('commission_status')->nullable()->comment('0待确认1发放中2有效3无效')->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
2
public/assets/admin/assets/index.css
vendored
2
public/assets/admin/assets/index.css
vendored
File diff suppressed because one or more lines are too long
8
public/assets/admin/assets/index.js
vendored
8
public/assets/admin/assets/index.js
vendored
File diff suppressed because one or more lines are too long
131
public/assets/admin/assets/vendor.js
vendored
131
public/assets/admin/assets/vendor.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user