BuddhistController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Laravel框架 [ Laravel ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 Laravel研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: wesmiler <12345678@qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Http\Controllers\Api\v1;
  12. use App\Http\Controllers\Api\BaseController;
  13. use App\Services\BuddhistCatesService;
  14. use App\Services\BuddhistPagesService;
  15. use App\Services\BuddhistService;
  16. /**
  17. * 佛经管理-控制器
  18. * @author wesmiler
  19. * @since 2020/11/11
  20. * Class BuddhistController
  21. * @package App\Http\Controllers
  22. */
  23. class BuddhistController extends BaseController
  24. {
  25. /**
  26. * 构造函数
  27. * @author wesmiler
  28. * @since 2020/11/11
  29. * BuddhistController constructor.
  30. */
  31. public function __construct()
  32. {
  33. parent::__construct();
  34. $this->service = new BuddhistService();
  35. $this->cateService = new BuddhistCatesService();
  36. $this->pageService = new BuddhistPagesService();
  37. }
  38. /**
  39. * 书单
  40. * @return array|mixed
  41. */
  42. public function index(){
  43. $params = request()->all();
  44. return $this->service->getDataList($params);
  45. }
  46. /**
  47. * 分类
  48. * @return array
  49. */
  50. public function cates(){
  51. return $this->cateService->getOptions();
  52. }
  53. /**
  54. * 列表
  55. * @return array
  56. */
  57. public function relaction(){
  58. $params = request()->all();
  59. return $this->service->getRelactionList($params);
  60. }
  61. /**
  62. *
  63. */
  64. public function detail(){
  65. $id = request()->get('id',0);
  66. if($id<=0){
  67. return message(1006, false);
  68. }
  69. return $this->service->getDetail($id);
  70. }
  71. /**
  72. * 获取章节内容
  73. */
  74. public function page(){
  75. $id = request()->get('id', 0);
  76. $bid = request()->get('bid', 0);
  77. $this->service->updateVisit($this->userId);
  78. return $this->pageService->getDetail($bid, $id);
  79. }
  80. }