|
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
|
|
use App\Http\Controllers\QuickApp\BaseController;
|
|
|
use Redis;
|
|
|
use App\Modules\Book\Services\UserShelfBooksService;
|
|
|
+use App\Modules\Book\Services\ChapterService;
|
|
|
use App\Http\Controllers\QuickApp\User\Transformers\UserShelfBooksTransformer;
|
|
|
use App\Modules\User\Services\ReadRecordService;
|
|
|
use Hashids;
|
|
@@ -36,7 +37,9 @@ class UserShelfBooksController extends BaseController
|
|
|
* @apiSuccess {Int} data.bid bid
|
|
|
* @apiSuccess {Int} data.book_name 书名
|
|
|
* @apiSuccess {Int} data.cover 封面
|
|
|
- * @apiSuccess {Int} data.last_cid 章节id
|
|
|
+ * @apiSuccess {Int} data.last_cid 最后章节id
|
|
|
+ * @apiSuccess {String} data.last_chapter 最新章节
|
|
|
+ * @apiSuccess {String} data.last_chapter 最近阅读章节
|
|
|
* @apiSuccessExample {json} Success-Response:
|
|
|
* HTTP/1.1 200 OK
|
|
|
* {
|
|
@@ -52,7 +55,10 @@ class UserShelfBooksController extends BaseController
|
|
|
* book_name: "京华烟云",
|
|
|
* cover: "https://leyue-bucket.oss-cn-hangzhou.aliyuncs.com/ycsd_cover/covermiddle/0/1.jpg",
|
|
|
* updated_at: 1511783068,
|
|
|
- * last_cid: 4
|
|
|
+ * last_cid: 4,
|
|
|
+ * last_chapter:"最新 第122章 大事不妙",
|
|
|
+ * recent_reading_chapter:"最近阅读:第5章 又来?"
|
|
|
+ *
|
|
|
* },
|
|
|
* {
|
|
|
* id: 7,
|
|
@@ -62,7 +68,9 @@ class UserShelfBooksController extends BaseController
|
|
|
* book_name: "我来好好爱你",
|
|
|
* cover: "https://leyue-bucket.oss-cn-hangzhou.aliyuncs.com/ycsd_cover/covermiddle/0/11.jpg",
|
|
|
* updated_at: 1511783068,
|
|
|
- * last_cid: 4
|
|
|
+ * last_cid: 4,
|
|
|
+ * last_chapter:"最新 第2556章 又来了个张老三",
|
|
|
+ * recent_reading_chapter:"最近阅读:第2551章 又来了个猪八戒"
|
|
|
* }
|
|
|
* ]
|
|
|
* }
|
|
@@ -73,12 +81,27 @@ class UserShelfBooksController extends BaseController
|
|
|
return response()->success();
|
|
|
}
|
|
|
$record = ReadRecordService::getReadRecord($this->uid);
|
|
|
+// $record=array([
|
|
|
+// 'bid'=>1,
|
|
|
+// 'time'=>3,
|
|
|
+// 'cid'=>4,
|
|
|
+// ],[
|
|
|
+// 'bid'=>2,
|
|
|
+// 'time'=>3,
|
|
|
+// 'cid'=>4,
|
|
|
+// ]);
|
|
|
foreach ($res as &$v){
|
|
|
- $v['last_cid'] = $v['first_cid'];
|
|
|
+ $bid=$v['bid'];
|
|
|
+ $last_cid = $v['last_cid'];
|
|
|
+ $last_chapter = ChapterService::getChapterNameById($last_cid,$bid);
|
|
|
+ $v['last_chapter']="最后章节:第{$last_cid}章 {$last_chapter['name']}";
|
|
|
foreach ($record as $val){
|
|
|
if($v['bid'] == $val['bid']){
|
|
|
$v['updated_at'] = $val['time'];
|
|
|
- $v['last_cid'] = $val['cid'];
|
|
|
+ $recent_reading_cid = $val['cid'];
|
|
|
+// dd($recent_reading_cid);
|
|
|
+ $recent_reading_chapter = ChapterService::getChapterNameById($recent_reading_cid,$bid);
|
|
|
+ $v['recent_reading_chapter'] = "最近阅读:第{$recent_reading_cid}章 {$recent_reading_chapter['name']}";
|
|
|
break;
|
|
|
}
|
|
|
}
|