FoxiangCatesService.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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\ArticleCatesModel;
  13. use App\Models\FoxiangCatesModel;
  14. use App\Models\GoodsCatesModel;
  15. /**
  16. * 佛像分类管理-服务类
  17. * @author wesmiler
  18. * @since 2020/11/11
  19. * Class FoxiangCatesService
  20. * @package App\Services
  21. */
  22. class FoxiangCatesService extends BaseService
  23. {
  24. /**
  25. * 构造函数
  26. * @author wesmiler
  27. * @since 2020/11/11
  28. * FoxiangCatesService constructor.
  29. */
  30. public function __construct()
  31. {
  32. $this->model = new FoxiangCatesModel();
  33. }
  34. /**
  35. * 获取列表
  36. * @return array
  37. * @since 2020/11/11
  38. * @author wesmiler
  39. */
  40. public function getList()
  41. {
  42. $params = request()->all();
  43. return parent::getList();
  44. }
  45. /**
  46. * 获取分类选项列表
  47. * @param int $num
  48. * @return array
  49. */
  50. public function getOptions(){
  51. $params = request()->all();
  52. $num = isset($params['num'])? $params['num'] : 0;
  53. $datas = $this->model->where(['status'=> 1])->select(['id','pid','name','status'])->orderBy('sort','desc')->limit($num? $num : 999999)->get();
  54. return message(MESSAGE_OK, true, $datas);
  55. }
  56. /**
  57. * 添加或编辑
  58. * @return array
  59. * @since 2020/11/11
  60. * @author wesmiler
  61. */
  62. public function edit()
  63. {
  64. $data = request()->all();
  65. $data['update_time'] = time();
  66. return parent::edit($data); // TODO: Change the autogenerated stub
  67. }
  68. }