IndexController.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Http\Controllers\Api\v1;
  3. use App\Http\Controllers\Api\webApp;
  4. use App\Services\Common\AdService;
  5. use App\Services\Common\NoticeService;
  6. use App\Services\ConfigService;
  7. /**
  8. * 测试
  9. * Class TestController
  10. * @package App\Http\Controllers\Api
  11. */
  12. class IndexController extends webApp
  13. {
  14. /**
  15. * 首页数据
  16. * @return array
  17. */
  18. public function data()
  19. {
  20. $ads = AdService::make()->getListByPosition(3,1);
  21. $data = [
  22. 'banners'=> AdService::make()->getListByPosition(1),
  23. 'menus'=> AdService::make()->getListByPosition(2,2),
  24. 'notices'=> NoticeService::make()->getRecommandList(6),
  25. 'ad'=> isset($ads[0])? $ads[0] : [],
  26. ];
  27. return message(1010, true, $data);
  28. }
  29. /**
  30. * 配置
  31. * @return array
  32. */
  33. public function config()
  34. {
  35. $data = [
  36. 'app_download_url'=> ConfigService::make()->getConfigByCode('app_download_url'),
  37. ];
  38. return message(1010, true, $data);
  39. }
  40. }