Ver Fonte

Merge branch 'stabble' of iqiyoo:zhuishuyun_wap

onlinetest há 6 anos atrás
pai
commit
1e1ab92f3d

+ 96 - 1
app/Console/Commands/BookTest.php

@@ -3,6 +3,8 @@
 namespace App\Console\Commands;
 
 use App\Modules\Book\Services\BookSubscribleChapterService;
+use App\Modules\Subscribe\Services\ChapterOrderService;
+use App\Modules\YunQi\Models\BookUser;
 use GuzzleHttp\Client;
 use Illuminate\Console\Command;
 
@@ -18,6 +20,7 @@ use App\Jobs\SendStatisticsList;
 use App\Modules\OfficialAccount\Models\ForceSubscribeUsers;
 use App\Modules\User\Services\UserSignService;
 use App\Modules\Book\Models\BookUvStat;
+use App\Modules\Subscribe\Models\ChapterOrder;
 
 class BookTest extends Command
 {
@@ -59,7 +62,8 @@ class BookTest extends Command
         //$this->testTest();
         //$this->activity();
         //$this->testBookSmartPushStats();
-        $this->sendOrderStats105();
+        //$this->sendOrderStats105();
+        $this->you2();
     }
 
 
@@ -311,4 +315,95 @@ class BookTest extends Command
             }
         }
     }
+
+    private function you2(){
+        $result = [];
+        $info = BookUser::where('bid','>',0)->select('bid','uid','type','updated_at')->get();
+        $info2 = BookUser::where('type','GROUP_1')->select('bid','uid','type','updated_at')->get();
+        foreach ($info as $item){
+            $bid_price = Order::where('uid',$item->uid)
+                ->where('status','PAID')
+                ->where('created_at','>=',$item->updated_at)
+                ->where('from_bid',$item->bid)
+                ->sum('price');
+            $all_price = Order::where('uid',$item->uid)
+                ->where('status','PAID')
+                ->where('created_at','>=',$item->updated_at)
+                ->sum('price');
+            $chapter_model = new ChapterOrder();
+            $chapter_model->setCurrentTable($item->uid);
+            $chapter_fee = $chapter_model->where('uid', $item->uid)
+                ->where('bid', $item->bid)
+                ->where('created_at','>=',$item->updated_at)
+                ->sum('fee');
+            $all_fee = $chapter_model->where('uid', $item->uid)
+                ->where('created_at','>=',$item->updated_at)
+                ->sum('fee');
+            $result[] = [
+                'uid'=>$item->uid,
+                'type'=>$item->type,
+                'amount'=>$bid_price?$bid_price:0,
+                'fee'=>$chapter_fee?$chapter_fee:0,
+                'bid'=>$item->bid,
+                'all_price'=>$all_price?$all_price:0,
+                'all_fee'=>$all_fee?$all_fee:0
+            ];
+        }
+        $item = null;
+        foreach ($info2 as $item){
+            $all_price = Order::where('uid',$item->uid)
+                ->where('status','PAID')
+                ->where('created_at','>=',$item->updated_at)
+                ->sum('price');
+            $chapter_model = new ChapterOrder();
+            $chapter_model->setCurrentTable($item->uid);
+            $all = $chapter_model->where('uid', $item->uid)
+                ->where('created_at','>=',$item->updated_at)
+                ->groupBy('bid')
+                ->select(DB::raw('sum(fee) as fee'),'bid','book_name')
+                ->orderBy('fee','desc')
+                ->first();
+            $all_fee = 0;
+            $bid = 0;
+            $book_name = '';
+            if($all){
+                $all_fee = $all->fee;
+                $bid = $all->bid;
+                $book_name = $all->book_name;
+            }
+            $result[] = [
+                'uid'=>$item->uid,
+                'type'=>$item->type,
+                'amount'=>0,
+                'fee'=>0,
+                'bid'=>$bid,
+                'all_price'=>$all_price?$all_price:0,
+                'all_fee'=>$all_fee?$all_fee:0,
+                'book_name'=>$book_name
+            ];
+        }
+
+        $str = "图书id,书名,用户类型,用户id,本书订阅书币,本书充值,总充值,总订阅\r\n";
+        $str = mb_convert_encoding($str, 'gbk');
+        $file_name = date('Y-m-d') . '-you2.csv';
+        file_put_contents($file_name, $str);
+        $temp = '';
+        foreach ($result as $val) {
+            $books = DB::table('book_configs')->where('bid',$val['bid'])->select('book_name')->first();
+            if($books){
+                $book_name = $books->book_name;
+            }else{
+                $book_name = 'un';
+            }
+            if($val['type'] == 'GROUP_1'){
+                $type = 'GROUP_1';
+            }else{
+                $type = 'GROUP_2';
+            }
+            $t = "{$val['bid']},{$book_name},{$type},{$val['uid']},{$val['fee']},{$val['amount']},{$val['all_price']},{$val['all_fee']}\r\n";
+            $temp .=  mb_convert_encoding($t, 'gbk');
+        }
+        file_put_contents($file_name, $temp, FILE_APPEND);
+    }
+
 }

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

