HomeSpecialLogic.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. namespace app\api\logic;
  3. use app\common\model\home_service\HomeSpecial;
  4. use app\common\logic\BaseLogic;
  5. use think\facade\Db;
  6. /**
  7. * HomeSpecial逻辑
  8. * Class HomeSpecialLogic
  9. * @package app\api\logic\home_service
  10. */
  11. class HomeSpecialLogic extends BaseLogic
  12. {
  13. /**
  14. * @param array $where
  15. * @param int $limit
  16. * @return array
  17. * @throws \think\db\exception\DataNotFoundException
  18. * @throws \think\db\exception\DbException
  19. * @throws \think\db\exception\ModelNotFoundException
  20. */
  21. public static function getLists(array $where, int $limit=6)
  22. {
  23. return HomeSpecial::where($where)
  24. ->field('id,cover_type,cover,title,vue_web,vue_param')
  25. ->order('weight desc')
  26. ->limit($limit)
  27. ->select()
  28. ->toArray();
  29. }
  30. /**
  31. * @notes 获取详情
  32. * @param $params
  33. * @return array
  34. * @author likeadmin
  35. * @date 2024/11/18 10:05
  36. */
  37. public static function detail($params): array
  38. {
  39. return HomeSpecial::field('cover_type,cover,title,describe,content')->findOrEmpty($params['id'])->toArray();
  40. }
  41. }