瀏覽代碼

order compare

zz 6 年之前
父節點
當前提交
cec6d539d0
共有 1 個文件被更改,包括 35 次插入10 次删除
  1. 35 10
      app/Http/Controllers/Wap/Order/OrdersController.php

+ 35 - 10
app/Http/Controllers/Wap/Order/OrdersController.php

@@ -233,6 +233,11 @@ class OrdersController extends BaseController
         if( ($compare_id = $this->templateCompare()) ){
             $template_id = $compare_id;
         }
+
+        if( ($comparev2_id = $this->templateCompareV2()) ){
+            $template_id = $comparev2_id;
+        }
+
         \Log::info('recordFirstIntoPayPage:$template_id:' . $template_id);
         $res = ProductService::getChargeProduct($template_id);
         if (!$res) {
@@ -627,12 +632,37 @@ class OrdersController extends BaseController
     }
 
     private function templateCompare(){
+        //if(!in_array($this->distribution_channel_id,[2,14,211,155,4427,4488,256,691,146,255,722,4364,5,202,318,4237,266,196,273,4236,148,8,4241,160,271,4053,123,4334,4487,4593,695,4025,4426,4174])){
+        if(!in_array($this->distribution_channel_id,[2,14,123,211,5,8,160,4236,4237,4241])){
+            return 0;
+        }
+
+        $user = DataAnalysisSelectUserService::getByUidAndType($this->uid,'TEMPLATE_COMPARE');
+        if(!$user){
+            return 0;
+        }
+
+        $template_id = $user->attach;
+
+        if($template_id && $template_id == 3 && !OrderService::isPaidUser($this->uid)){
+            $template_id = 2;
+        }
+
+        if($template_id == 3){
+            $template_id = 5;
+        }
+
+        return $template_id;
+    }
+
+
+    private function templateCompareV2(){
         $start_time = env('TEMPLATE_COMPARE_START_TIME',0);
         if(!$start_time){
             return 0;
         }
-        //if(!in_array($this->distribution_channel_id,[2,14,211,155,4427,4488,256,691,146,255,722,4364,5,202,318,4237,266,196,273,4236,148,8,4241,160,271,4053,123,4334,4487,4593,695,4025,4426,4174])){
-        if(!in_array($this->distribution_channel_id,[2,14,123,211,5,8,160,4236,4237,4241])){
+
+        if(!in_array($this->distribution_channel_id,[2,14,146 ,155 ,255 ,256 ,691 ,722 ,4364 ,695 ,4174 ,4025 ,4593 ,4426 ,4742 ,4053 ,4334 ,4487])){
             return 0;
         }
         $user = $this->_user_info;
@@ -640,23 +670,18 @@ class OrdersController extends BaseController
             return 0;
         }
 
-        $user = DataAnalysisSelectUserService::getByUidAndType($this->uid,'TEMPLATE_COMPARE');
+        $user = DataAnalysisSelectUserService::getByUidAndType($this->uid,'TEMPLATE_COMPAREV2');
         if($user){
             $template_id = $user->attach;
         }else{
-            $template_id = random_int(2,4);
+            $template_id = $this->uid&2 == 0? 1:4;
             DataAnalysisSelectUserService::create(
                 $this->uid,
                 $this->distribution_channel_id,
-                'TEMPLATE_COMPARE',
+                'TEMPLATE_COMPAREV2',
                 -1, $template_id);
         }
 
-        //BookOrderService
-        if($template_id == 3 && !OrderService::isPaidUser($this->uid)){
-            $template_id = 2;
-        }
-
         return $template_id;
     }