BuddhistPagesService.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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\Services;
  12. use App\Models\BuddhistPagesModel;
  13. /**
  14. * 佛经章节管理-服务类
  15. * @author wesmiler
  16. * @since 2020/11/11
  17. * Class BuddhistPagesService
  18. * @package App\Services
  19. */
  20. class BuddhistPagesService extends BaseService
  21. {
  22. protected static $instance = null;
  23. /**
  24. * 构造函数
  25. * @author wesmiler
  26. * @since 2020/11/11
  27. * BuddhistPagesService constructor.
  28. */
  29. public function __construct()
  30. {
  31. $this->model = new BuddhistPagesModel();
  32. }
  33. /**
  34. * 静态入口
  35. * @return BuddhistPagesService|null
  36. */
  37. public static function make(){
  38. if(!self::$instance){
  39. self::$instance = new BuddhistPagesService();
  40. }
  41. return self::$instance;
  42. }
  43. /**
  44. * 获取列表
  45. * @return array
  46. * @since 2020/11/11
  47. * @author wesmiler
  48. */
  49. public function getList()
  50. {
  51. $params = request()->all();
  52. return parent::getList();
  53. }
  54. /**
  55. * 添加或编辑
  56. * @return array
  57. * @since 2020/11/11
  58. * @author wesmiler
  59. */
  60. public function edit()
  61. {
  62. $data = request()->all();
  63. $data['update_time'] = time();
  64. return parent::edit($data); // TODO: Change the autogenerated stub
  65. }
  66. /**
  67. * 获取章节数量
  68. * @param $id
  69. * @return mixed
  70. */
  71. public function getCount($id){
  72. return $this->model::where(['bid'=> $id,'status'=> 1])->count('id');
  73. }
  74. }