GongdengController.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. namespace App\Http\Controllers\Api\v1;
  3. use App\Http\Controllers\Api\BaseController;
  4. use App\Http\Validator\GongdengValidator;
  5. use App\Services\DevicesService;
  6. use App\Services\GongdengOrderService;
  7. use App\Services\GongdengFoxiangService;
  8. use App\Services\LampMealsService;
  9. /**
  10. * 供灯控制器类
  11. * @author wesmiler
  12. * @since 2020/11/10
  13. * Class GongdengController
  14. * @package App\Http\Controllers
  15. */
  16. class GongdengController extends BaseController
  17. {
  18. /**
  19. * 构造函数
  20. * @author wesmiler
  21. * @since 2020/11/11
  22. * GongdengController constructor.
  23. */
  24. public function __construct()
  25. {
  26. parent::__construct();
  27. $this->service = new GongdengOrderService();
  28. $this->fxService = new GongdengFoxiangService();
  29. $this->mealService = new LampMealsService();
  30. $this->deviceService = new DevicesService();
  31. }
  32. /**
  33. * 套餐列表
  34. * @return mixed
  35. */
  36. public function index(){
  37. return $this->service->getMyGdList($this->userId);
  38. }
  39. /**
  40. * 佛像列表
  41. * @return mixed
  42. */
  43. public function fxInfo(){
  44. return $this->fxService->info();
  45. }
  46. /**
  47. * 佛像列表
  48. * @return mixed
  49. */
  50. public function fxList(){
  51. return $this->fxService->getDataList();
  52. }
  53. /**
  54. * 套餐列表
  55. * @return mixed
  56. */
  57. public function mealList(){
  58. return $this->mealService->getDataList();
  59. }
  60. /**
  61. * 功德榜记录
  62. * @return mixed
  63. */
  64. public function gdList(){
  65. return $this->service->getGdList();
  66. }
  67. /**
  68. * 供灯下单
  69. * @return mixed
  70. */
  71. public function buy(GongdengValidator $validator){
  72. $params = $validator->check(request()->all(),'buy');
  73. if(!is_array($params)){
  74. return message($params, false);
  75. }
  76. return $this->service->buy($this->userId);
  77. }
  78. /**
  79. * 供灯拍照图片
  80. * @return array
  81. */
  82. public function picList(){
  83. return $this->deviceService->getPicList();
  84. }
  85. }