zz 6 سال پیش
والد
کامیت
6939b9d796
2فایلهای تغییر یافته به همراه37 افزوده شده و 0 حذف شده
  1. 23 0
      app/Console/Commands/BookSpider.php
  2. 14 0
      app/Http/Controllers/Wap/Book/ChapterController.php

+ 23 - 0
app/Console/Commands/BookSpider.php

@@ -5,6 +5,7 @@ namespace App\Console\Commands;
 use Illuminate\Console\Command;
 use GuzzleHttp\Client;
 use DB;
+use Redis;
 
 class BookSpider extends Command
 {
@@ -136,4 +137,26 @@ WHERE u.openid in (SELECT openid from users WHERE  id = %s)";
         }
     }
 
+    public function cleanRedis()
+    {
+        $flag = 0;
+        $i = 0;
+        do{
+            $result = Redis::scan($flag,['match'=>'wap:string:chapter:{*','count'=>1000]);
+            if ($result) {
+                if (isset($result[0])) {
+                    $flag = $result[0];
+                }
+                if (isset($result[1]) && $result[1] ) {
+                    foreach ($result[1] as $v) {
+                        Redis::del($v);
+                        echo $v . PHP_EOL;
+                        $i++;
+                    }
+                }
+            }
+        }while($flag);
+        echo 'del ' . $i . PHP_EOL;
+        return "";
+    }
 }

+ 14 - 0
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -13,6 +13,7 @@ use App\Modules\Statistic\Services\DataAnalysisChapterService;
 use App\Modules\Statistic\Services\DataAnalysisSelectUserService;
 use App\Modules\Statistic\Services\WapVisitStatService;
 use App\Modules\Subscribe\Services\OrderService;
+use App\Modules\Subscribe\Models\Order;
 use App\Modules\User\Services\ForceSubscribeUserIService;
 use App\Modules\User\Services\ReadRecordStatsService;
 use App\Modules\User\Services\UserService;
@@ -1449,14 +1450,27 @@ class ChapterController extends BaseController
             /*if (!ReadRecordService::getRecordByUidBid($this->uid, $book_info->bid)) {
                 return true;
             }*/
+
+
             //版权到期,有包年可以继续阅读
             $year_order = YearOrderService::getRecord($this->uid);
             if($year_order){
                 return false;
             }
+            //1155
             //版权到期,有订购记录还可以继续阅读,订购
             $chapter_order = ChapterOrderService::checkBookIsOrdered($this->uid, $book_info->bid);
             if (!$chapter_order) return true;
+            if($book_info->bid == 1155){
+                $charge_info = Order::where('uid',$this->uid)
+                    ->where('price','>=',redisEnv('OFF_SHELF_BOOK_LIMIT_CHARGE',0))
+                    ->where('from_bid',$book_info->bid)
+                    ->where('status','PAID')
+                    ->first();
+                if(!$charge_info){
+                    return true;
+                }
+            }
         }
 
         if($book_info->is_on_shelf == 10){