|
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Wap\Order;
|
|
|
|
|
|
use App\Http\Controllers\Wap\BaseController;
|
|
use App\Http\Controllers\Wap\BaseController;
|
|
use App\Modules\Statistic\Services\AdVisitStatService;
|
|
use App\Modules\Statistic\Services\AdVisitStatService;
|
|
|
|
+use App\Modules\Statistic\Services\DataAnalysisSelectUserService;
|
|
use App\Modules\User\Services\UserService;
|
|
use App\Modules\User\Services\UserService;
|
|
use App\Modules\Book\Services\BookService;
|
|
use App\Modules\Book\Services\BookService;
|
|
use App\Modules\Channel\Services\PayTemplateService;
|
|
use App\Modules\Channel\Services\PayTemplateService;
|
|
@@ -221,6 +222,9 @@ class OrdersController extends BaseController
|
|
$template_id = $t;
|
|
$template_id = $t;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if( ($compare_id = $this->templateCompare()) ){
|
|
|
|
+ $template_id = $compare_id;
|
|
|
|
+ }
|
|
\Log::info('recordFirstIntoPayPage:$template_id:' . $template_id);
|
|
\Log::info('recordFirstIntoPayPage:$template_id:' . $template_id);
|
|
$res = ProductService::getChargeProduct($template_id);
|
|
$res = ProductService::getChargeProduct($template_id);
|
|
if (!$res) {
|
|
if (!$res) {
|
|
@@ -613,4 +617,34 @@ class OrdersController extends BaseController
|
|
return $template_id;
|
|
return $template_id;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function templateCompare(){
|
|
|
|
+ $start_time = env('TEMPLATE_COMPARE_START_TIME',0);
|
|
|
|
+ if(!in_array($this->distribution_channel_id,[2,14,211])){
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ $user = $this->_user_info;
|
|
|
|
+ if(strtotime($user->created_at) < $start_time){
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $user = DataAnalysisSelectUserService::getByUidAndType($this->uid,'TEMPLATE_COMPARE');
|
|
|
|
+ if($user){
|
|
|
|
+ $template_id = $user->attach;
|
|
|
|
+ }else{
|
|
|
|
+ $template_id = random_int(2,4);
|
|
|
|
+ DataAnalysisSelectUserService::create(
|
|
|
|
+ $this->uid,
|
|
|
|
+ $this->distribution_channel_id,
|
|
|
|
+ 'TEMPLATE_COMPARE',
|
|
|
|
+ -1, $template_id);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //BookOrderService
|
|
|
|
+ if($template_id == 3 && !OrderService::isPaidUser($this->uid)){
|
|
|
|
+ $template_id = 2;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $template_id;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|