|
@@ -119,8 +119,25 @@ class ChapterController extends BaseController
|
|
return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
|
|
return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
|
|
}
|
|
}
|
|
|
|
|
|
- //已经付费 或者 书籍是否限免
|
|
|
|
- if ($this->getOrderRecord($bid, $cid) || BookConfigService::judgeBookIsFree($bid)) {
|
|
|
|
|
|
+ // 书籍是否限免
|
|
|
|
+ $free = BookConfigService::judgeBookIsFree($bid);
|
|
|
|
+ if ($free) {
|
|
|
|
+ ReadRecordService::addReadRecord([
|
|
|
|
+ 'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
|
|
|
|
+ 'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
|
|
|
|
+ ]);
|
|
|
|
+ if($chapter->is_vip == 1){
|
|
|
|
+ $fee = $this->getPrice($book_info, $chapter->size);
|
|
|
|
+ $now = date('Y-m-d');
|
|
|
|
+ Redis::hincrby('qapp:book:free:virtual:'.$free->id,$now,$fee);
|
|
|
|
+ Redis::sadd('qapp:free:virtual'.$now,$free->id);
|
|
|
|
+ }
|
|
|
|
+ return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //已经付费
|
|
|
|
+ if ($this->getOrderRecord($bid, $cid)) {
|
|
ReadRecordService::addReadRecord([
|
|
ReadRecordService::addReadRecord([
|
|
'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
|
|
'uid' => $this->uid, 'bid' => $bid, 'book_name' => $book_info->book_name,
|
|
'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
|
|
'cid' => $cid, 'chapter_name' => $chapter->name, 'sequence' => $chapter->sequence
|