Sfoglia il codice sorgente

Merge branch 'zhucj' of iqiyoo:zhuishuyun_wap into zhucj

zhuchengjie 2 anni fa
parent
commit
6542a30c8c

+ 3 - 0
app/Http/Controllers/QuickApp/Activity/ActivityController.php

@@ -573,4 +573,7 @@ class ActivityController extends BaseController
         return view('pay.activity.pageSpreadAvtivity', $result_data);
     }
 
+    public function  channelCustomActivityRecom(){
+        
+    }
 }

+ 27 - 5
app/Http/Controllers/QuickApp/Book/BookController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers\QuickApp\Book;
 
 use App\Consts\BaseConst;
 use App\Libs\Utils;
+use App\Modules\Activity\Services\ActivityService;
 use App\Modules\Book\Models\RecoBanner;
 use App\Modules\Book\Services\BookAuditService;
 use App\Modules\Channel\Models\ChannelAdvert;
@@ -606,7 +607,7 @@ class BookController extends BaseController
 
         if($release_type == '4' || $release_type == '5'){
             //弹窗和充值页返回需要先判断频率跟权限
-            $advert = ChannelAdvert::select('id','photo as banner_url','type','content','person','frequency')
+            $advert = ChannelAdvert::select('id','photo as banner_url','activity_id','type','content','person','frequency')
                 ->where('distribution_id',$distribution_id)
                 ->where('release_type',$release_type)
                 ->where('status',1)
@@ -662,8 +663,16 @@ class BookController extends BaseController
                 if(!$check_user){
                     return response()->success([]);
                 }
-                $advert = self::getBackFormat($advert);
-                return response()->success($advert);
+
+                $activity = ActivityService::getById($advert['activity_id'] ?? 0);
+                if ($activity){
+                    $advert['redirect_url'] = "/views/Activity";
+                    $advert = self::getBackFormat($advert);
+                    $advert['param'] = ['token' => $activity['token']];
+                    return response()->success($advert);
+                }else{
+                    return response()->success([]);
+                }
             }
 
         }
@@ -678,12 +687,24 @@ class BookController extends BaseController
         $banner->transform(function ($item) {
             $item->ids = Hashids::encode($item->id);
             if($item->type == 1){
-                $item->redirect_url = 'views/Reader';
                 $content = explode(';',$item->content);
                 $item->bid = isset($content[2]) ? $content[2] : '';
                 $item->cid = isset($content[3]) ? $content[3] : '';
+                if ($item->cid){
+                    $item->redirect_url = "views/Reader";
+                }else{
+                    $item->redirect_url = "views/Detail";
+                }
+                $item->redirect_type = "book";
             }else{
-                $item->redirect_url = 'views/Detail';
+                $activity = ActivityService::getById($item->activity_id);
+                $item->redirect_url = "/views/Activity";
+                $item->redirect_type = "activity";
+                if($activity && !empty($activity['token'])){
+                    $item['param'] = ['token' => $activity['token']];
+                }else{
+                    $item->redirect_url = "#";
+                }
             }
             self::getBackFormat($item);
             return $item;
@@ -719,6 +740,7 @@ class BookController extends BaseController
             } else {
                 $item->redirect_url = "views/Detail";
             }
+            $item->redirect_type = "book";
             unset($item->id);
             return $item;
         });

+ 7 - 5
app/Http/Controllers/QuickApp/User/UserController.php

@@ -116,11 +116,13 @@ class UserController extends BaseController
             $send_order_id = !empty($this->send_order_id) ? $this->send_order_id :  !empty($user->send_order_id) ? $user->send_order_id : 0;
             if($send_order_id){
                 $send_order = SendOrder::find($send_order_id);
-                $book = Book::leftjoin('book_categories','book_categories.id','books.category_id')
-                    ->where('books.id',$send_order->book_id)
-                    ->select('book_categories.pid')
-                    ->first();
-                $data['book_sex'] = (isset($book->pid) && $book->pid == 2) ? 0 : 1;
+                if ($send_order){
+                    $book = Book::leftjoin('book_categories','book_categories.id','books.category_id')
+                        ->where('books.id',$send_order->book_id)
+                        ->select('book_categories.pid')
+                        ->first();
+                    $data['book_sex'] = (isset($book->pid) && $book->pid == 2) ? 0 : 1;
+                }
             }
         }
         // $data['is_check'] = !$this->phone;

+ 3 - 0
app/Http/Routes/QuickApp/QuickAppRoutes.php

@@ -152,6 +152,9 @@ Route::group(['domain' => env('QUICKAPP_DOMAIN'), 'namespace' => 'App\Http\Contr
 
         // 腾讯广告新版,非点击广告访问链接的用户将看到配置的非广告书籍
         Route::get('txAdqNew/noAdvBookInfo', 'SendOrder\TxAdqNewNoAdvBookController@getNoAdvBookInfo');
+
+        //推荐活动
+        Route::get('recon_activity', 'Activity\ActivityController@channelCustomActivityRecom');
     });
 
 

+ 1 - 1
app/Modules/Channel/Services/ChannelAdvertService.php

@@ -18,7 +18,7 @@ class ChannelAdvertService
         return ChannelAdvert::where('status',1)
             ->where('distribution_id',$distribution_id)
             ->where('release_type',$release_type)
-            ->select('id','photo as banner_url','type','content')
+            ->select('id','photo as banner_url','activity_id','type','content')
             ->get();
     }
 }