|
@@ -127,8 +127,33 @@ class ChapterController extends BaseController
|
|
|
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::addReadLog($this->uid, [
|
|
|
+ 'distribution_channel_id' => $this->distribution_channel_id,
|
|
|
+ 'bid' => $bid,
|
|
|
+ 'cid' => $chapter->id,
|
|
|
+ 'uid' => $this->uid,
|
|
|
+ 'send_order_id' => $this->send_order_id,
|
|
|
+ 'sequence' => $chapter->sequence,
|
|
|
+ ]);
|
|
|
+ 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::addReadLog($this->uid, [
|
|
|
'distribution_channel_id' => $this->distribution_channel_id,
|
|
|
'bid' => $bid,
|