zz vor 6 Jahren
Ursprung
Commit
a52e15b15e

+ 9 - 1
app/Modules/Statistic/Models/AdVisitStat.php

@@ -19,6 +19,14 @@ use Illuminate\Database\Eloquent\Model;
  */
 class AdVisitStat extends Model
 {
-    protected $table = 'ad_visit_stats1';
+    //protected $table = 'ad_visit_stats';
     protected $fillable = ['bid','uid','cid','type'];
+
+    public function setCurrentTable($time=''){
+        if($time){
+            $this->setTable('ad_visit_stats');
+        }else{
+            $this->setTable('ad_visit_stats'.$time);
+        }
+    }
 }

+ 31 - 3
app/Modules/Statistic/Services/AdVisitStatService.php

@@ -13,22 +13,50 @@ use App\Modules\Statistic\Models\AdVisitStat;
 class AdVisitStatService
 {
     public static function create($uid,$bid,$cid,$type){
+        $model = new  AdVisitStat();
+        $time = date('Ym');
+        if($time == '201905'){
+            $model->setCurrentTable();
+        }else{
+            $model->setCurrentTable($time);
+        }
         try{
-            AdVisitStat::create(compact('uid','bid','cid','type'));
+            $model->create(compact('uid','bid','cid','type'));
         }catch (\Exception $e){
 
         }
     }
 
     public static function getInfo($uid,$cid,$type){
+        $model = new  AdVisitStat();
+        $time = date('Ym');
+        if($time == '201905'){
+            $model->setCurrentTable();
+        }else{
+            $model->setCurrentTable($time);
+        }
         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();
+        $model = new  AdVisitStat();
+        $time = date('Ym');
+        if($time == '201905'){
+            $model->setCurrentTable();
+        }else{
+            $model->setCurrentTable($time);
+        }
+        return $model->where('uid',$uid)->where('cid',$cid)->whereIn('type',$type)->first();
     }
 
     public static function getByUid($uid){
-        return AdVisitStat::where('uid',$uid)->select('id','type')->where('id','<=',12723415)->first();
+        $model = new  AdVisitStat();
+        $time = date('Ym');
+        if($time == '201905'){
+            $model->setCurrentTable();
+        }else{
+            $model->setCurrentTable($time);
+        }
+        return $model->where('uid',$uid)->select('id','type')->where('id','<=',12723415)->first();
     }
 }

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

@@ -9,7 +9,7 @@
     <script>window.VueRouter || document.write('<script src="https://cdn-novel.iycdm.com/static/vue-router.min.js"><\/script>')</script>
     <script>(window.Vue && window.VueLazyload) || document.write('<script src="https://cdn-novel.iycdm.com/static/vue-lazyload.js"><\/script>')</script>
     <title>{{$title}}</title>
-    <link href=https://cdn-novel.iycdm.com/static2019-5-8/css/app.6b6abd7c89d20821f2243eaa9ad4ba2d.css rel=stylesheet>
+    <link href=https://cdn-novel.iycdm.com/static2019-5-13/css/app.21bfabb23f87c0fd8cc8fd1453356815.css rel=stylesheet>
 </head>
 <body>
 <div id=app></div>
@@ -32,8 +32,8 @@
     })();</script>
 <script id=options>window.options = {!! $options!!};</script>
 <script type=text/javascript
-        src=https://cdn-novel.iycdm.com/static2019-5-8/js/manifest.0d7bf8f8d5f3da824718.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-5-8/js/vendor.171a7cafc999efe6724c.js></script>
-<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-5-8/js/app.70a8d49eb429c9f6f58c.js></script>
+        src=https://cdn-novel.iycdm.com/static2019-5-13/js/manifest.74d48efe908788641de5.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-5-13/js/vendor.171a7cafc999efe6724c.js></script>
+<script type=text/javascript src=https://cdn-novel.iycdm.com/static2019-5-13/js/app.e3dbbca3f7726e84fb5e.js></script>
 </body>
 </html>