diff --git a/app/Console/Commands/NodeDailyMaintenance.php b/app/Console/Commands/NodeDailyMaintenance.php
index 4c20c9b2..00de8592 100644
--- a/app/Console/Commands/NodeDailyMaintenance.php
+++ b/app/Console/Commands/NodeDailyMaintenance.php
@@ -75,9 +75,9 @@ class NodeDailyMaintenance extends Command
$now = Carbon::now();
$notificationDates = [ // 通知日期 分别是 前1天,3天和7天
- $now->addDays(1)->format('Y-m-d'),
- $now->addDays(2)->format('Y-m-d'),
- $now->addDays(4)->format('Y-m-d'),
+ $now->addDays(1)->toDateString(),
+ $now->addDays(2)->toDateString(),
+ $now->addDays(4)->toDateString(),
];
$nodes = Node::whereNotNull('details')->whereIn('details->next_renewal_date', $notificationDates)->pluck('name', 'id')->toArray();
@@ -93,14 +93,14 @@ class NodeDailyMaintenance extends Command
$nodes = Node::whereNotNull('details')
->where(function (Builder $query) {
$query->where('details->subscription_term', '<>', null)
- ->where('details->next_renewal_date', '<=', Carbon::now()->format('Y-m-d'));
+ ->where('details->next_renewal_date', '<=', Carbon::now()->toDateString());
})
->get();
// 更新每个节点的 next_renewal_date
foreach ($nodes as $node) {
$details = $node->details;
- $details['next_renewal_date'] = Carbon::createFromFormat('Y-m-d', $details['next_renewal_date'])->add($details['subscription_term'])->format('Y-m-d');
+ $details['next_renewal_date'] = Carbon::createFromFormat('Y-m-d', $details['next_renewal_date'])->add($details['subscription_term'])->toDateString();
$node->details = $details;
$node->save();
diff --git a/app/Console/Commands/NodeStatusDetection.php b/app/Console/Commands/NodeStatusDetection.php
index d7b6f869..0d70362f 100644
--- a/app/Console/Commands/NodeStatusDetection.php
+++ b/app/Console/Commands/NodeStatusDetection.php
@@ -119,7 +119,7 @@ class NodeStatusDetection extends Command
}
}
- if (! empty($data)) { //只有在出现阻断线路时,才会发出警报
+ if (! empty($data)) { // 只有在出现阻断线路时,才会发出警报
Notification::send(User::find(1), new NodeBlocked($data));
Log::notice(trans('notification.node_block').": \r\n".var_export($data, true));
diff --git a/app/Helpers/ClientApiResponse.php b/app/Helpers/ClientApiResponse.php
index 9193eb0a..f7f34cf2 100644
--- a/app/Helpers/ClientApiResponse.php
+++ b/app/Helpers/ClientApiResponse.php
@@ -7,7 +7,7 @@ use Illuminate\Http\Request;
trait ClientApiResponse
{
- private static string $client;
+ private static string $client = 'clash';
public function __construct(Request $request)
{
@@ -34,11 +34,11 @@ trait ClientApiResponse
$result = ['ret' => $status, 'msg' => $message, 'data' => $data];
if (isset($addition)) {
- $result = array_merge($result, $addition);
+ $result += $addition;
}
} else { // ProxyPanel client api 规范格式
if (isset($data, $addition) && is_array($data)) {
- $data = array_merge($data, $addition);
+ $data += $addition;
}
$result = ['status' => $status ? 'success' : 'fail', 'code' => $code, 'message' => $message, 'data' => $data ?? $addition];
diff --git a/app/Helpers/ResponseEnum.php b/app/Helpers/ResponseEnum.php
index cbe03802..f1a6e399 100644
--- a/app/Helpers/ResponseEnum.php
+++ b/app/Helpers/ResponseEnum.php
@@ -6,12 +6,12 @@ class ResponseEnum
{
// 001 ~ 099 表示系统状态;100 ~ 199 表示授权业务;200 ~ 299 表示用户业务
- /*-------------------------------------------------------------------------------------------*/
+ /* ------------------------------------------------------------------------------------------- */
// 100开头的表示 信息提示,这类状态表示临时的响应
// 100 - 继续
// 101 - 切换协议
- /*-------------------------------------------------------------------------------------------*/
+ /* ------------------------------------------------------------------------------------------- */
// 200表示服务器成功地接受了客户端请求
public const HTTP_OK = [200001, '操作成功'];
@@ -33,13 +33,13 @@ class ResponseEnum
public const USER_ACCOUNT_REGISTERED = [23001, '账号已注册'];
- /*-------------------------------------------------------------------------------------------*/
+ /* ------------------------------------------------------------------------------------------- */
// 300开头的表示服务器重定向,指向的别的地方,客户端浏览器必须采取更多操作来实现请求
// 302 - 对象已移动。
// 304 - 未修改。
// 307 - 临时重定向。
- /*-------------------------------------------------------------------------------------------*/
+ /* ------------------------------------------------------------------------------------------- */
// 400开头的表示客户端错误请求错误,请求不到数据,或者找不到等等
// 400 - 错误的请求
public const CLIENT_NOT_FOUND_HTTP_ERROR = [400001, '请求失败'];
@@ -75,7 +75,7 @@ class ResponseEnum
// 417 – 执行失败
// 423 – 锁定的错误
- /*-------------------------------------------------------------------------------------------*/
+ /* ------------------------------------------------------------------------------------------- */
// 500开头的表示服务器错误,服务器因为代码,或者什么原因终止运行
// 服务端操作错误码:500 ~ 599 开头,后拼接 3 位
// 500 - 内部服务器错误
@@ -98,10 +98,10 @@ class ResponseEnum
public const SERVICE_USER_INTEGRAL_ERROR = [500200, '积分不足'];
- //501 - 页眉值指定了未实现的配置
- //502 - Web 服务器用作网关或代理服务器时收到了无效响应
- //503 - 服务不可用。这个错误代码为 IIS 6.0 所专用
- //504 - 网关超时
- //505 - HTTP 版本不受支持
- /*-------------------------------------------------------------------------------------------*/
+ // 501 - 页眉值指定了未实现的配置
+ // 502 - Web 服务器用作网关或代理服务器时收到了无效响应
+ // 503 - 服务不可用。这个错误代码为 IIS 6.0 所专用
+ // 504 - 网关超时
+ // 505 - HTTP 版本不受支持
+ /* ------------------------------------------------------------------------------------------- */
}
diff --git a/app/Helpers/WebApiResponse.php b/app/Helpers/WebApiResponse.php
index 8a14d968..0c11e4d4 100644
--- a/app/Helpers/WebApiResponse.php
+++ b/app/Helpers/WebApiResponse.php
@@ -20,7 +20,7 @@ trait WebApiResponse
$code = $code < 1000 ? $code : (int) ($code / 1000);
$data = compact('status', 'code', 'data', 'message');
if (isset($addition)) {
- $data = array_merge($data, $addition);
+ $data += $addition;
}
return response()->json($data, $code, ['ETAG' => $etag ?? '']);
diff --git a/app/Http/Controllers/Admin/InviteController.php b/app/Http/Controllers/Admin/InviteController.php
index 08be6ef3..65e33146 100644
--- a/app/Http/Controllers/Admin/InviteController.php
+++ b/app/Http/Controllers/Admin/InviteController.php
@@ -50,7 +50,7 @@ class InviteController extends Controller
}
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); // 输出07Excel文件
- //header('Content-Type:application/vnd.ms-excel'); // 输出Excel03版本文件
+ // header('Content-Type:application/vnd.ms-excel'); // 输出Excel03版本文件
header('Content-Disposition: attachment;filename="'.$filename.'"');
header('Cache-Control: max-age=0');
try {
diff --git a/app/Http/Controllers/Admin/LogsController.php b/app/Http/Controllers/Admin/LogsController.php
index b91e9065..9408244f 100644
--- a/app/Http/Controllers/Admin/LogsController.php
+++ b/app/Http/Controllers/Admin/LogsController.php
@@ -259,7 +259,7 @@ class LogsController extends Controller
public function userTrafficMonitor(User $user): View
{ // 用户流量监控
- return view('admin.logs.userMonitor', array_merge(['username' => $user->username], $this->dataFlowChart($user->id)));
+ return view('admin.logs.userMonitor', ['username' => $user->username, ...$this->dataFlowChart($user->id)]);
}
public function callbackList(Request $request): View
diff --git a/app/Http/Controllers/Admin/NodeController.php b/app/Http/Controllers/Admin/NodeController.php
index 6bd9e6a5..06fc70ee 100644
--- a/app/Http/Controllers/Admin/NodeController.php
+++ b/app/Http/Controllers/Admin/NodeController.php
@@ -282,6 +282,6 @@ class NodeController extends Controller
public function nodeMonitor(Node $node): View
{ // 节点流量监控
- return view('admin.node.monitor', array_merge(['nodeName' => $node->name, 'nodeServer' => $node->server], $this->DataFlowChart($node->id, true)));
+ return view('admin.node.monitor', ['nodeName' => $node->name, 'nodeServer' => $node->server, ...$this->DataFlowChart($node->id, true)]);
}
}
diff --git a/app/Http/Controllers/Admin/ReportController.php b/app/Http/Controllers/Admin/ReportController.php
index 1c834af7..5cdabd67 100644
--- a/app/Http/Controllers/Admin/ReportController.php
+++ b/app/Http/Controllers/Admin/ReportController.php
@@ -23,7 +23,7 @@ class ReportController extends Controller
{
$completedOrders = Order::where('status', '>=', 2)->has('goods')->selectRaw('DATE(created_at) as date, sum(amount)/100 as total')->groupBy('date')->get();
- $ordersByDay = $completedOrders->filter(fn ($order) => $order->date >= now()->subMonthNoOverflow()->startOfMonth()->format('Y-m-d'))->pluck('total', 'date');
+ $ordersByDay = $completedOrders->filter(fn ($order) => $order->date >= now()->subMonthNoOverflow()->startOfMonth()->toDateString())->pluck('total', 'date');
$ordersByMonth = $completedOrders->filter(fn ($order) => $order->date >= now()->subYearNoOverflow()->startOfYear())->groupBy(fn ($order) => Carbon::parse($order->date)->format('Y-m'))->map(fn ($rows) => round($rows->sum('total'),
2))->toArray();
@@ -54,7 +54,7 @@ class ReportController extends Controller
$user = $uid ? User::find($uid) : ($username ? User::whereUsername($username)->first() : null);
$data = [
- 'start_date' => Carbon::parse(UserDailyDataFlow::whereNotNull('node_id')->orderBy('created_at')->value('created_at'))->format('Y-m-d'),
+ 'start_date' => Carbon::parse(UserDailyDataFlow::whereNotNull('node_id')->orderBy('created_at')->value('created_at'))->toDateString(),
];
if ($user) {
@@ -137,7 +137,7 @@ class ReportController extends Controller
$dailyFlows = $dailyFlows->concat($todayData->map(fn ($item) => $item['daily']));
}
- $data = array_merge($data, [
+ $data += [
'hours' => range(0, 23),
'days' => collect(CarbonPeriod::create($startDate, $endDate))->map(fn ($date) => $date->format('m-d')),
'nodes' => $hourlyFlows->concat($dailyFlows)->pluck('name', 'id')->unique()->toArray(),
@@ -147,7 +147,7 @@ class ReportController extends Controller
->orderByDesc('date')
->pluck('date')
->toArray(),
- ]);
+ ];
}
return view('admin.report.userDataAnalysis', compact('data'));
@@ -160,7 +160,7 @@ class ReportController extends Controller
$currentHour = $currentTime->hour;
$nodeId = $request->input('nodes');
$startDate = $request->input('start') ?? $currentTime->format('Y-m-01');
- $endDate = $request->input('end') ?? $currentTime->format('Y-m-d');
+ $endDate = $request->input('end') ?? $currentTime->toDateString();
$hour_date = $request->input('hour_date') ?? $currentTime; // 默认是今天
$nodes = Node::orderBy('name')->pluck('name', 'id'); // 用于前端节点显示
@@ -177,7 +177,7 @@ class ReportController extends Controller
$data = [
'hours' => range(0, 23),
- 'start_date' => Carbon::parse(NodeDailyDataFlow::orderBy('created_at')->value('created_at'))->format('Y-m-d'), // 数据库里最早的日期
+ 'start_date' => Carbon::parse(NodeDailyDataFlow::orderBy('created_at')->value('created_at'))->toDateString(), // 数据库里最早的日期
];
$hoursFlow = $hourlyQuery->whereDate('created_at', $hour_date)->selectRaw('node_id, HOUR(created_at) as hour, u + d as total')->get()->map(fn ($item) => [
@@ -202,7 +202,7 @@ class ReportController extends Controller
'total' => round($item->total / GiB, 2),
])->toArray();
- $hoursFlow = array_merge($hoursFlow, $currentHourFlow);
+ $hoursFlow += $currentHourFlow;
if (Carbon::parse($endDate)->isToday()) {
$currentDayFlow = collect($hoursFlow)->groupBy('id')->map(fn ($items) => [
@@ -212,7 +212,7 @@ class ReportController extends Controller
'total' => round($items->sum('total'), 2),
])->values()->toArray();
- $daysFlow = array_merge($daysFlow, $currentDayFlow);
+ $daysFlow += $currentDayFlow;
}
} elseif (Carbon::parse($endDate)->isToday()) { // 如果结束日期是今天,本日流量需要另外计算
$todayHourlyQuery = NodeHourlyDataFlow::query();
@@ -242,7 +242,7 @@ class ReportController extends Controller
'total' => round($items->sum('total'), 2),
])->values()->toArray();
- $daysFlow = array_merge($daysFlow, $currentDayFlow);
+ $daysFlow += $currentDayFlow;
}
$data['hourlyFlows'] = $hoursFlow;
diff --git a/app/Http/Controllers/Admin/ToolsController.php b/app/Http/Controllers/Admin/ToolsController.php
index 2b999236..1b1b1633 100644
--- a/app/Http/Controllers/Admin/ToolsController.php
+++ b/app/Http/Controllers/Admin/ToolsController.php
@@ -42,7 +42,7 @@ class ToolsController extends Controller
}
// 生成转换好的JSON文件
- //file_put_contents(public_path('downloads/decompile.json'), $txt);
+ // file_put_contents(public_path('downloads/decompile.json'), $txt);
return response()->json(['status' => 'success', 'data' => $txt, 'message' => trans('common.success_item', ['attribute' => trans('admin.tools.decompile.attribute')])]);
}
@@ -254,9 +254,9 @@ class ToolsController extends Controller
$fp = fopen($file, 'rb');
$i = 0;
while (! feof($fp)) {
- //每次读取2M
+ // 每次读取2M
if ($data = fread($fp, 1024 * 1024 * 2)) {
- //计算读取到的行数
+ // 计算读取到的行数
$num = substr_count($data, "\n");
$i += $num;
}
diff --git a/app/Http/Controllers/MessageController.php b/app/Http/Controllers/MessageController.php
index 6fabdd27..e3a7f1ac 100644
--- a/app/Http/Controllers/MessageController.php
+++ b/app/Http/Controllers/MessageController.php
@@ -10,12 +10,12 @@ class MessageController extends Controller
{
public function index(string $type, string $msgId): View
{
- //if ($type === 'markdown') {
+ // if ($type === 'markdown') {
$log = NotificationLog::whereMsgId($msgId)->latest()->firstOrFail();
$title = $log->title;
$content = Markdown::parse($log->content)->toHtml();
return view('components.message', compact('title', 'content'));
- //}
+ // }
}
}
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 961127b4..4128d4b5 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -32,7 +32,7 @@ class UserController extends Controller
$query->latest()->first();
}]);
- return view('user.index', array_merge([
+ return view('user.index', [
'remainDays' => $userService->getRemainingDays(),
'resetDays' => $userService->getResetDays(),
'unusedPercent' => $userService->getUnusedTrafficPercent(),
@@ -45,7 +45,7 @@ class UserController extends Controller
'userLoginLog' => $user->loginLogs->first(), // 近期登录日志
'subType' => $nodeService->getActiveNodeTypes($user->nodes()),
'subscribe' => $user->subscribe->only(['status', 'ban_desc']),
- ], $this->dataFlowChart($user->id)));
+ ...$this->dataFlowChart($user->id)]);
}
// 签到
diff --git a/app/Http/Requests/Admin/RuleRequest.php b/app/Http/Requests/Admin/RuleRequest.php
index 89e18bc6..bd75739e 100644
--- a/app/Http/Requests/Admin/RuleRequest.php
+++ b/app/Http/Requests/Admin/RuleRequest.php
@@ -14,7 +14,7 @@ class RuleRequest extends FormRequest
];
if (! in_array($this->method(), ['PATCH', 'PUT'], true)) {
- $rules = array_merge(['type' => 'required|numeric|between:1,4'], $rules);
+ $rules += ['type' => 'required|numeric|between:1,4'];
}
return $rules;
diff --git a/app/Observers/UserObserver.php b/app/Observers/UserObserver.php
index 0f0db97e..59ebae46 100644
--- a/app/Observers/UserObserver.php
+++ b/app/Observers/UserObserver.php
@@ -36,8 +36,8 @@ class UserObserver
addUser::dispatch($user->id, $allowNodes);
}
} else {
- $old = $oldAllowNodes->diff($allowNodes); //old 有 allow 没有
- $new = $allowNodes->diff($oldAllowNodes); //allow 有 old 没有
+ $old = $oldAllowNodes->diff($allowNodes); // old 有 allow 没有
+ $new = $allowNodes->diff($oldAllowNodes); // allow 有 old 没有
if ($old->isNotEmpty()) {
delUser::dispatch($user->id, $old);
}
diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php
index ec971800..30a36749 100644
--- a/app/Services/OrderService.php
+++ b/app/Services/OrderService.php
@@ -86,6 +86,7 @@ class OrderService
'level' => self::$goods->level,
'speed_limit' => self::$goods->speed_limit,
'enable' => 1,
+ ...$this->resetTimeAndData(),
];
// 无端口用户 添加端口
@@ -93,7 +94,7 @@ class OrderService
$updateData['port'] = Helpers::getPort();
}
- if (self::$user->update(array_merge($this->resetTimeAndData(), $updateData))) {
+ if (self::$user->update($updateData)) {
return Helpers::addUserTrafficModifyLog($this->order->user_id, $oldData, self::$user->transfer_enable, trans('[:payment] plus the user’s purchased data plan.', ['payment' => $this->order->pay_way]), $this->order->id);
}
@@ -106,8 +107,8 @@ class OrderService
$expired_at = $this->getFinallyExpiredTime();
}
- //账号流量重置日期
- $nextResetTime = now()->addDays(self::$goods->period)->format('Y-m-d');
+ // 账号流量重置日期
+ $nextResetTime = now()->addDays(self::$goods->period)->toDateString();
if ($nextResetTime >= $expired_at) {
$nextResetTime = null;
}
@@ -126,7 +127,7 @@ class OrderService
$orders = self::$user->orders()->whereIn('status', [2, 3])->whereIsExpire(0)->isPlan()->get();
$current = $orders->where('status', '==', 2)->first();
- return ($current->expired_at ?? now())->addDays($orders->except($current->id ?? 0)->sum('goods.days'))->format('Y-m-d');
+ return ($current->expired_at ?? now())->addDays($orders->except($current->id ?? 0)->sum('goods.days'))->toDateString();
}
private function setCommissionExpense(User $user): void
@@ -159,8 +160,8 @@ class OrderService
{ // 刷新账号有效时间
$data = ['expired_at' => $this->getFinallyExpiredTime()];
- if ($data['expired_at'] < now()->format('Y-m-d')) {
- $data = array_merge([
+ if ($data['expired_at'] < now()->toDateString()) {
+ $data += [
'u' => 0,
'd' => 0,
'transfer_enable' => 0,
@@ -168,7 +169,7 @@ class OrderService
'level' => 0,
'reset_time' => null,
'ban_time' => null,
- ], $data);
+ ];
}
return self::$user->update($data);
diff --git a/app/Services/ProxyService.php b/app/Services/ProxyService.php
index 22314640..2f32eb96 100644
--- a/app/Services/ProxyService.php
+++ b/app/Services/ProxyService.php
@@ -108,6 +108,7 @@ class ProxyService
'udp' => $node->is_udp,
];
+ // 如果是中转节点,递归处理父节点配置
if ($node->relay_node_id) {
$parentConfig = $this->getProxyConfig($node->relayNode);
$config = array_merge($config, Arr::except($parentConfig, ['id', 'name', 'host', 'group', 'udp']));
@@ -207,7 +208,7 @@ class ProxyService
}
}
- return URLSchemes::build($this->getServers()); // Origin
+ return URLSchemes::build($this->getServers()); // Default return
}
public function getProxyCode(string $target, ?int $type = null): ?string
diff --git a/app/Utils/Avatar.php b/app/Utils/Avatar.php
index 43c3439e..b24621b9 100644
--- a/app/Utils/Avatar.php
+++ b/app/Utils/Avatar.php
@@ -59,12 +59,12 @@ class Avatar
}
private static function qZonePortrait(string $url, string $qq): ?string
- { //向接口发起请求获取json数据
+ { // 向接口发起请求获取json数据
$response = self::$basicRequest->get($url);
if ($response->ok()) {
$message = mb_convert_encoding($response->body(), 'UTF-8', 'GBK');
if (str_contains($message, $qq)) { // 接口是否异常
- $message = json_decode(substr($message, 17, -1), true); //对获取的json数据进行截取并解析成数组
+ $message = json_decode(substr($message, 17, -1), true); // 对获取的json数据进行截取并解析成数组
return stripslashes($message[$qq][0]);
}
diff --git a/app/Utils/Clients/Quantumult.php b/app/Utils/Clients/Quantumult.php
index d5c42ab2..690726f1 100644
--- a/app/Utils/Clients/Quantumult.php
+++ b/app/Utils/Clients/Quantumult.php
@@ -19,7 +19,7 @@ class Quantumult implements Client
public function getConfig(array $servers, User $user, string $target): string
{
- //display remaining traffic and expire date
+ // display remaining traffic and expire date
if (sysConfig('is_custom_subscribe')) {
header("Subscription-Userinfo: upload=$user->u; download=$user->d; total=$user->transfer_enable; expire=".strtotime($user->expired_at));
}
diff --git a/app/Utils/Clients/Shadowrocket.php b/app/Utils/Clients/Shadowrocket.php
index 9b68ab12..4d662990 100644
--- a/app/Utils/Clients/Shadowrocket.php
+++ b/app/Utils/Clients/Shadowrocket.php
@@ -13,7 +13,7 @@ class Shadowrocket implements Client
public function getConfig(array $servers, User $user): string
{
$uri = '';
- //display remaining traffic and expire date
+ // display remaining traffic and expire date
if (sysConfig('is_custom_subscribe')) {
$usedTraffic = formatBytes($user->used_traffic);
$remainTraffic = formatBytes($user->unused_traffic);
diff --git a/app/Utils/DDNS/AliYun.php b/app/Utils/DDNS/AliYun.php
index 6ca0e647..c56e8112 100644
--- a/app/Utils/DDNS/AliYun.php
+++ b/app/Utils/DDNS/AliYun.php
@@ -66,16 +66,16 @@ class AliYun implements DNS
private function sendRequest(string $action, array $parameters = []): array
{
- $parameters = array_merge([
+ $parameters += [
'Action' => $action,
'Format' => 'JSON',
'Version' => '2015-01-09',
'AccessKeyId' => $this->accessKeyID,
'SignatureMethod' => 'HMAC-SHA1',
- 'Timestamp' => gmdate("Y-m-d\TH:i:s\Z"), //公共参数Timestamp GMT时间
+ 'Timestamp' => gmdate("Y-m-d\TH:i:s\Z"), // 公共参数Timestamp GMT时间
'SignatureVersion' => '1.0',
- 'SignatureNonce' => str_replace('.', '', microtime(true)), //唯一数,用于防止网络重放攻击
- ], $parameters);
+ 'SignatureNonce' => str_replace('.', '', microtime(true)), // 唯一数,用于防止网络重放攻击
+ ];
$parameters['Signature'] = $this->generateSignature($parameters);
$response = Http::asForm()->timeout(15)->post(self::API_ENDPOINT, $parameters);
diff --git a/app/Utils/DDNS/ClouDNS.php b/app/Utils/DDNS/ClouDNS.php
index 7481137f..73d671d9 100644
--- a/app/Utils/DDNS/ClouDNS.php
+++ b/app/Utils/DDNS/ClouDNS.php
@@ -53,7 +53,7 @@ class ClouDNS implements DNS
private function sendRequest(string $action, array $parameters = []): array
{
- $response = Http::timeout(15)->get(self::API_ENDPOINT."$action.json", array_merge(['auth-id' => $this->authID, 'auth-password' => $this->authPassword], $parameters));
+ $response = Http::timeout(15)->get(self::API_ENDPOINT."$action.json", ['auth-id' => $this->authID, 'auth-password' => $this->authPassword, ...$parameters]);
if ($response->successful()) {
$data = $response->json();
diff --git a/app/Utils/DDNS/Namecheap.php b/app/Utils/DDNS/Namecheap.php
index bb37d9f8..bf66c49c 100644
--- a/app/Utils/DDNS/Namecheap.php
+++ b/app/Utils/DDNS/Namecheap.php
@@ -62,15 +62,7 @@ class Namecheap implements DNS
private function sendRequest(string $action, array $parameters = []): array
{
- $parameters = array_merge([
- 'ApiUser' => $this->username,
- 'ApiKey' => $this->apiKey,
- 'UserName' => $this->username,
- 'ClientIp' => IP::getClientIP(),
- 'Command' => $action,
- ], $parameters);
-
- $response = Http::timeout(15)->retry(3, 1000)->get(self::API_ENDPOINT, $parameters);
+ $response = Http::timeout(15)->retry(3, 1000)->get(self::API_ENDPOINT, ['ApiUser' => $this->username, 'ApiKey' => $this->apiKey, 'UserName' => $this->username, 'ClientIp' => IP::getClientIP(), 'Command' => $action, ...$parameters]);
$data = $response->body();
if ($data) {
$data = json_decode(json_encode(simplexml_load_string($data)), true);
diff --git a/app/Utils/DDNS/Namesilo.php b/app/Utils/DDNS/Namesilo.php
index 9c2680eb..3aa7ed51 100644
--- a/app/Utils/DDNS/Namesilo.php
+++ b/app/Utils/DDNS/Namesilo.php
@@ -50,7 +50,7 @@ class Namesilo implements DNS
private function sendRequest(string $action, array $parameters = []): array
{
- $response = Http::timeout(15)->retry(3, 1000)->get(self::API_ENDPOINT.$action, array_merge(['version' => 1, 'type' => 'json', 'key' => $this->apiKey], $parameters));
+ $response = Http::timeout(15)->retry(3, 1000)->get(self::API_ENDPOINT.$action, ['version' => 1, 'type' => 'json', 'key' => $this->apiKey, ...$parameters]);
if ($response->ok()) {
$data = $response->json();
diff --git a/app/Utils/DDNS/Porkbun.php b/app/Utils/DDNS/Porkbun.php
index b57cc40a..a626758e 100644
--- a/app/Utils/DDNS/Porkbun.php
+++ b/app/Utils/DDNS/Porkbun.php
@@ -53,8 +53,7 @@ class Porkbun implements DNS
private function sendRequest(string $uri, array $parameters = []): array|bool
{
- $parameters = array_merge($parameters, ['apikey' => $this->apiKey, 'secretapikey' => $this->secretKey]);
- $response = Http::timeout(15)->retry(3, 1000)->baseUrl(self::API_ENDPOINT)->asJson()->post($uri, $parameters);
+ $response = Http::timeout(15)->retry(3, 1000)->baseUrl(self::API_ENDPOINT)->asJson()->post($uri, ['apikey' => $this->apiKey, 'secretapikey' => $this->secretKey, ...$parameters]);
$data = $response->json();
if ($response->successful()) {
diff --git a/app/Utils/Helpers.php b/app/Utils/Helpers.php
index 38476cc7..cd676c4a 100644
--- a/app/Utils/Helpers.php
+++ b/app/Utils/Helpers.php
@@ -68,7 +68,7 @@ class Helpers
'protocol' => self::getDefaultProtocol(),
'obfs' => self::getDefaultObfs(),
'transfer_enable' => $transfer_enable,
- 'expired_at' => now()->addDays($date)->format('Y-m-d'),
+ 'expired_at' => now()->addDays($date)->toDateString(),
'user_group_id' => null,
'reg_ip' => IP::getClientIp(),
'inviter_id' => $inviter_id,
diff --git a/config/client.php b/config/client.php
index bcaa8367..62705d4a 100644
--- a/config/client.php
+++ b/config/client.php
@@ -46,31 +46,31 @@ return [
'subscribe_url' => 'http://api.xxx.com',
// 签到获得流量
- 'checkinMin' => 1, //用户签到最少流量 单位MB
- 'checkinMax' => 50, //用户签到最多流量
+ 'checkinMin' => 1, // 用户签到最少流量 单位MB
+ 'checkinMax' => 50, // 用户签到最多流量
- 'code_payback' => 10, //充值返利百分比
- 'invite_gift' => 2, //邀请新用户获得流量奖励,单位G
+ 'code_payback' => 10, // 充值返利百分比
+ 'invite_gift' => 2, // 邀请新用户获得流量奖励,单位G
// 软件版本和更新地址
'vpn_update' => [
- 'enable' => false, //是否开启更新
+ 'enable' => false, // 是否开启更新
'android' => [
'version' => '2.4.3', // 版本号
- 'download_url' => env('APP_URL').'/clients/bob.apk', //下载地址
- 'message' => '版本更新:
1.添加点击签到提示框
2.修复剩余流量显示问题', //提示信息
- 'must' => false, //true:强制更新 false:不强制更新
+ 'download_url' => env('APP_URL').'/clients/bob.apk', // 下载地址
+ 'message' => '版本更新:
1.添加点击签到提示框
2.修复剩余流量显示问题', // 提示信息
+ 'must' => false, // true:强制更新 false:不强制更新
],
'windows' => [
'version' => '3.7.0', // 版本号
- 'download_url' => env('APP_URL').'/clients/bob.exe', //下载地址
- 'message' => '版本更新:
1.修复剩余流量显示问题
2.优化节点测试显示
3.修复弹出网页部分按钮无法使用问题', //提示信息
- 'must' => false, //true:强制更新 false:不强制更新
+ 'download_url' => env('APP_URL').'/clients/bob.exe', // 下载地址
+ 'message' => '版本更新:
1.修复剩余流量显示问题
2.优化节点测试显示
3.修复弹出网页部分按钮无法使用问题', // 提示信息
+ 'must' => false, // true:强制更新 false:不强制更新
],
'mac' => [
'version' => '3.7.0', // 版本号
'download_url' => env('APP_URL').'/clients/bob.zip', // 下载地址
- 'message' => '版本更新:
1.修复剩余流量显示问题
2.优化节点测试显示
3.修复弹出网页部分按钮无法使用问题', //提示信息
+ 'message' => '版本更新:
1.修复剩余流量显示问题
2.优化节点测试显示
3.修复弹出网页部分按钮无法使用问题', // 提示信息
'must' => false, // true:强制更新 false:不强制更新
],
],
@@ -136,19 +136,19 @@ return [
],
// 易支付
'policepay' => [
- 'partner' => '', //商户号
- 'key' => '', //商户key
+ 'partner' => '', // 商户号
+ 'key' => '', // 商户key
'sign_type' => strtoupper('MD5'),
'input_charset' => strtolower('utf-8'),
- 'name' => '手抓饼', //商品名称,目前无意义
- 'transport' => 'https', //访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
- 'appname' => 'PolicePay', //网站英文名
- 'apiurl' => 'https://policepay.cc/', //支付网关 注意结尾的/符号
- 'min_price' => '1', //最小支付金额(请填正数)
+ 'name' => '手抓饼', // 商品名称,目前无意义
+ 'transport' => 'https', // 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
+ 'appname' => 'PolicePay', // 网站英文名
+ 'apiurl' => 'https://policepay.cc/', // 支付网关 注意结尾的/符号
+ 'min_price' => '1', // 最小支付金额(请填正数)
],
// 当面付
'facepay' => [
- 'alipay_app_id' => '', //商户号
+ 'alipay_app_id' => '', // 商户号
'merchant_private_key' => '',
'alipay_public_key' => '',
],
@@ -156,9 +156,9 @@ return [
// 商城配置
'shop_plan' => [
- '标准会员' => [1, 2, 3, 4], //对应商店显示的名称 + [商品ID]
- '高级会员' => [1, 2, 3, 4], //对应商店显示的名称 + [商品ID]
- '至尊会员' => [1, 2, 3, 4], //对应商店显示的名称 + [商品ID]
+ '标准会员' => [1, 2, 3, 4], // 对应商店显示的名称 + [商品ID]
+ '高级会员' => [1, 2, 3, 4], // 对应商店显示的名称 + [商品ID]
+ '至尊会员' => [1, 2, 3, 4], // 对应商店显示的名称 + [商品ID]
],
// 购买配置
diff --git a/routes/admin.php b/routes/admin.php
index 1ddf06dd..e26f75d6 100644
--- a/routes/admin.php
+++ b/routes/admin.php
@@ -144,7 +144,7 @@ Route::prefix('admin')->name('admin.')->group(function () {
Route::get('system', 'index')->name('system.index'); // 系统设置
Route::post('setExtend', 'setExtend')->name('system.extend'); // 设置logo图片文件
Route::post('setConfig', 'setConfig')->name('system.update'); // 设置某个配置项
- Route::post('sendTestNotification', 'sendTestNotification')->name('test.notify'); //推送通知测试
+ Route::post('sendTestNotification', 'sendTestNotification')->name('test.notify'); // 推送通知测试
Route::get('config', 'common')->name('config.index'); // 系统通用配置
});
Route::get('epayInfo', [EPay::class, 'queryInfo'])->name('test.epay'); // 易支付信息
diff --git a/routes/api.php b/routes/api.php
index 01bf5bc0..c69a0be8 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -57,7 +57,7 @@ Route::prefix('v1')->group(function () { // 客户端API
Route::controller(AuthController::class)->group(function () {
Route::post('login', 'login'); // 登录
Route::post('register', 'register'); // 注册
- Route::get('logout', 'logout'); //登出
+ Route::get('logout', 'logout'); // 登出
});
Route::controller(ClientController::class)->group(function () {
Route::get('getconfig', 'getConfig'); // 获取配置文件