diff --git a/app/Http/Controllers/Api/WebApi/BaseController.php b/app/Http/Controllers/Api/WebApi/BaseController.php index 1bf463229..efa871767 100644 --- a/app/Http/Controllers/Api/WebApi/BaseController.php +++ b/app/Http/Controllers/Api/WebApi/BaseController.php @@ -122,7 +122,6 @@ public function setUserTraffic(Request $request, $id): JsonResponse { return $this->returnData('上报用户流量日志成功', 'success', 200); } - // 获取节点的审计规则 public function getNodeRule($id): JsonResponse { $nodeRule = RuleGroupNode::whereNodeId($id)->first(); diff --git a/app/Http/Controllers/Api/WebApi/V2RayController.php b/app/Http/Controllers/Api/WebApi/V2RayController.php index d6d65d553..d798faa8c 100644 --- a/app/Http/Controllers/Api/WebApi/V2RayController.php +++ b/app/Http/Controllers/Api/WebApi/V2RayController.php @@ -33,7 +33,7 @@ public function getNodeInfo($id): JsonResponse { 'v2_host' => $node->v2_host, 'v2_path' => $node->v2_path, 'v2_tls' => $node->v2_tls? true : false, - 'v2_tls_provider' => Helpers::systemConfig()['v2ray_tls_provider']?: $node->tls_provider, + 'v2_tls_provider' => $node->tls_provider?: Helpers::systemConfig()['v2ray_tls_provider'], ]); } @@ -52,24 +52,28 @@ public function getUserList($id): JsonResponse { $data[] = $new; } - if($data){ - return $this->returnData('获取用户列表成功', 'success', 200, $data, ['updateTime' => time()]); - } - - return $this->returnData('获取用户列表失败'); + return $this->returnData('获取用户列表成功', 'success', 200, $data, ['updateTime' => time()]); } // 上报节点伪装域名证书信息 public function addCertificate(Request $request, $id): JsonResponse { + $key = $request->input('key'); + $pem = $request->input('pem'); + if($request->has(['key', 'pem'])){ $node = SsNode::find($id); - $obj = new NodeCertificate(); - $obj->domain = $node->server; - $obj->key = $request->input('key'); - $obj->pem = $request->input('pem'); - $obj->save(); + $Dv = NodeCertificate::query()->whereDomain($node->v2_host)->first(); + if($Dv){ + $ret = NodeCertificate::query()->whereId($Dv->id)->update(['key' => $key, 'pem' => $pem]); + }else{ + $ret = new NodeCertificate(); + $ret->domain = $node->server; + $ret->key = $request->input('key'); + $ret->pem = $request->input('pem'); + $ret->save(); + } - if($obj->id){ + if($ret){ return $this->returnData('上报节点伪装域名证书成功', 'success', 200); } } diff --git a/app/Http/Middleware/WebApi.php b/app/Http/Middleware/WebApi.php index 2b7a639f2..41aac1fdc 100644 --- a/app/Http/Middleware/WebApi.php +++ b/app/Http/Middleware/WebApi.php @@ -22,11 +22,11 @@ public function handle($request, Closure $next) { $key = $request->header('key'); $time = $request->header('timestamp'); - if(isset($key)){// 未提供 key + if(!isset($key)){// 未提供 key return $this->returnData('Your key is null!'); } - if(isset($id)){// 未提供 node + if(!isset($id)){// 未提供 node return $this->returnData('Your Node Id is null!'); } diff --git a/resources/views/user/payment.blade.php b/resources/views/user/payment.blade.php index 0771190ba..3f18b5536 100644 --- a/resources/views/user/payment.blade.php +++ b/resources/views/user/payment.blade.php @@ -24,7 +24,7 @@
@if($payment->qr_code && $payment->url) - 支付二维码 + 支付二维码 @else 支付二维码 @endif