mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
clean peers + snatched table unique
This commit is contained in:
@@ -95,8 +95,10 @@ class Test extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$logFile = format_description('[img=http://www.baidu.com][img]http://www.baidu.com[/img]');
|
||||
dd($logFile);
|
||||
$r = log(10);
|
||||
$r2 = exp(10);
|
||||
|
||||
dd($r, $r2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -706,7 +706,8 @@ HTML;
|
||||
public function removeDuplicateSnatch()
|
||||
{
|
||||
$size = 2000;
|
||||
$stickyPromotionExists = NexusDB::hasTable('');
|
||||
$stickyPromotionParticipatorsTable = 'sticky_promotion_participators';
|
||||
$stickyPromotionExists = NexusDB::hasTable($stickyPromotionParticipatorsTable);
|
||||
while (true) {
|
||||
$snatchRes = NexusDB::select("select userid, torrentid, group_concat(id) as ids from snatched group by userid, torrentid having(count(*)) > 1 limit $size");
|
||||
if (empty($snatchRes)) {
|
||||
@@ -723,6 +724,10 @@ HTML;
|
||||
do_log("[DELETE_DUPLICATED_SNATCH], torrent: $torrentId, user: $userId, snatchIdStr: $delIdStr");
|
||||
NexusDB::statement("delete from snatched where id in ($delIdStr)");
|
||||
NexusDB::statement("update claims set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
|
||||
NexusDB::statement("update hit_and_runs set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
|
||||
if ($stickyPromotionExists) {
|
||||
NexusDB::statement("update $stickyPromotionParticipatorsTable set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user