123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642 |
- <?php
- namespace App\Http\Controllers\QuickApp\Book;
- use Illuminate\Http\Request;
- use App\Http\Controllers\QuickApp\BaseController;
- use App\Http\Controllers\QuickApp\Book\Transformers\BookTransformer;
- use App\Modules\Book\Services\BookConfigService;
- use App\Modules\Book\Services\UserShelfBooksService;
- use App\Modules\Book\Services\ChapterService;
- use Hashids;
- use App\Modules\Subscribe\Services\YearOrderService;
- use Log;
- class BookController extends BaseController
- {
- /**
- * @apiDefine Book 图书
- */
- /**
- * @apiVersion 1.0.0
- * @apiDescription 获取图书详情
- * @api {get} book/{bid} 获取图书详情
- * @apiGroup Book
- * @apiName index
- * @apiParam {String} [token] token
- * @apiHeader {String} [Authorization] token 两个token任选其一
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {object} data 结果集
- * @apiSuccess {Int} data.book_id bid
- * @apiSuccess {String} data.book_name 书名
- * @apiSuccess {String} data.book_summary 简介
- * @apiSuccess {String} data.book_author 作者
- * @apiSuccess {String} data.cover_url 封面
- * @apiSuccess {Int} data.book_word_count 字数
- * @apiSuccess {Int} data.book_chapter_total 章节数
- * @apiSuccess {Int} data.book_category_id 分类
- * @apiSuccess {String} data.book_category 分类名
- * @apiSuccess {Int} data.book_end_status 是否完结
- * @apiSuccess {String} data.book_published_time 发布时间
- * @apiSuccess {String} data.copyright 版权信息
- * @apiSuccess {Int} data.force_subscribe_chapter_id 强制关注的章节数
- * @apiSuccess {String} data.update_time 更新时间
- * @apiSuccess {Int} data.is_on_user_shelf 是否加入架
- * @apiSuccess {Int} data.book_price 是否上架
- * @apiSuccess {String} data.charge_type 收费类型
- * @apiSuccess {String} data.keyword 关键词
- * @apiSuccess {String} data.recommend_index 推荐指数
- * @apiSuccess {String} data.is_show_index_content 是否显示推荐指数文本
- * @apiSuccess {Int} data.click_count 点击数
- * @apiSuccess {Int} data.product_id product_id
- * @apiSuccess {Int} data.last_cid 最后一张cid
- * @apiSuccess {Int} data.last_chapter 第254章 婚礼(大结局)
- * @apiSuccess {Int} data.last_chapter_is_vip 第254章 婚礼(大结局)
- * @apiSuccess {Int} data.first_cid 第一章cid
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * code: 0,
- * msg: "",
- * data: {
- * book_id: 5,
- * book_name: "肌缘巧合",
- * book_summary: " 他是权势倾天,纵横商界的王者,却偏偏钟情于她,一宠成瘾。“女人,我要你......只要你能满足我,别墅、游轮、支票,你随便挑。”她羞涩的半低着头:“我只想要你。”他挑眉,“你野心不小啊!”她妩媚一笑,解开他的领带,“难道你不愿意!”他宠她爱她,给她所有想要的。只是有一天她终于忍不住暴走,“靠,你有没有节制呀?我要离婚。”",
- * book_author: "妖火",
- * cover_url: "http://www.leyuee.com/cover/0/8.jpg",
- * book_word_count: 0,
- * book_chapter_total: 0,
- * book_category_id: null,
- * book_category: "爆笑,宠文,潜规则",
- * book_end_status: 8,
- * book_published_time: null,
- * copyright: null,
- * charge_type: null,
- * force_subscribe_chapter_id: 0,
- * update_time: null,
- * is_on_user_shelf: 0,
- * book_price: null,
- * keyword: 关键词,
- * recommend_index:2,
- * is_show_index_content:0,
- * click_count:0,
- * product_id:0,
- * last_cid:0,
- * last_chapter:0,
- * last_chapter_is_vip:0,
- * }
- * }
- */
- public function index(Request $request,$bid){
- $bid = Hashids::decode($bid)[0];
- $book_info = BookConfigService::getBookById($bid);
- if(!$book_info){
- return response()->error('QAPP_SYS_ERROR');
- }
- if(!in_array($book_info->is_on_shelf,[1,2])){
- return response()->error('QAPP_OFF_SHELF');
- }
- $is_on_shelf = UserShelfBooksService::getUserShelfBooksListByUidAndBid($this->uid,$bid);
- $book_info['is_on_user_shelf'] = 0;
- if($is_on_shelf){
- $book_info['is_on_user_shelf'] = 1;
- }
- $last_chapter = ChapterService::getChapterNameById($book_info['last_cid'],$bid);//chapter_is_vip
- $book_info['last_chapter_is_vip'] = $last_chapter['is_vip'];
- return response()->item(new BookTransformer(), $book_info);
- }
- /**
- * @apiVersion 1.0.0
- * @apiDescription 首页(male|female)
- * @api {get} books/{sex}/index 首页(male|female)
- * @apiGroup Book
- * @apiParam {String} [token] token
- * @apiHeader {String} [Authorization] token 两个token任选其一
- * @apiName getBookLists
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {object} data 结果集
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * code: 0,
- * msg: "",
- * data: [
- * {
- * type: "lunbo",
- * lable: "男频",
- * books: [
- * {},{}
- * ]
- * },
- * {
- * type: "hot",
- * lable: "热门推荐",
- * books: [
- * {},{}
- * ]
- * }
- * ]
- * }
- */
- public function getBookLists(Request $request,$sex){
- if($sex == 'male'){
- $type = [
- 'BOOK_MALE_LOOP',
- 'BOOK_MALE_HOT',
- 'BOOK_MALE_ZHIBO',
- 'BOOK_MALE_RECOM',
- 'BOOK_MALE_NEW_RECOM'
- ];
- }else{
- $type = [
- 'BOOK_FEMALE_LOOP',
- 'BOOK_FEMALE_HOT',
- 'BOOK_FEMALE_ZHIBO',
- 'BOOK_FEMALE_RECOM',
- 'BOOK_FEMALE_NEW_RECOM'
- ];
- }
- $book = [
- ['type'=>'lunbo','lable'=>'','books'=>''],
- ['type'=>'hot','lable'=>'热门推荐','books'=>''],
- ['type'=>'zhibo','lable'=>'神书直播','books'=>''],
- ['type'=>'recom','lable'=>'编辑推荐','books'=>''],
- ['type'=>'new_recom','lable'=>'新书推荐','books'=>''],
- ];
- foreach ($type as $key=>$v){
- $book[$key]['books'] = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',env($v))));
- }
- return response()->success($book);
- }
- /**
- * @apiVersion 1.0.0
- * @apiDescription 书库
- * @api {get} books/library 书库
- * @apiParam {String} key
- * @apiParam {Int} category_id 分类id
- * @apiParam {String} order_field 排序字段(推荐指数:recommend_index|点击数:click_count|字数:size|update:时间)
- * @apiParam {String} order_seq 排序顺序(顺序:asc|逆序:desc)
- * @apiParam {String} [page_size] 分页大小
- * @apiParam {String} [page] 页码
- * @apiParam {String} [status] 完结与否(0|1)完结1 连载0
- * @apiParam {String} [token] token
- * @apiHeader {String} [Authorization] token 两个token任选其一
- * @apiGroup Book
- * @apiName library
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {object} data 结果集
- * @apiSuccess {Array} data.list 结果数据集
- * @apiSuccess {Int} data.list.book_id bid
- * @apiSuccess {String} data.list.book_name 书名
- * @apiSuccess {String} data.list.book_summary 简介
- * @apiSuccess {String} data.list.book_author 作者
- * @apiSuccess {String} data.list.cover_url 封面
- * @apiSuccess {Int} data.list.book_word_count 字数
- * @apiSuccess {Int} data.list.book_chapter_total 章节数
- * @apiSuccess {Int} data.list.book_category_id 分类
- * @apiSuccess {String} data.list.book_category 分类名
- * @apiSuccess {String} data.list.book_end_status 是否完结
- * @apiSuccess {String} data.list.book_published_time 发布时间
- * @apiSuccess {String} data.list.copyright 版权信息
- * @apiSuccess {Int} data.list.force_subscribe_chapter_id 强制关注的章节数
- * @apiSuccess {String} data.list.update_time 更新时间
- * @apiSuccess {Int} data.list.is_on_shelf 是否上架
- * @apiSuccess {String} data.list.book_price 是否上架
- * @apiSuccess {String} data.list.recommend_index 推荐指数
- * @apiSuccess {Int} data.list.charge_type 收费类型
- * @apiSuccess {Int} data.list.keyword 关键词
- * @apiSuccess {Int} data.list.is_show_index_content 是否显示推荐指数文本
- * @apiSuccess {Int} data.list.click_count 点击数
- * @apiSuccess {Int} data.list.product_id product_id
- * @apiSuccess {Int} data.list.last_cid 1224
- * @apiSuccess {Int} data.list.last_chapter 第254章 婚礼(大结局)
- * @apiSuccess {object} data.meta 分页信息
- * @apiSuccess {Int} data.meta.total 总条数
- * @apiSuccess {Int} data.meta.per_page 每页条数
- * @apiSuccess {Int} data.meta.current_page 当前页
- * @apiSuccess {Int} data.meta.last_page 最后页
- * @apiSuccess {String} data.meta.next_page_url 下一页
- * @apiSuccess {String} data.meta.prev_page_url 上一页
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * code: 0,
- * msg: "",
- * data: {
- * list: [
- * {
- * book_id: 5,
- * book_name: "肌缘巧合",
- * book_summary: " 他是权势倾天,纵横商界的王者,却偏偏钟情于她,一宠成瘾。“女人,我要你......只要你能满足我,别墅、游轮、支票,你随便挑。”她羞涩的半低着头:“我只想要你。”他挑眉,“你野心不小啊!”她妩媚一笑,解开他的领带,“难道你不愿意!”他宠她爱她,给她所有想要的。只是有一天她终于忍不住暴走,“靠,你有没有节制呀?我要离婚。”",
- * book_author: "妖火",
- * cover_url: "http://www.leyuee.com/cover/0/8.jpg",
- * book_word_count: 0,
- * book_chapter_total: 0,
- * book_category_id: null,
- * book_category: "爆笑,宠文,潜规则",
- * book_end_status: 8,
- * book_published_time: null,
- * copyright: null,
- * charge_type: null,
- * force_subscribe_chapter_id: 0,
- * update_time: null,
- * is_on_shelf: 1,
- * book_price: null,
- * keyword: "温馨,虐心,清水",
- * recommend_index:2,
- * is_show_index_content:0,
- * click_count:0,
- * product_id:0,
- * last_cid:0,
- * last_chapter:第254章 婚礼(大结局),
- * },
- * ],
- * meta: {
- * total: 18,
- * per_page: 15,
- * current_page: 1,
- * last_page: 2,
- * next_page_url: "http://myapi.cn/api/hotrank/books?page=2",
- * prev_page_url: ""
- * }
- * }
- * }
- */
- public function library(Request $request){
- $where = [];
- //$order = ['book_configs.id','asc'];
- $order = [];
- $where['is_on_shelf'] = [1,2];
- $category_id = $request->input('category_id');
- if($category_id){
- if($category_id == 1){
- $where['channel_name'] = '男频';
- }elseif($category_id == 2){
- $where['channel_name'] = '女频';
- }else{
- $where['category_id'] = $category_id;
- }
- }
- $key = $request->input('key');
- $where['key'] = $key;
- $order_field = $request->input('order_field');
- $order_seq = $request->input('order_seq');
- if($order_field != '' && in_array($order_field,['recommend_index','click_count','update','size','create'])){
- if($order_field == 'update'){
- $order = ['book_configs.updated_at','desc'];
- }elseif ($order_field == 'create') {
- $order = ['book_configs.created_at','desc'];
- }
- else{
- $order = [$order_field,'desc'];
- }
- if($order_seq == 'asc'){
- $order = [$order_field,'asc'];
- }
- if($order_seq == 'desc'){
- $order = [$order_field,'desc'];
- }
- }
- $status = $request->input('status');
- if($status != ''){
- $where['status'] = $status;
- }
- $page_size = $request->input('page_size',15);
- $books = BookConfigService::getBooks($where,$order,$page_size);
- return response()->pagination(new BookTransformer,$books);
- }
- /**
- * @apiVersion 1.0.0
- * @apiDescription 相似推荐
- * @api {get} books/similar 相似推荐
- * @apiParam {Int} category_id
- * @apiParam {Int} bid
- * @apiGroup Book
- * @apiName similarRecom
- * @apiParam {String} [token] token
- * @apiHeader {String} [Authorization] token 两个token任选其一
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {object} data 结果集
- * @apiSuccess {Array} data 结果数据集
- * @apiSuccess {Int} data.book_id bid
- * @apiSuccess {String} data.book_name 书名
- * @apiSuccess {String} data.book_summary 简介
- * @apiSuccess {String} data.book_author 作者
- * @apiSuccess {String} data.cover_url 封面
- * @apiSuccess {Int} data.book_word_count 字数
- * @apiSuccess {Int} data.book_chapter_total 章节数
- * @apiSuccess {Int} data.book_category_id 分类
- * @apiSuccess {String} data.book_category 分类名
- * @apiSuccess {String} data.book_end_status 是否完结
- * @apiSuccess {String} data.book_published_time 发布时间
- * @apiSuccess {String} data.copyright 版权信息
- * @apiSuccess {Int} data.force_subscribe_chapter_id 强制关注的章节数
- * @apiSuccess {String} data.update_time 更新时间
- * @apiSuccess {Int} data.is_on_shelf 是否上架
- * @apiSuccess {String} data.book_price 是否上架
- * @apiSuccess {String} data.recommend_index 推荐指数
- * @apiSuccess {Int} data.charge_type 收费类型
- * @apiSuccess {Int} data.keyword 关键词
- * @apiSuccess {Int} data.is_show_index_content 是否显示推荐指数文本
- * @apiSuccess {Int} data.click_count 点击数
- * @apiSuccess {Int} data.product_id product_id
- * @apiSuccess {Int} data.last_cid 123
- * @apiSuccess {Int} data.last_chapter 第254章 婚礼(大结局)
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * code: 0,
- * msg: "",
- * data: {
- * [
- * {
- * book_id: 5,
- * book_name: "肌缘巧合",
- * book_summary: " 他是权势倾天,纵横商界的王者,却偏偏钟情于她,一宠成瘾。“女人,我要你......只要你能满足我,别墅、游轮、支票,你随便挑。”她羞涩的半低着头:“我只想要你。”他挑眉,“你野心不小啊!”她妩媚一笑,解开他的领带,“难道你不愿意!”他宠她爱她,给她所有想要的。只是有一天她终于忍不住暴走,“靠,你有没有节制呀?我要离婚。”",
- * book_author: "妖火",
- * cover_url: "http://www.leyuee.com/cover/0/8.jpg",
- * book_word_count: 0,
- * book_chapter_total: 0,
- * book_category_id: null,
- * book_category: "爆笑,宠文,潜规则",
- * book_end_status: 8,
- * book_published_time: null,
- * copyright: null,
- * charge_type: null,
- * force_subscribe_chapter_id: 0,
- * update_time: null,
- * is_on_shelf: 1,
- * book_price: null,
- * keyword: "温馨,虐心,清水",
- * recommend_index:2,
- * is_show_index_content:0,
- * click_count:0,
- * product_id:0,
- * last_cid:0,
- * last_chapter:第254章 婚礼(大结局),
- * },
- * ],
- * }
- * }
- */
- public function similarRecom (Request $request){
- $category_id = $request->input('category_id');
- $bid = $request->input('bid');
- if(empty($bid) || empty($category_id)){
- return response()->error('PARAM_ERROR');
- }
- $bid = Hashids::decode($bid)[0];
- $where = ['category_id'=>$category_id,'is_on_shelf'=>[1,2]];
- $books = BookConfigService::getBooks($where,[],4);
- $data = [];
- foreach ($books as $v){
- if($v->bid != $bid && count($data) <3){
- $data[] = $v;
- }
- }
- return response()->collection(new BookTransformer(),$data);
- }
- /**
- * @apiVersion 1.0.0
- * @apiDescription 尾页推荐
- * @api {get} books/readOverRecommend 尾页推荐
- * @apiParam {Int} bid
- * @apiGroup Book
- * @apiParam {String} [token] token
- * @apiHeader {String} [Authorization] token 两个token任选其一
- * @apiName readOverRecommend
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {object} data 结果集
- * @apiSuccess {Array} data 结果数据集
- * @apiSuccess {Int} data.book_id bid
- * @apiSuccess {String} data.book_name 书名
- * @apiSuccess {String} data.book_summary 简介
- * @apiSuccess {String} data.book_author 作者
- * @apiSuccess {String} data.cover_url 封面
- * @apiSuccess {Int} data.book_word_count 字数
- * @apiSuccess {Int} data.book_chapter_total 章节数
- * @apiSuccess {Int} data.book_category_id 分类
- * @apiSuccess {String} data.book_category 分类名
- * @apiSuccess {String} data.book_end_status 是否完结
- * @apiSuccess {String} data.book_published_time 发布时间
- * @apiSuccess {String} data.copyright 版权信息
- * @apiSuccess {Int} data.force_subscribe_chapter_id 强制关注的章节数
- * @apiSuccess {String} data.update_time 更新时间
- * @apiSuccess {Int} data.is_on_shelf 是否上架
- * @apiSuccess {String} data.book_price 是否上架
- * @apiSuccess {String} data.recommend_index 推荐指数
- * @apiSuccess {Int} data.charge_type 收费类型
- * @apiSuccess {Int} data.keyword 关键词
- * @apiSuccess {Int} data.is_show_index_content 是否显示推荐指数文本
- * @apiSuccess {Int} data.click_count 点击数
- * @apiSuccess {Int} data.product_id product_id
- * @apiSuccess {Int} data.last_cid 123
- * @apiSuccess {Int} data.last_chapter 第254章 婚礼(大结局)
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * code: 0,
- * msg: "",
- * data: {
- * [
- * {
- * book_id: 5,
- * book_name: "肌缘巧合",
- * book_summary: " 他是权势倾天,纵横商界的王者,却偏偏钟情于她,一宠成瘾。“女人,我要你......只要你能满足我,别墅、游轮、支票,你随便挑。”她羞涩的半低着头:“我只想要你。”他挑眉,“你野心不小啊!”她妩媚一笑,解开他的领带,“难道你不愿意!”他宠她爱她,给她所有想要的。只是有一天她终于忍不住暴走,“靠,你有没有节制呀?我要离婚。”",
- * book_author: "妖火",
- * cover_url: "http://www.leyuee.com/cover/0/8.jpg",
- * book_word_count: 0,
- * book_chapter_total: 0,
- * book_category_id: null,
- * book_category: "爆笑,宠文,潜规则",
- * book_end_status: 8,
- * book_published_time: null,
- * copyright: null,
- * charge_type: null,
- * force_subscribe_chapter_id: 0,
- * update_time: null,
- * is_on_shelf: 1,
- * book_price: null,
- * keyword: "温馨,虐心,清水",
- * recommend_index:2,
- * is_show_index_content:0,
- * click_count:0,
- * product_id:0,
- * last_cid:0,
- * last_chapter:第254章 婚礼(大结局),
- * },
- * ],
- * }
- * }
- */
- public function readOverRecommend(Request $request){
- $bid = $request->input('bid');
- if(empty($bid)){
- return response()->error('PARAM_ERROR');
- }
- $bid = Hashids::decode($bid)[0];
- $book_info = BookConfigService::getBookById($bid);
- $res = BookConfigService::getRecommendBooks($bid,$book_info->category_id);
- return response()->collection(new BookTransformer(),$res);
- }
- /**
- * @apiVersion 1.0.0
- * @apiDescription 排行帮
- * @api {get} books/rank 排行帮
- * @apiParam {Int} type (点击帮:1|字数帮:2|新书榜|3)
- * @apiParam {Int} time (周:1|月:2|总|3)
- * @apiParam {String} [token] token
- * @apiHeader {String} [Authorization] token 两个token任选其一
- * @apiGroup Book
- * @apiName rank
- * @apiSuccess {int} code 状态码
- * @apiSuccess {String} msg 信息
- * @apiSuccess {object} data 结果集
- * @apiSuccess {Array} data 结果数据集
- * @apiSuccess {Int} data.book_id bid
- * @apiSuccess {String} data.book_name 书名
- * @apiSuccess {String} data.book_summary 简介
- * @apiSuccess {String} data.book_author 作者
- * @apiSuccess {String} data.cover_url 封面
- * @apiSuccess {Int} data.book_word_count 字数
- * @apiSuccess {Int} data.book_chapter_total 章节数
- * @apiSuccess {Int} data.book_category_id 分类
- * @apiSuccess {String} data.book_category 分类名
- * @apiSuccess {String} data.book_end_status 是否完结
- * @apiSuccess {String} data.book_published_time 发布时间
- * @apiSuccess {String} data.copyright 版权信息
- * @apiSuccess {Int} data.force_subscribe_chapter_id 强制关注的章节数
- * @apiSuccess {String} data.update_time 更新时间
- * @apiSuccess {Int} data.is_on_shelf 是否上架
- * @apiSuccess {String} data.book_price 是否上架
- * @apiSuccess {String} data.recommend_index 推荐指数
- * @apiSuccess {Int} data.charge_type 收费类型
- * @apiSuccess {Int} data.keyword 关键词
- * @apiSuccess {Int} data.is_show_index_content 是否显示推荐指数文本
- * @apiSuccess {Int} data.click_count 点击数
- * @apiSuccess {Int} data.product_id product_id
- * @apiSuccess {Int} data.last_cid 123
- * @apiSuccess {Int} data.last_chapter 第254章 婚礼(大结局)
- * @apiSuccessExample {json} Success-Response:
- * HTTP/1.1 200 OK
- * {
- * code: 0,
- * msg: "",
- * data: {
- * male:[
- * {
- * book_id: 5,
- * book_name: "肌缘巧合",
- * book_summary: " 他是权势倾天,纵横商界的王者,却偏偏钟情于她,一宠成瘾。“女人,我要你......只要你能满足我,别墅、游轮、支票,你随便挑。”她羞涩的半低着头:“我只想要你。”他挑眉,“你野心不小啊!”她妩媚一笑,解开他的领带,“难道你不愿意!”他宠她爱她,给她所有想要的。只是有一天她终于忍不住暴走,“靠,你有没有节制呀?我要离婚。”",
- * book_author: "妖火",
- * cover_url: "http://www.leyuee.com/cover/0/8.jpg",
- * book_word_count: 0,
- * book_chapter_total: 0,
- * book_category_id: null,
- * book_category: "爆笑,宠文,潜规则",
- * book_end_status: 8,
- * book_published_time: null,
- * copyright: null,
- * charge_type: null,
- * force_subscribe_chapter_id: 0,
- * update_time: null,
- * is_on_shelf: 1,
- * book_price: null,
- * keyword: "温馨,虐心,清水",
- * recommend_index:2,
- * is_show_index_content:0,
- * click_count:0,
- * product_id:0,
- * last_cid:0,
- * last_chapter:第254章 婚礼(大结局),
- * },
- * ],
- * female:[{},{}]
- * }
- * }
- */
- public function rank(Request $request){
- $type = $request->input('type');
- $time = $request->input('time');
- if($type == 1){
- //点击帮
- if($time == 1){
- //周
- $midstr = env('CLICK_RANK_MALE_WEEK','677,694,638,642,641,673,635,639,637,4');
- $fidstr = env('CLICK_RANK_FEMALE_WEEK','614,636,587,48,1,6,354,99,159,355');
- }elseif($time == 2){
- //月
- $midstr = env('CLICK_RANK_MALE_MONTH','757,775,780,612,638,635,694,639,642,693');
- $fidstr = env('CLICK_RANK_FEMALE_MONTH','324,614,6,1,5,10,48,57,41,58');
- }else{
- $midstr = env('CLICK_RANK_MALE_TOTAL','757,775,780,612,634,677,694,638,642,635');
- $fidstr = env('CLICK_RANK_FEMALE_TOTAL','324,614,636,1,5,6,521,10,41,48');
- }
- $female = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$fidstr)));
- $male = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$midstr)));
- }elseif($type == 2){
- //字数帮
- if($time == 1){
- //周
- $midstr = env('WORD_RANK_MALE_WEEK','638,673,635,637,680,642,86,774,764,736');
- $fidstr = env('WORD_RANK_FEMALE_WEEK','48,58,324,354,159,262,7,9,11,525');
- }elseif($time == 2){
- //月
- $midstr = env('WORD_RANK_MALE_MONTH','2,638,642,635,639,4,743,680,736,73');
- $fidstr = env('WORD_RANK_FEMALE_MONTH','1,10,48,58,324,354,159,442,355,464');
- }else{
- $midstr = env('WORD_RANK_MALE_TOTAL','638,677,694,635,612,693,634,642,775,780');
- $fidstr = env('WORD_RANK_FEMALE_TOTAL','57,636,614,1,10,48,58,324,354,99');
- }
- $female = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$fidstr)));
- $male = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$midstr)));
- }
- elseif ($type == 3) {
- //新书榜
- if($time == 1){
- //周
- $midstr = env('NEW_RANK_MALE_WEEK','635,639,4,642,629,446,741,737,731,86');
- $fidstr = env('NEW_RANK_FEMALE_WEEK','135,587,617,625,627,467,213,233,529,357');
- }elseif($time == 2){
- //月
- $midstr = env('NEW_RANK_MALE_MONTH','757,775,780,612,634,677,694,638,642,635');
- $fidstr = env('NEW_RANK_FEMALE_MONTH','33,39,40,51,587,617,625,627,50,60');
- }else{
- $midstr = env('NEW_RANK_MALE_TOTAL','693,641,673,637,4,3,612,634,677,694');
- $fidstr = env('NEW_RANK_FEMALE_TOTAL','284,30,33,39,40,51,587,50,60,357');
- }
- $female = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$fidstr)));
- $male = collectionTransform(new BookTransformer,BookConfigService::getBooksByIds(explode(',',$midstr)));
- }else{
- return response()->error('PARAM_ERROR');
- }
- $data = ['male'=>$male,'female'=>$female];
- return response()->success($data);
- }
- }
|