From 4896e086357a5ac1ed9b668c453bf5308ef7c9ec Mon Sep 17 00:00:00 2001
From: IYUU <efnic@qq.com>
Date: Thu, 30 Jan 2020 13:22:18 +0800
Subject: [PATCH] =?UTF-8?q?CCFBits=E8=BE=85=E7=A7=8D=E6=97=B6=E6=99=BA?=
 =?UTF-8?q?=E8=83=BD=E5=90=AF=E7=94=A8=E8=AF=84=E8=AE=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 app/AutoReseed.php       | 38 +++++++++++++++++++++++++++++++++++++-
 config/config.sample.php |  2 +-
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/app/AutoReseed.php b/app/AutoReseed.php
index 430fc4b..fc232c5 100644
--- a/app/AutoReseed.php
+++ b/app/AutoReseed.php
@@ -46,7 +46,7 @@ class AutoReseed
      * cookie检查
      * @var array
      */
-    public static $cookieCheck = ['hdchina','hdcity'];
+    public static $cookieCheck = ['hdchina','hdcity','ccfbits'];
     /**
      * 缓存路径
      * @var string
@@ -567,6 +567,39 @@ class AutoReseed
                                 // 城市下载种子时会302转向
                                 $url = download($url, $cookie, $userAgent);
                                 break;
+                            case 'ccfbits':
+                                $_url = 'http://' .$sites[$sitesID]['base_url']. '/' .$download_page;
+                                $cookie = isset($configALL[$siteName]['cookie']) ? $configALL[$siteName]['cookie'] : '';
+                                $userAgent = $configALL['default']['userAgent'];
+                                print "种子:".$_url. "\n";
+                                // 评论url
+                                $commentUrl = 'http://' .$sites[$sitesID]['base_url']. '/comment.php?action=add';
+                                // 评论数据
+                                $data = ['谢谢','谢谢分享','感谢发布者','谢谢分享!','谢谢分享。','感谢分享','感谢分享!','感谢分享。','感谢','谢谢发布者'];
+                                $conut = count($data)-1;
+                                $commentData = [
+                                    'body' => $data[mt_rand(0, $conut)],
+                                    'tid'  => $value['torrent_id'],
+                                ];
+                                if (isset($configALL[$siteName]['comment'])) {
+                                    // 自动评论
+                                    self::$curl->post($commentUrl, $commentData);
+                                    sleep(mt_rand(2, 3));
+                                    $url = download($_url, $cookie, $userAgent);
+                                }else {
+                                    $url = download($_url, $cookie, $userAgent);
+                                    // 检查是否需要自动评论
+                                    if (strpos($url, '必须填写种子评论后才能下载该种子') != false) {
+                                        echo "当前站点您的等级太低,已启用自动评论下载种子功能 \n";
+                                        ff($siteName. '站点,辅种时已启用自动评论');
+                                        $configALL[$siteName]['comment'] = 1;
+                                        //自动评论
+                                        self::$curl->post($commentUrl, $commentData);
+                                        sleep(mt_rand(2, 3));
+                                        $url = download($_url, $cookie, $userAgent);
+                                    }
+                                }
+                                break;
                             default:
                                 // 默认站点:推送给下载器种子URL链接
                                 break;
@@ -895,6 +928,9 @@ class AutoReseed
                 }
                 $url = $_url."&passkey=". $configALL[$site]['passkey'] . $ip_type. "&https=1";
                 break;
+            case 'ccfbits':
+                $url = $_url;
+                break;
             default:
                 $url = $_url."&passkey=". $configALL[$site]['passkey'];
                 break;
diff --git a/config/config.sample.php b/config/config.sample.php
index 3bfc826..9f7d234 100644
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -373,7 +373,7 @@ return array(
         // 如果需要自动辅种,必须配置
         'passkey'       => '',
     ),
-    // upxin 序号:37
+    // hdu 序号:37
     'upxin'      => array(
         // 如果需要用下载免费种脚本,须配置(只是自动辅种,可以不配置此项)
         'cookie'        => '',