finish announce api

This commit is contained in:
xiaomlove
2022-03-18 15:44:04 +08:00
parent 6665c98169
commit ab1ed60f44
13 changed files with 151 additions and 125 deletions

View File

@@ -89,6 +89,7 @@ class Peer extends NexusModel
$tmp_ip = '['.$tmp_ip.']';
}
$cacheKey = 'peers:connectable:'.$tmp_ip.'-'.$this->port.'-'.$this->agent;
$log = "cacheKey: $cacheKey";
if (!Cache::has($cacheKey)) {
$con = @fsockopen($tmp_ip, $this->port, $error_code, $error_message, 1);
if (is_resource($con)) {
@@ -98,6 +99,10 @@ class Peer extends NexusModel
$this->connectable = self::CONNECTABLE_NO;
}
Cache::put($cacheKey, $this->connectable, 600);
$log .= ", do check, connectable: " . $this->connectable;
} else {
$log .= ", don't do check";
}
do_log($log);
}
}

View File

@@ -9,6 +9,11 @@ class Snatch extends NexusModel
{
protected $table = 'snatched';
protected $fillable = [
'torrentid', 'userid', 'ip', 'port', 'uploaded', 'downloaded', 'to_go', 'seedtime', 'leechtime',
'last_action', 'startdat', 'completedat', 'finished'
];
protected $casts = [
'last_action' => 'datetime',
'startdat' => 'datetime',

View File

@@ -116,7 +116,7 @@ class User extends Authenticatable
*/
protected $fillable = [
'username', 'email', 'passhash', 'secret', 'stylesheet', 'editsecret', 'added', 'modcomment', 'enabled', 'status',
'leechwarn', 'leechwarnuntil', 'page', 'class'
'leechwarn', 'leechwarnuntil', 'page', 'class', 'uploaded', 'downloaded', 'clientselect', 'showclienterror',
];
/**