|
@@ -196,18 +196,11 @@ class OrdersController extends BaseController
|
|
|
if (!$this->checkUid()) {
|
|
|
return response()->error('WAP_NOT_LOGIN');
|
|
|
}
|
|
|
- /*if (env('OTHER_PAY_TEMPLATE') &&
|
|
|
- in_array($this->distribution_channel_id,
|
|
|
- explode(',', env('OTHER_PAY_TEMPLATE')))
|
|
|
- ) {
|
|
|
- $template_id = 3;
|
|
|
- } else {*/
|
|
|
+
|
|
|
$bid = $request->input('bid', '');
|
|
|
$temp = $bid;
|
|
|
$template_id = PayTemplateService::getPayTemplate($this->distribution_channel_id);
|
|
|
- //}
|
|
|
- \Log::info('order:$template_id:' . $template_id);
|
|
|
- \Log::info('order:$distribution_channel_id:' . ($this->distribution_channel_id));
|
|
|
+
|
|
|
$book_config = null;
|
|
|
if ($bid) {
|
|
|
$bid = Hashids::decode($bid)[0];
|
|
@@ -216,18 +209,15 @@ class OrdersController extends BaseController
|
|
|
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;
|
|
|
+ if (!in_array($this->distribution_channel_id, $exclude_channels)) {
|
|
|
+ if ($book_config) {
|
|
|
+ if ($book_config->charge_type == 'BOOK') $template_id = 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//男频站点 支付模板
|
|
|
if (($male_site_template = $this->maleSite($this->distribution_channel_id))) {
|
|
|
- //\Log::info('$male_site_template is: '.$male_site_template);
|
|
|
$template_id = $male_site_template;
|
|
|
}
|
|
|
|
|
@@ -248,7 +238,7 @@ class OrdersController extends BaseController
|
|
|
$template_id = 10;
|
|
|
}*/
|
|
|
$outstandingYearOrder = $this->outstandingYearOrder($this->uid);
|
|
|
- \Log::info('recordFirstIntoPayPage:$template_id:' . $template_id);
|
|
|
+
|
|
|
$res = ProductService::getChargeProduct($template_id);
|
|
|
if (!$res) {
|
|
|
return response()->error('WAP_SYS_ERROR');
|
|
@@ -267,29 +257,12 @@ class OrdersController extends BaseController
|
|
|
//$user = $this->_user_info;
|
|
|
$uid = $this->uid;
|
|
|
$is_first_recharge = OrderService::judgeUserFirstRecharge($uid);
|
|
|
- //yqLog('user')->info('user is ',['user'=>$user]);
|
|
|
- //yqLog('user')->info('user is ',['charge_count'=>$user->charge_count]);
|
|
|
+
|
|
|
$data = [];
|
|
|
$appad = 0;
|
|
|
- /* if (in_array($this->distribution_channel_id, explode(',', env('ADS_OPEN_SITE')))) {
|
|
|
- $appad = 0;
|
|
|
- $my_bid = $bid;
|
|
|
- if ($appad) {
|
|
|
- try {
|
|
|
- AdvertiseUsersService::addAdAccessRec(['uid' => $this->uid,
|
|
|
- 'bid' => $my_bid,
|
|
|
- 'position' => 'RECHARGE',
|
|
|
- 'created_at' => date('Y-m-d H:i:s'),
|
|
|
- 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
- 'remark' => $request->url()
|
|
|
- ]);
|
|
|
- } catch (\Exception $e) {
|
|
|
- \Log::error('insert into advertise_access_rec failded:' . $e->getMessage());
|
|
|
- }
|
|
|
- }
|
|
|
- }*/
|
|
|
+
|
|
|
$property = UserDivisionCpcPropertyService::getUserProperty($this->uid);
|
|
|
- //\Log::info('ad-tu:uid:'.$uid.':'.$appad);
|
|
|
+
|
|
|
foreach ($res as $v) {
|
|
|
if ($template_id == 7 && $book_config && $book_config->charge_type == 'BOOK' && $v->price == 2) {
|
|
|
continue;
|
|
@@ -307,13 +280,14 @@ class OrdersController extends BaseController
|
|
|
$temp = [
|
|
|
'price' => (float)$v->price . '元',
|
|
|
'is_year_order' => 0,
|
|
|
+ 'is_month_order' => 0,
|
|
|
'text' => sprintf('%s+%s书币', $v->price * 100, $v->given),
|
|
|
'first_charge' => true,
|
|
|
'today_special' => false,
|
|
|
'save_text' => round($v->given / 100, 1) . '元',
|
|
|
'product_id' => $v->id,
|
|
|
'show_free_ads' => $appad,
|
|
|
- 'gift'=>BookGiftsService::chargeGiveGift($property,$v->price,$v->type)
|
|
|
+ 'gift' => BookGiftsService::chargeGiveGift($property, $v->price, $v->type)
|
|
|
];
|
|
|
$data[] = $temp;
|
|
|
} elseif ($v->type == 'YEAR_ORDER') {
|
|
@@ -325,16 +299,38 @@ class OrdersController extends BaseController
|
|
|
$temp = [
|
|
|
'price' => (int)$v->price . '元',
|
|
|
'is_year_order' => 1,
|
|
|
+ 'is_month_order' => 0,
|
|
|
'text' => $text,
|
|
|
'first_charge' => false,
|
|
|
'today_special' => $outstandingYearOrder,
|
|
|
'save_text' => $save_text,
|
|
|
'product_id' => $v->id,
|
|
|
'show_free_ads' => $appad,
|
|
|
- 'gift'=>BookGiftsService::chargeGiveGift($property,$v->price,$v->type)
|
|
|
+ 'gift' => BookGiftsService::chargeGiveGift($property, $v->price, $v->type)
|
|
|
];
|
|
|
$data[] = $temp;
|
|
|
- } else {
|
|
|
+ } /*elseif ($v->type == 'MOUTH') {
|
|
|
+ if (!$property) $property = 'low';
|
|
|
+ if (in_array($this->distribution_channel_id, explode(',', redisEnv('INNER_SITES')))
|
|
|
+ && in_array($property, ['low', 'medium'])
|
|
|
+ ) {
|
|
|
+ $data[] = [
|
|
|
+ 'price' => (int)$v->price . '元',
|
|
|
+ 'is_year_order' => 0,
|
|
|
+ 'is_month_order' => 1,
|
|
|
+ 'text' => sprintf('%s元包月 全站万本精彩小说免费看', (int)$v->price),
|
|
|
+ 'first_charge' => false,
|
|
|
+ 'today_special' => false,
|
|
|
+ 'save_text' => '每月自动续费,可随时关闭',
|
|
|
+ 'product_id' => $v->id,
|
|
|
+ 'show_free_ads' => false,
|
|
|
+ 'link' => generateMonthOrderUrl($this->uid),
|
|
|
+ 'gift' => BookGiftsService::chargeGiveGift($property, $v->price, $v->type)
|
|
|
+ ];
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }*/ else {
|
|
|
if ($v->type == 'NEW_USER') {
|
|
|
continue;
|
|
|
}
|
|
@@ -349,13 +345,14 @@ class OrdersController extends BaseController
|
|
|
$temp = [
|
|
|
'price' => (float)$v->price . '元',
|
|
|
'is_year_order' => 0,
|
|
|
+ 'is_month_order' => 0,
|
|
|
'text' => $text,
|
|
|
'first_charge' => false,
|
|
|
'today_special' => ($v->is_default == 1 && $outstandingYearOrder == false) ? true : false,
|
|
|
'save_text' => $save_text,
|
|
|
'product_id' => $v->id,
|
|
|
'show_free_ads' => $appad,
|
|
|
- 'gift'=>BookGiftsService::chargeGiveGift($property,$v->price,$v->type)
|
|
|
+ 'gift' => BookGiftsService::chargeGiveGift($property, $v->price, $v->type)
|
|
|
];
|
|
|
$data[] = $temp;
|
|
|
}
|
|
@@ -705,11 +702,11 @@ class OrdersController extends BaseController
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- $template_10_site = redisEnv('TEMPLATE_10_SITE','');
|
|
|
- if(!$template_10_site){
|
|
|
+ $template_10_site = redisEnv('TEMPLATE_10_SITE', '');
|
|
|
+ if (!$template_10_site) {
|
|
|
return 0;
|
|
|
}
|
|
|
- if (!in_array($this->distribution_channel_id,explode(',',$template_10_site))) {
|
|
|
+ if (!in_array($this->distribution_channel_id, explode(',', $template_10_site))) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -720,16 +717,16 @@ class OrdersController extends BaseController
|
|
|
|
|
|
$user = DataAnalysisSelectUserService::getByUidAndType($this->uid, 'TEMPLATE_COMPAREV10_2');
|
|
|
if ($user) {
|
|
|
- return $user->attach;
|
|
|
+ return $user->attach;
|
|
|
} else {
|
|
|
- if( $this->uid % 2 == 0 ){
|
|
|
+ if ($this->uid % 2 == 0) {
|
|
|
DataAnalysisSelectUserService::create(
|
|
|
$this->uid,
|
|
|
$this->distribution_channel_id,
|
|
|
'TEMPLATE_COMPAREV10_2',
|
|
|
-1, 10);
|
|
|
return 10;
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
DataAnalysisSelectUserService::create(
|
|
|
$this->uid,
|
|
|
$this->distribution_channel_id,
|
|
@@ -750,9 +747,9 @@ class OrdersController extends BaseController
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- $template_compare_sites = redisEnv('TEMPLATE_COMPARE_SITES',0);
|
|
|
+ $template_compare_sites = redisEnv('TEMPLATE_COMPARE_SITES', 0);
|
|
|
|
|
|
- if (!in_array($this->distribution_channel_id, explode(',',$template_compare_sites))) {
|
|
|
+ if (!in_array($this->distribution_channel_id, explode(',', $template_compare_sites))) {
|
|
|
return 0;
|
|
|
}
|
|
|
$user = $this->_user_info;
|
|
@@ -836,7 +833,7 @@ class OrdersController extends BaseController
|
|
|
}*/
|
|
|
|
|
|
$exist = DataAnalysisSelectUserService::getByUidAndType($uid, 'OUTSTANDING_YEAR_ORDER_V2');
|
|
|
- if($exist) return true;
|
|
|
+ if ($exist) return true;
|
|
|
|
|
|
return false;
|
|
|
|
|
@@ -848,11 +845,12 @@ class OrdersController extends BaseController
|
|
|
return $is_show_outstanding_year_order;*/
|
|
|
}
|
|
|
|
|
|
- public function exchangeList(){
|
|
|
- foreach ($this->chargeList as &$item){
|
|
|
- if(!$item->switch_to) continue;
|
|
|
- $order = Order::where('uid',$this->uid)->where('status','PAID')->where('product_id',$item->id)->first();
|
|
|
- if($order){
|
|
|
+ public function exchangeList()
|
|
|
+ {
|
|
|
+ foreach ($this->chargeList as &$item) {
|
|
|
+ if (!$item->switch_to) continue;
|
|
|
+ $order = Order::where('uid', $this->uid)->where('status', 'PAID')->where('product_id', $item->id)->first();
|
|
|
+ if ($order) {
|
|
|
$change = ProductService::getProductSingle($item->switch_to);
|
|
|
$item->id = $change->id;
|
|
|
$item->price = $change->price;
|