|
@@ -276,6 +276,12 @@ class ChapterController extends BaseController
|
|
|
return response()->error('QAPP_SYS_ERROR');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if($book_info->charge_type == 'BOOK'){
|
|
|
+ return response()->error('QAPP_BOOK_BUY', $data);
|
|
|
+ }else{
|
|
|
+ return response()->error('QAPP_CHAPTER_BUY', $data);
|
|
|
+ }
|
|
|
//付费 不提醒
|
|
|
if ($this->balancePay($book_info, $cid, $chapter->size, $chapter->name, 0)) {
|
|
|
UserTaskService::addUserTaskQueue($this->uid, BaseTask::read, UserTaskService::judge_trigger);
|
|
@@ -348,11 +354,50 @@ class ChapterController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if ($this->getOrderRecord($bid, $cid)) {
|
|
|
+ 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
|
|
|
+ ]);
|
|
|
+
|
|
|
+
|
|
|
+ return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
|
|
|
+ }
|
|
|
+
|
|
|
if ($this->balancePay($book_info, $cid, $chapter->size, $chapter->name, $remind)) {
|
|
|
+ UserTaskService::addUserTaskQueue($this->uid, BaseTask::read, UserTaskService::judge_trigger);
|
|
|
+ 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
|
|
|
]);
|
|
|
+ $free_book = BookConfigService::getByBidNoFilter($bid);
|
|
|
+ if($free_book) {
|
|
|
+ if(strtotime($free_book->end_time)+7*86400 >= strtotime(date('Y-m-d'))) {
|
|
|
+ if(Redis::Sismember('qapp:free:virtual:uids'.$free_book->id,$this->uid)){
|
|
|
+ $now = date('Y-m-d');
|
|
|
+ $fee = $this->getPrice($book_info, $chapter->size);
|
|
|
+ Redis::hincrby('qapp:book:free:actuality:' . $free_book->id, $now, $fee);
|
|
|
+ Redis::sadd('qapp:free:actuality' . $now, $free_book->id);
|
|
|
+ Redis::sadd('qapp:free:actuality:uids'.$now.$free_book->id,$this->uid);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return response()->item(new ChapterTransformer, $this->getChapter($bid, $cid, $chapter));
|
|
|
} else {
|