@@ -1540,6 +1540,10 @@ class ChapterController extends BaseController
     }
     //阅读页面底部是否显示广告
     private function isShowAd(){
+        $ad_status = env('AD_STATUS',1);
+        if(!$ad_status){
+            return ;
+        }
         if(!in_array($this->distribution_channel_id,[2,14,123,211])){
             return ;
         }

+ 6 - 1
app/Http/Controllers/Wap/Web/WelcomeController.php

@@ -85,7 +85,11 @@ class WelcomeController extends BaseController
         //最近阅读页面 推荐
         $latest_read_rec_books = $this->latest_read_rec_books($channel,$user->sex);
         //广告样本
-        $adTargetId = $this->isUserInAdSample();
+        $ad_status = env('AD_STATUS',1);
+        $adTargetId = false;
+        if($ad_status){
+            $adTargetId = $this->isUserInAdSample();
+        }
         //广告frame
         $is_show_ad_frame_setting = env('IS_SHOW_AD_FRAME_SETTING','123');
         $is_show_ad_frame = false;
@@ -100,6 +104,7 @@ class WelcomeController extends BaseController
         }
         $hide_chapter_channels = explode(',',env('HIDE_CHAPTER_CONSUME_CHANNEL'));
         $is_hide_chapter_consume = in_array($this->distribution_channel_id,$hide_chapter_channels) ? 1 : 0;
+        //广告
 
         $options = json_encode([
             'distribution_channel_id' => (int)$this->distribution_channel_id,

+ 4 - 4
resources/views/wap/index.blade.php

@@ -9,7 +9,7 @@
     <script src="https://cdn-novel.iycdm.com/static/vue-router.min.js"></script>
     <script src="https://cdn-novel.iycdm.com/static/vue-lazyload.js"></script>
     <title>{{$title}}</title>
-    <link href=https://cdn-novel.iycdm.com/static2019-1-16/css/app.2dcb3043cdf0a205ead701311193fa38.css rel=stylesheet>
+    <link href=https://cdn-novel.iycdm.com/static2019-1-16/css/app.3185b8df87f6948b899d98119717d51a.css rel=stylesheet>
 </head>
 <body>
 <div id=app></div>
@@ -32,9 +32,9 @@
     })();</script>
 <script>window.options = {!! $options!!};</script>
 <script type=text/javascript
-        src=https://cdn-novel.iycdm.com/static2019-1-16/js/manifest.31c48739180ad2b75fb7.js></script>
+        src=https://cdn-novel.iycdm.com/static2019-1-16/js/manifest.67403c54077df8ed9ebd.js></script>
 <script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-1-16/js/vendor.ef6f589527f41af98f5c.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-1-16/js/app.c02c5149100cedd35e58.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-1-16/js/app.ff11bbd631aa0f266585.js></script>
 </body>
-<script src=//cdn.ipadview.com/jssdk/combo.bundle.js></script>
+<script src=//cdn.ipadview.com/jssdk/combo.bundle.js?v=1.20></script>
 </html>