Browse Source

解决编辑权限问题 & 订阅获取节点错误的问题

兔姬桑 4 years ago
parent
commit
d0886da6da

+ 4 - 0
app/Components/NetworkDetection.php

@@ -100,6 +100,10 @@ class NetworkDetection
             }
 
             if (! $message['success']) {
+                if ($message['error'] && $message['error'] === 'execute timeout (3s)') {
+                    return false;
+                }
+
                 Log::warning('【'.$checkName.'阻断检测】检测'.$ip.$port.'时,返回'.var_export($message, true));
 
                 return false;

+ 1 - 1
app/Http/Controllers/User/SubscribeController.php

@@ -77,7 +77,7 @@ class SubscribeController extends Controller
         $this->subscribeLog($subscribe->id, IP::getClientIp(), $request->headers);
 
         // 获取这个账号可用节点
-        $query = $user->whereIsSubscribe(1)->nodes();
+        $query = $user->nodes()->whereIsSubscribe(1);
 
         if ($this->subType === 1) {
             $query = $query->whereIn('type', [1, 4]);

+ 1 - 1
app/Models/Article.php

@@ -14,7 +14,7 @@ class Article extends Model
 
     protected $table = 'article';
     protected $dates = ['deleted_at'];
-    protected $guarded = ['id', 'created_at'];
+    protected $guarded = [];
 
     // 筛选类型
     public function scopeType($query, $type)

+ 1 - 1
app/Models/Config.php

@@ -14,5 +14,5 @@ class Config extends Model
     protected $table = 'config';
     protected $primaryKey = 'name';
     protected $keyType = 'string';
-    protected $fillable = ['value'];
+    protected $guarded = [];
 }

+ 1 - 1
app/Models/Country.php

@@ -14,5 +14,5 @@ class Country extends Model
     protected $table = 'country';
     protected $primaryKey = 'code';
     protected $keyType = 'string';
-    protected $fillable = ['*'];
+    protected $guarded = [];
 }

+ 1 - 1
app/Models/EmailFilter.php

@@ -11,5 +11,5 @@ class EmailFilter extends Model
 {
     public $timestamps = false;
     protected $table = 'email_filter';
-    protected $guarded = ['id'];
+    protected $guarded = [];
 }

+ 1 - 1
app/Models/Goods.php

@@ -14,7 +14,7 @@ class Goods extends Model
 
     protected $table = 'goods';
     protected $dates = ['deleted_at'];
-    protected $guarded = ['id'];
+    protected $guarded = [];
 
     public function scopeType($query, $type)
     {

+ 1 - 1
app/Models/Invite.php

@@ -16,7 +16,7 @@ class Invite extends Model
 
     protected $table = 'invite';
     protected $dates = ['dateline', 'deleted_at'];
-    protected $fillable = ['invitee_id', 'status'];
+    protected $guarded = [];
 
     public function scopeUid($query)
     {

+ 1 - 1
app/Models/Label.php

@@ -12,7 +12,7 @@ class Label extends Model
 {
     public $timestamps = false;
     protected $table = 'label';
-    protected $guarded = ['id'];
+    protected $guarded = [];
 
     public function nodes()
     {

+ 1 - 1
app/Models/Level.php

@@ -11,5 +11,5 @@ class Level extends Model
 {
     public $timestamps = false;
     protected $table = 'level';
-    protected $guarded = ['id'];
+    protected $guarded = [];
 }

+ 1 - 1
app/Models/NodeAuth.php

@@ -11,7 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
 class NodeAuth extends Model
 {
     protected $table = 'node_auth';
-    protected $fillable = ['key', 'secret'];
+    protected $guarded = [];
 
     public function node(): BelongsTo
     {

+ 1 - 1
app/Models/NodeCertificate.php

@@ -10,5 +10,5 @@ use Illuminate\Database\Eloquent\Model;
 class NodeCertificate extends Model
 {
     protected $table = 'node_certificate';
-    protected $fillable = ['domain', 'key', 'pem'];
+    protected $guarded = [];
 }

+ 1 - 1
app/Models/Payment.php

@@ -12,7 +12,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
 class Payment extends Model
 {
     protected $table = 'payment';
-    protected $fillable = ['qr_code', 'url', 'status'];
+    protected $guarded = [];
 
     public function scopeUid($query)
     {

+ 1 - 1
app/Models/Rule.php

@@ -11,7 +11,7 @@ class Rule extends Model
 {
     public $timestamps = false;
     protected $table = 'rule';
-    protected $guarded = ['id'];
+    protected $guarded = [];
 
     public function getTypeLabelAttribute(): string
     {

+ 1 - 1
app/Models/SsConfig.php

@@ -11,7 +11,7 @@ class SsConfig extends Model
 {
     public $timestamps = false;
     protected $table = 'ss_config';
-    protected $guarded = ['id'];
+    protected $guarded = [];
 
     // 筛选默认
 

+ 1 - 0
app/Models/Ticket.php

@@ -13,6 +13,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
 class Ticket extends Model
 {
     protected $table = 'ticket';
+    protected $guarded = [];
 
     public function scopeUid($query)
     {

+ 1 - 0
app/Models/TicketReply.php

@@ -11,6 +11,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
 class TicketReply extends Model
 {
     protected $table = 'ticket_reply';
+    protected $guarded = [];
 
     public function ticket(): BelongsTo
     {