|
@@ -304,10 +304,18 @@ class ChapterController extends BaseController
|
|
return response()->error('WAP_NOT_LOGIN');
|
|
return response()->error('WAP_NOT_LOGIN');
|
|
}
|
|
}
|
|
$this->en_bid = $bid;
|
|
$this->en_bid = $bid;
|
|
|
|
+
|
|
$bid = Hashids::decode($bid)[0];
|
|
$bid = Hashids::decode($bid)[0];
|
|
//获取图书信息
|
|
//获取图书信息
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
|
|
|
|
|
|
+ //是否开启全站按章模式
|
|
|
|
+ $global_charge_by_chapter_channels = explode(',',env('GLOBAL_CHARGE_BY_CHAPTER_CHANNEL'));
|
|
|
|
+ if(in_array($this->distribution_channel_id,$global_charge_by_chapter_channels))
|
|
|
|
+ {
|
|
|
|
+ $book_info->charge_type = 'CHAPTER';
|
|
|
|
+ }
|
|
|
|
+
|
|
if (empty($book_info)) return response()->error('WAP_SYS_ERROR');
|
|
if (empty($book_info)) return response()->error('WAP_SYS_ERROR');
|
|
$this->book_info = $book_info;
|
|
$this->book_info = $book_info;
|
|
$this->cid = $cid;
|
|
$this->cid = $cid;
|
|
@@ -337,6 +345,14 @@ class ChapterController extends BaseController
|
|
//用户是否强关
|
|
//用户是否强关
|
|
$this->is_had_subscribe = $is_had_subscribe = $inter_not_need_sub ? true : $this->getSubscribe();
|
|
$this->is_had_subscribe = $is_had_subscribe = $inter_not_need_sub ? true : $this->getSubscribe();
|
|
|
|
|
|
|
|
+ //判断当前是否有强制显示服务号信息的cookie、已经关注 跳转到服务号信息引导页
|
|
|
|
+ if(Cookie::get('force_show_qrcode') && $is_had_subscribe)
|
|
|
|
+ {
|
|
|
|
+ $force_read_url = '/subscribe/getFromUser';//服务号信息引导页
|
|
|
|
+ $force_read_data = ['src' => $force_read_url];
|
|
|
|
+ return response()->error('WAP_NOT_SUBSCRIBE', $force_read_data);
|
|
|
|
+ }
|
|
|
|
+
|
|
//获取强关章节数
|
|
//获取强关章节数
|
|
$subscribe_seq = $this->getSubscribeChapterNum($book_info);
|
|
$subscribe_seq = $this->getSubscribeChapterNum($book_info);
|
|
//章节是否需要强关 TRUE:不需要,false:需要
|
|
//章节是否需要强关 TRUE:不需要,false:需要
|
|
@@ -368,6 +384,7 @@ class ChapterController extends BaseController
|
|
$this->getChapter();
|
|
$this->getChapter();
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
}
|
|
}
|
|
|
|
+
|
|
//需要强制关注 不是vip章节 已经关注了
|
|
//需要强制关注 不是vip章节 已经关注了
|
|
if (!$force_subscribe && $chapter->is_vip == 0 && $is_had_subscribe) {
|
|
if (!$force_subscribe && $chapter->is_vip == 0 && $is_had_subscribe) {
|
|
$this->getChapter();
|
|
$this->getChapter();
|
|
@@ -392,16 +409,17 @@ class ChapterController extends BaseController
|
|
$this->getChapter();
|
|
$this->getChapter();
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
}
|
|
}
|
|
|
|
+ //获取价格
|
|
|
|
+ $fee = $this->getPrice($book_info, $chapter);
|
|
//广告
|
|
//广告
|
|
- if($this->isUserInAdSample() && $ad_status && $ad_status == 1){
|
|
|
|
|
|
+ if($this->isUserInAdSample() && $ad_status && $ad_status == 1 && $user_info->balance < $fee){
|
|
$this->getChapter();
|
|
$this->getChapter();
|
|
$this->bookOrderOrChapterOrder($book_info, $cid, 0, $chapter->name, 1);
|
|
$this->bookOrderOrChapterOrder($book_info, $cid, 0, $chapter->name, 1);
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
}
|
|
}
|
|
//以上都是不用付费的情况******************************************************
|
|
//以上都是不用付费的情况******************************************************
|
|
//未付费
|
|
//未付费
|
|
- //获取价格
|
|
|
|
- $fee = $this->getPrice($book_info, $chapter);
|
|
|
|
|
|
+
|
|
//返回的价格信息
|
|
//返回的价格信息
|
|
$data = [
|
|
$data = [
|
|
'book_id' => $this->en_bid,
|
|
'book_id' => $this->en_bid,
|
|
@@ -556,6 +574,9 @@ class ChapterController extends BaseController
|
|
if ((int)$this->_user_info['balance'] >= $fee) {
|
|
if ((int)$this->_user_info['balance'] >= $fee) {
|
|
if ($this->bookOrderOrChapterOrder($book_info, $chapter->id, $fee, $chapter->name, $is_remind)) {
|
|
if ($this->bookOrderOrChapterOrder($book_info, $chapter->id, $fee, $chapter->name, $is_remind)) {
|
|
$this->chapterOrderStats($fee);
|
|
$this->chapterOrderStats($fee);
|
|
|
|
+ if($this->user){
|
|
|
|
+ $this->user->balance -= $fee;
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -671,6 +692,11 @@ class ChapterController extends BaseController
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private function getOfficialAccountForceReadNotice()
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
//强关页面的统计
|
|
//强关页面的统计
|
|
private function subscribeStats()
|
|
private function subscribeStats()
|
|
{
|
|
{
|
|
@@ -1000,7 +1026,7 @@ class ChapterController extends BaseController
|
|
//Log::info($price_rate);
|
|
//Log::info($price_rate);
|
|
$fee = ceil($chapter->size * $price_rate);
|
|
$fee = ceil($chapter->size * $price_rate);
|
|
if($this->isRaisePrice()){
|
|
if($this->isRaisePrice()){
|
|
- $fee = round($chapter->size * 0.0165);
|
|
|
|
|
|
+ $fee = round($chapter->size * 0.018);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//首个计费章节书币价格以35书币为基准,低于35提升至35,原价高于35书币,维持原价
|
|
//首个计费章节书币价格以35书币为基准,低于35提升至35,原价高于35书币,维持原价
|
|
@@ -1501,11 +1527,13 @@ class ChapterController extends BaseController
|
|
}
|
|
}
|
|
//阅读页面底部是否显示广告
|
|
//阅读页面底部是否显示广告
|
|
private function isShowAd(){
|
|
private function isShowAd(){
|
|
|
|
+ if(!in_array($this->distribution_channel_id,[2,14,123,211])){
|
|
|
|
+ return ;
|
|
|
|
+ }
|
|
//按章付费才显示
|
|
//按章付费才显示
|
|
if($this->book_info->charge_type != 'CHAPTER'){
|
|
if($this->book_info->charge_type != 'CHAPTER'){
|
|
return ;
|
|
return ;
|
|
}
|
|
}
|
|
-
|
|
|
|
//用户是否在广告样本中
|
|
//用户是否在广告样本中
|
|
if(!$this->isUserInAdSample()) return ;
|
|
if(!$this->isUserInAdSample()) return ;
|
|
$cid = 0;
|
|
$cid = 0;
|
|
@@ -1515,12 +1543,12 @@ class ChapterController extends BaseController
|
|
if(!$cid){
|
|
if(!$cid){
|
|
return ;
|
|
return ;
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ //付费用户没有广告
|
|
|
|
+ if(OrderService::isPaidUser($this->uid)) return ;
|
|
//如果下一张已经付费,广告不显示
|
|
//如果下一张已经付费,广告不显示
|
|
if($this->getOrderRecord($this->book_info->bid, $cid)){
|
|
if($this->getOrderRecord($this->book_info->bid, $cid)){
|
|
return ;
|
|
return ;
|
|
}
|
|
}
|
|
-
|
|
|
|
$next_chapter = ChapterService::getChapterNameById($cid, $this->book_info->bid);
|
|
$next_chapter = ChapterService::getChapterNameById($cid, $this->book_info->bid);
|
|
//下一章事vip的话 才显示广告
|
|
//下一章事vip的话 才显示广告
|
|
if(!$next_chapter || !$next_chapter->is_vip){
|
|
if(!$next_chapter || !$next_chapter->is_vip){
|
|
@@ -1529,7 +1557,9 @@ class ChapterController extends BaseController
|
|
|
|
|
|
$price = $this->getPrice($this->book_info,$next_chapter);
|
|
$price = $this->getPrice($this->book_info,$next_chapter);
|
|
|
|
|
|
- if($price > $this->user->balance){
|
|
|
|
|
|
+ $flag = $price > $this->user->balance;
|
|
|
|
+
|
|
|
|
+ if( $flag ){
|
|
$this->chapter->is_show_ad = 1;
|
|
$this->chapter->is_show_ad = 1;
|
|
AdVisitStatService::create($this->uid,$this->book_info->bid,$this->cid,'EXPOSURE');
|
|
AdVisitStatService::create($this->uid,$this->book_info->bid,$this->cid,'EXPOSURE');
|
|
}
|
|
}
|