浏览代码

TEMPLATE_COMPAREV3

zz 6 年之前
父节点
当前提交
f8a09eb39c
共有 1 个文件被更改,包括 39 次插入25 次删除
  1. 39 25
      app/Http/Controllers/Wap/Order/OrdersController.php

+ 39 - 25
app/Http/Controllers/Wap/Order/OrdersController.php

@@ -208,44 +208,19 @@ class OrdersController extends BaseController
         $book_config = null;
         if ($bid) {
             $bid = Hashids::decode($bid)[0];
-            //$book = BookService::getBookById($bid);
             $book_config = BookConfigService::getBookById($bid);
         }
         if ($template_id == 2) { //模板2只有在长篇小说过来的用户才显示
             //部分渠道需要2元模板不管哪个入口进来都展示
             $exclude_channels = explode(',', env('PRICE_TWO_SHOW_ALL_CHANNEL'));
-
             if(!in_array($this->distribution_channel_id,$exclude_channels))
             {
                 if($book_config){
                     if($book_config->charge_type == 'BOOK') $template_id = 1;
-                }else{
-                    //$template_id = 1;
                 }
-                /*if ($bid) {
-                    $bid = Hashids::decode($bid)[0];
-                    \Log::info('order:$bid:' . $bid);
-                    $book = BookService::getBookById($bid);
-                    \Log::info('order:$$book:' . json_encode($book));
-                    if ($book->size < 200000) {
-                        $template_id = 1;
-                    }
-                } else {
-                    $template_id = 1;
-                }*/
             }
         }
-        /*if($temp){
-            $temp_bid = 0;
-            try{
-                $temp_bid =  Hashids::decode($temp)[0];
-            }catch (\Exception $e){}
 
-            $t = $this->recordFirstIntoPayPage($temp_bid);
-            if ($t) {
-                $template_id = $t;
-            }
-        }*/
 
         //男频站点 支付模板
         if (($male_site_template = $this->maleSite($this->distribution_channel_id))) {
@@ -253,6 +228,11 @@ class OrdersController extends BaseController
             $template_id = $male_site_template;
         }
 
+        if($book_config && $book_config->charge_type == 'BOOK'){
+            if( ($compare_id = $this->templateCompareV3()) ){
+                $template_id = $compare_id;
+            }
+        }
         /*if( ($compare_id = $this->templateCompare()) ){
             $template_id = $compare_id;
         }*/
@@ -736,6 +716,40 @@ class OrdersController extends BaseController
         return $template_id;
     }
 
+    //进入4593的心注册用户,若当前阅读的是短篇书籍,则根据注册id的奇偶分别进入AB两个充值模板。
+    //测试3天(测试时长看数据分析组建议)后,分别统计两个模板下的用户数、付费用户数和充值总额.
+    private function templateCompareV3()
+    {
+        $start_time = redisEnv('TEMPLATE_COMPARE_START_TIME', 0);
+        if (!$start_time) {
+            return 0;
+        }
+
+        $template_compare_sites = redisEnv('TEMPLATE_COMPARE_SITES',0);
+
+        if (!in_array($this->distribution_channel_id, explode(',',$template_compare_sites))) {
+            return 0;
+        }
+        $user = $this->_user_info;
+        if (strtotime($user->created_at) < $start_time) {
+            return 0;
+        }
+
+        $user = DataAnalysisSelectUserService::getByUidAndType($this->uid, 'TEMPLATE_COMPAREV3');
+        if ($user) {
+            $template_id = $user->attach;
+        } else {
+            $template_id = $this->uid % 2 == 0 ? 1 : 9;
+            DataAnalysisSelectUserService::create(
+                $this->uid,
+                $this->distribution_channel_id,
+                'TEMPLATE_COMPAREV3',
+                -1, $template_id);
+        }
+
+        return $template_id;
+    }
+
     private function maleSite($distribution_channel_id)
     {
         $info = ChannelService::getChannelCompanyInfo($distribution_channel_id);