Explorar o código

ad unlock 2 chapter

zz %!s(int64=6) %!d(string=hai) anos
pai
achega
e7c170f285

+ 12 - 2
app/Http/Controllers/Wap/Book/ChapterController.php

@@ -325,9 +325,9 @@ class ChapterController extends BaseController
         $this->cid = $cid;
         //图书域名,book_configs表的promotion_domain 要跟当前的主机名匹配
         if ($this->isVisitDomainEqualBookDomain($domain)) {
-            return response()->error('WAP_DOMAIN_NOT_MATCH', [
+            /*return response()->error('WAP_DOMAIN_NOT_MATCH', [
                 'url' => $this->getCorrespondBookUrl()
-            ]);
+            ]);*/
         }
 
         //下架图书不能看
@@ -419,6 +419,16 @@ class ChapterController extends BaseController
         //广告
         if($this->isUserInAdSample() && $ad_status && $ad_status == 1 && $user_info->balance < $fee){
             $this->getChapter();
+            //广告解锁2张
+            if($this->chapter->next_cid){
+                $next_chapter  = ChapterService::getChapterNameById($this->chapter->next_cid, $bid);
+                if($next_chapter){
+                    $next_chapter_name = $next_chapter->name;
+                    $this->bookOrderOrChapterOrder($book_info, $this->chapter->next_cid, 0, $next_chapter_name, 1);
+                    AdVisitStatService::create($this->uid,$this->book_info->bid,$this->chapter->next_cid,'UNLOCK_2');
+                }
+            }
+            $this->chapter->is_show_ad = 0;
             $this->bookOrderOrChapterOrder($book_info, $cid, 0, $chapter->name, 1);
             return response()->item(new ChapterTransformer, $this->chapter);
         }

+ 1 - 1
app/Http/Controllers/Wap/Order/OrdersController.php

@@ -490,7 +490,7 @@ class OrdersController extends BaseController
         $chapter_order = $chapter_model->getByUid($this->uid, $page_size);
         foreach ($chapter_order as $item){
             if($item->fee == 0){
-                $result = AdVisitStatService::getInfo($this->uid,$item->cid,'UNLOCK');
+                $result = AdVisitStatService::getInfoV2($this->uid,$item->cid,['UNLOCK','UNLOCK_2']);
                 if($result) $item->fee = '解锁';
             }
         }

+ 4 - 0
app/Modules/Statistic/Services/AdVisitStatService.php

@@ -23,4 +23,8 @@ class AdVisitStatService
     public static function getInfo($uid,$cid,$type){
         return AdVisitStat::where('uid',$uid)->where('cid',$cid)->where('type',$type)->first();
     }
+
+    public static function getInfoV2($uid,$cid,$type){
+        return AdVisitStat::where('uid',$uid)->where('cid',$cid)->whereIn('type',$type)->first();
+    }
 }