|
@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Wap\Order;
|
|
|
|
|
|
use App\Http\Controllers\Wap\BaseController;
|
|
|
use App\Modules\Statistic\Services\AdVisitStatService;
|
|
|
+use App\Modules\Statistic\Services\DataAnalysisSelectUserService;
|
|
|
use App\Modules\User\Services\UserService;
|
|
|
use App\Modules\Book\Services\BookService;
|
|
|
use App\Modules\Channel\Services\PayTemplateService;
|
|
@@ -221,6 +222,9 @@ class OrdersController extends BaseController
|
|
|
$template_id = $t;
|
|
|
}
|
|
|
}
|
|
|
+ if( ($compare_id = $this->templateCompare()) ){
|
|
|
+ $template_id = $compare_id;
|
|
|
+ }
|
|
|
\Log::info('recordFirstIntoPayPage:$template_id:' . $template_id);
|
|
|
$res = ProductService::getChargeProduct($template_id);
|
|
|
if (!$res) {
|
|
@@ -253,7 +257,7 @@ class OrdersController extends BaseController
|
|
|
continue;
|
|
|
}
|
|
|
$temp = [
|
|
|
- 'price' => (int)$v->price . '元',
|
|
|
+ 'price' => (float)$v->price . '元',
|
|
|
'is_year_order' => 0,
|
|
|
'text' => sprintf('%s+%s书币', $v->price * 100, $v->given),
|
|
|
'first_charge' => true,
|
|
@@ -291,7 +295,7 @@ class OrdersController extends BaseController
|
|
|
}
|
|
|
|
|
|
$temp = [
|
|
|
- 'price' => (int)$v->price . '元',
|
|
|
+ 'price' => (float)$v->price . '元',
|
|
|
'is_year_order' => 0,
|
|
|
'text' => $text,
|
|
|
'first_charge' => false,
|
|
@@ -613,4 +617,37 @@ class OrdersController extends BaseController
|
|
|
return $template_id;
|
|
|
}
|
|
|
|
|
|
+ private function templateCompare(){
|
|
|
+ $start_time = env('TEMPLATE_COMPARE_START_TIME',0);
|
|
|
+ if(!$start_time){
|
|
|
+ return 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;
|
|
|
+ }
|
|
|
+
|
|
|
}
|