1
0

HomeServiceController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\lists\HomeServiceLists;
  4. use app\api\lists\HomeSpecialLists;
  5. use app\api\logic\HomeSpecialLogic;
  6. use app\api\validate\HomeSpecialValidate;
  7. use app\common\model\home_service\HomeSpecial;
  8. class HomeServiceController extends BaseApiController
  9. {
  10. public array $notNeedLogin = ['lists','specialHot','specialLists','specialDetail'];
  11. public function lists()
  12. {
  13. return $this->dataLists(new HomeServiceLists());
  14. }
  15. public function specialHot()
  16. {
  17. //活动专题页:special_type = 0
  18. $result['special_type_0'] = [
  19. 'title'=>'活动专题',
  20. 'special_type'=>0,
  21. 'status'=>1,
  22. 'data'=>HomeSpecialLogic::getLists(['special_type'=>0,'status'=>1],6,$this->userInfo,$this->request->domain())
  23. ];
  24. //热销服务:special_type = 1
  25. $result['special_type_1'] = [
  26. 'title'=>'热销服务',
  27. 'special_type'=>1,
  28. 'status'=>1,
  29. 'data'=>HomeSpecialLogic::getLists(['special_type'=>1,'status'=>1],6,$this->userInfo,$this->request->domain())
  30. ];
  31. //当季精选:special_type = 2
  32. $result['special_type_2'] = [
  33. 'title'=>'当季精选',
  34. 'special_type'=>2,
  35. 'status'=>1,
  36. 'data'=>HomeSpecialLogic::getLists(['special_type'=>2,'status'=>1],6,$this->userInfo,$this->request->domain())
  37. ];
  38. return $this->data($result);
  39. }
  40. public function specialLists()
  41. {
  42. return $this->dataLists(new HomeSpecialLists());
  43. }
  44. public function specialDetail()
  45. {
  46. $params = (new HomeSpecialValidate())->goCheck('detail');
  47. $result = HomeSpecialLogic::detail($params);
  48. return $this->data($result);
  49. }
  50. }