IndexController.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace App\Http\Controllers\Api;
  3. use App\Helpers\Jwt;
  4. use App\Http\Validator\MemberValidator;
  5. use App\Services\Api\AdService;
  6. use App\Services\Api\MemberService;
  7. use App\Services\EmailService;
  8. use App\Services\RedisService;
  9. use App\Services\SmsService;
  10. /**
  11. * 会员控制器基类
  12. * Class IndexController
  13. * @package App\Http\Controllers
  14. */
  15. class IndexController extends webApp
  16. {
  17. /**
  18. * IndexController constructor.
  19. */
  20. public function __construct()
  21. {
  22. }
  23. /**
  24. * 首页数据
  25. * @return array
  26. */
  27. public function index(int $userId=0)
  28. {
  29. // 广告幻灯片
  30. $banners = [
  31. 'top'=> AdService::make()->getList(1, 6),
  32. 'middle'=> AdService::make()->getList(2, 1),
  33. ];
  34. // 交易参数
  35. $trade = [
  36. 'price'=> rand(5, 10)+(rand(10,50)/100),
  37. 'total'=> rand(100000,999999)+(rand(10,50)/100),
  38. 'count'=> rand(1000,9999),
  39. 'rate'=> rand(10,90)+(rand(10,50)/100),
  40. ];
  41. $notices = [];
  42. return message(1010, true, compact('banners','trade','notices'));
  43. }
  44. }