|
@@ -298,24 +298,45 @@ class ChapterController extends BaseController
|
|
|
*/
|
|
|
public function index(Request $request, $t, $domain, $bid, $cid)
|
|
|
{
|
|
|
+ $special_user_log = env('SPECIAL_USER_LOG');
|
|
|
//注意:内部约定用 有此参数不需要强关
|
|
|
$inter_not_need_sub = $request->has('inter_not_need_sub') ? true : false;
|
|
|
-
|
|
|
$ad_status = $request->get('ad_status');
|
|
|
$ad_status = 0;
|
|
|
$has_force_show_qrcode_cookie = Cookie::get('force_show_qrcode');
|
|
|
Cookie::queue('force_show_qrcode', 1, -1);
|
|
|
|
|
|
if (!$this->checkUid()) {
|
|
|
+ myLog('special')->info('chapter index controller---$this->checkUid() fail-------');
|
|
|
return response()->error('WAP_NOT_LOGIN');
|
|
|
}
|
|
|
+
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('in chapters--------------------------');
|
|
|
+ $my_log->info('param is');
|
|
|
+ $my_log->info($request->all());
|
|
|
+ $my_log->info('$t is: '.$t);
|
|
|
+ $my_log->info('$domain is: '.$domain);
|
|
|
+ $my_log->info('$bid is: '.$bid);
|
|
|
+ $my_log->info('$cid is: '.$cid);
|
|
|
+ $my_log->info('$uri is: '. $request->path());
|
|
|
+ }
|
|
|
+
|
|
|
$this->en_bid = $bid;
|
|
|
|
|
|
$bid = explode(',',$bid)[0];
|
|
|
$bid = Hashids::decode($bid)[0];
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ myLog('special')->info('decode bid is: '.$bid);
|
|
|
+ }
|
|
|
//获取图书信息
|
|
|
$book_info = BookConfigService::getBookById($bid);
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('book_info is ');
|
|
|
+ $my_log->info($book_info);
|
|
|
+ }
|
|
|
//是否开启全站按章模式
|
|
|
$global_charge_by_chapter_channels = explode(',',env('GLOBAL_CHARGE_BY_CHAPTER_CHANNEL'));
|
|
|
if(in_array($this->distribution_channel_id,$global_charge_by_chapter_channels))
|
|
@@ -324,6 +345,10 @@ class ChapterController extends BaseController
|
|
|
}
|
|
|
|
|
|
if (empty($book_info)) return response()->error('WAP_SYS_ERROR');
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('book info ok--------------------------');
|
|
|
+ }
|
|
|
$this->book_info = $book_info;
|
|
|
$this->cid = $cid;
|
|
|
|
|
@@ -331,17 +356,32 @@ class ChapterController extends BaseController
|
|
|
if ($this->isOffShelf()) {
|
|
|
return response()->error('WAP_OFF_SHELF');
|
|
|
}
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('on shelf ok--------------------------');
|
|
|
+ }
|
|
|
//获取章节信息
|
|
|
$chapter = ChapterService::getChapterNameById($cid, $bid);
|
|
|
$this->chapter = $chapter;
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('chapters-info--is-----------------------');
|
|
|
+ $my_log->info($chapter);
|
|
|
+ }
|
|
|
//章节被删除
|
|
|
if (($is_delete = $this->chapterNotExists())) {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('chapters-----delete---------------------');
|
|
|
+ }
|
|
|
return response()->error('WAP_DOMAIN_NOT_MATCH', [
|
|
|
'url' => $is_delete
|
|
|
]);
|
|
|
}
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('chapters-----ok---------------------');
|
|
|
+ }
|
|
|
//获取强关章节数
|
|
|
$subscribe_seq = $this->getSubscribeChapterNum($book_info);
|
|
|
//章节是否需要强关 TRUE:不需要,false:需要
|
|
@@ -351,11 +391,18 @@ class ChapterController extends BaseController
|
|
|
|
|
|
//图书域名,book_configs表的promotion_domain 要跟当前的主机名匹配 在强关章节后
|
|
|
if ($this->is_need_subscribe && $this->isVisitDomainEqualBookDomain($domain)) {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('book domain not match------------------------');
|
|
|
+ }
|
|
|
return response()->error('WAP_DOMAIN_NOT_MATCH', [
|
|
|
'url' => $this->getCorrespondBookUrl()
|
|
|
]);
|
|
|
}
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('book domain jump--------------------------');
|
|
|
+ }
|
|
|
$user_info = $this->_user_info;
|
|
|
$this->user = $user_info;
|
|
|
//用户是否强关
|
|
@@ -368,11 +415,18 @@ class ChapterController extends BaseController
|
|
|
//判断当前是否有强制显示服务号信息的cookie、已经关注 跳转到服务号信息引导页
|
|
|
if($has_force_show_qrcode_cookie && $is_had_subscribe)
|
|
|
{
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('do not have force show qrcode cookie-------------------------');
|
|
|
+ }
|
|
|
$force_read_url = '/subscribe/getFromUser';//服务号信息引导页
|
|
|
$force_read_data = ['src' => $force_read_url];
|
|
|
return response()->error('WAP_NOT_SUBSCRIBE', $force_read_data);
|
|
|
}
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('has force show qrcode cookie-ok-------------------------');
|
|
|
+ }
|
|
|
|
|
|
if ($force_subscribe || $chapter->is_vip == 0) {
|
|
|
//vip前一张和枪管前一张的访问统计
|
|
@@ -391,40 +445,75 @@ class ChapterController extends BaseController
|
|
|
$this->chapter->is_show_subscribe_link = 1;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('do not force subscribe-and is not vip-------------------------');
|
|
|
+ }
|
|
|
$this->getChapter();
|
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
|
}
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('11111111111111111111111111111111111111111');
|
|
|
+ }
|
|
|
//需要强制关注 不是vip章节 已经关注了
|
|
|
if (!$force_subscribe && $chapter->is_vip == 0 && $is_had_subscribe) {
|
|
|
$this->getChapter();
|
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
|
}
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('222222222222222222222222222222222222222');
|
|
|
+ }
|
|
|
//需要强制关注 没关注
|
|
|
if ((!$force_subscribe) && !$is_had_subscribe) {
|
|
|
$force_data = $this->forceSubscribe();
|
|
|
if ($force_data) {
|
|
|
$this->subscribeStats();
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('need subscribe-------------------------');
|
|
|
+ }
|
|
|
return response()->error($force_data['error_type'], $force_data['data']);
|
|
|
}
|
|
|
|
|
|
//取不到公众号则不用强关
|
|
|
if ($chapter->is_vip == 0) {
|
|
|
$this->getChapter();
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('official fail--------------------------');
|
|
|
+ }
|
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
|
}
|
|
|
}
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('33333333333333333333333333333333333333333');
|
|
|
+ }
|
|
|
//已经付费
|
|
|
if ($this->getOrderRecord($bid, $cid)) {
|
|
|
$this->getChapter();
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('had order order record--------------------------');
|
|
|
+ }
|
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
|
}
|
|
|
+
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('4444444444444444444444444444444444444444444');
|
|
|
+ }
|
|
|
//获取价格
|
|
|
$fee = $this->getPrice($book_info, $chapter);
|
|
|
//广告
|
|
|
if($this->isUserInAdSample() && $ad_status && $ad_status == 1 && $user_info->balance < $fee){
|
|
|
$this->getChapter();
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('ad-----in--------------------');
|
|
|
+ }
|
|
|
//广告解锁2张
|
|
|
if($this->chapter->next_cid){
|
|
|
$next_chapter = ChapterService::getChapterNameById($this->chapter->next_cid, $bid);
|
|
@@ -438,6 +527,10 @@ class ChapterController extends BaseController
|
|
|
$this->bookOrderOrChapterOrder($book_info, $cid, 0, $chapter->name, 1);
|
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
|
}
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('5555555555555555555555555555555555');
|
|
|
+ }
|
|
|
//以上都是不用付费的情况******************************************************
|
|
|
//未付费
|
|
|
|
|
@@ -457,32 +550,74 @@ class ChapterController extends BaseController
|
|
|
'discount_fee' => '',
|
|
|
'discount' => ''
|
|
|
];
|
|
|
-
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('data is:');
|
|
|
+ $my_log->info($data);
|
|
|
+ }
|
|
|
//余额不足 弹窗提醒
|
|
|
if ($user_info['balance'] < $fee) {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('balance is lack');
|
|
|
+ $my_log->info('user balance is: '.$user_info['balance']);
|
|
|
+ $my_log->info('fee is: '.$fee);
|
|
|
+ }
|
|
|
$this->smartPushTestBookPayPageUv($bid);
|
|
|
//$this->sendOrderPayPageUv($bid);
|
|
|
//除了单本订购 其他的都不提醒,直接跳转到充值页面
|
|
|
if ($book_info->charge_type == 'CHAPTER') {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('chapter order balance lack');
|
|
|
+ }
|
|
|
return response()->error('WAP_CHAPTER_SECOND_BALANCE_PAY', $data);
|
|
|
}
|
|
|
//需要提箱
|
|
|
if ($this->isOrderRemind($bid)) {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('balance lack remind');
|
|
|
+ }
|
|
|
return response()->error('WAP_BOOK_BALANCE_PAY', $data);
|
|
|
} else {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('balance lack not remind');
|
|
|
+ }
|
|
|
return response()->error('WAP_BOOK_SECOND_BALANCE_PAY', $data);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('6666666666666666666666666666666666666');
|
|
|
+ }
|
|
|
//余额充足 单本弹窗提醒,章节直接扣费
|
|
|
if ($this->isOrderRemind($bid) && $book_info->charge_type == 'BOOK') {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('balance enough remind');
|
|
|
+ }
|
|
|
return response()->error('WAP_BOOK_BUY', $data);
|
|
|
}
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('77777777777777777777777777777');
|
|
|
+ }
|
|
|
//付费 不提醒
|
|
|
if ($this->balancePay($book_info, $chapter, 0)) {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('balance pay ok-----');
|
|
|
+ }
|
|
|
$this->getChapter();
|
|
|
return response()->item(new ChapterTransformer, $this->chapter);
|
|
|
} else {
|
|
|
+ if($special_user_log && $special_user_log == $this->uid){
|
|
|
+ $my_log = myLog('special');
|
|
|
+ $my_log->info('balance pay fails!!!!!!!!!!!!!!!!');
|
|
|
+ }
|
|
|
//付费 异常
|
|
|
return response()->error('WAP_SYS_ERROR');
|
|
|
}
|
|
@@ -1087,6 +1222,10 @@ class ChapterController extends BaseController
|
|
|
*/
|
|
|
private function getSubscribeChapterNum($book)
|
|
|
{
|
|
|
+ $hour = date('G');
|
|
|
+ if($this->send_order_id && $hour <=5 && in_array($this->send_order_id,[392216,392218])){
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
//派单强关
|
|
|
if ($this->send_order_id) {
|
|
|
$send_order_info = SendOrderService::getById($this->send_order_id);
|