EnshrineController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <?php
  2. namespace App\Http\Controllers\Api\v1;
  3. use App\Http\Controllers\Api\BaseController;
  4. use App\Http\Validator\EnshrineNoticeValidator;
  5. use App\Http\Validator\EnshrineValidator;
  6. use App\Services\EnshrineNoticeService;
  7. use App\Services\EnshrineService;
  8. use App\Services\MotionService;
  9. use Illuminate\Http\Request;
  10. /**
  11. * 供奉控制器类
  12. * @author wesmiler
  13. * @since 2020/11/10
  14. * Class EnshrineController
  15. * @package App\Http\Controllers
  16. */
  17. class EnshrineController extends BaseController
  18. {
  19. /**
  20. * 构造函数
  21. * @author wesmiler
  22. * @since 2020/11/11
  23. * EnshrineController constructor.
  24. */
  25. public function __construct()
  26. {
  27. parent::__construct();
  28. $this->service = new EnshrineService();
  29. $this->noticeService = new EnshrineNoticeService();
  30. $this->motionService = new MotionService();
  31. }
  32. /**
  33. * 供奉记录
  34. * @return array
  35. */
  36. public function index(){
  37. return $this->service->getDataList($this->userId);
  38. }
  39. /**
  40. * 供奉物品
  41. * @return array
  42. */
  43. public function goods(){
  44. return $this->service->goods();
  45. }
  46. /**
  47. * 选择佛像
  48. * @return mixed
  49. */
  50. public function select(){
  51. return $this->service->select($this->userId);
  52. }
  53. /**
  54. * 送圣
  55. * @return array
  56. */
  57. public function packoff(){
  58. return $this->service->packoff($this->userId);
  59. }
  60. /**
  61. * 超度牌位
  62. * @return mixed
  63. */
  64. public function chaodu(Request $request, EnshrineValidator $validator){
  65. $params = $validator->check($request->all(),'chaodu');
  66. if(!is_array($params)){
  67. return message($params, false);
  68. }
  69. return $this->service->chaodu($this->userId);
  70. }
  71. /**
  72. * 保存供奉操作记录
  73. * @return array
  74. */
  75. public function actionRecord(){
  76. return $this->service->actionRecord($this->userId);
  77. }
  78. /**
  79. * 供奉操作记录
  80. * @return array
  81. */
  82. public function xinyuan(){
  83. return $this->service->actionList($this->userId);
  84. }
  85. /**
  86. * 供奉操作记录处理
  87. * @return array
  88. */
  89. public function catchXuyuan(){
  90. return $this->service->catchXuyuan($this->userId);
  91. }
  92. /**
  93. * 购买物品
  94. * @return array
  95. */
  96. public function buy(){
  97. return $this->service->buy($this->userId);
  98. }
  99. /**
  100. * 贡品购买记录
  101. * @return array
  102. */
  103. public function orderList(){
  104. return $this->service->orderList($this->userId);
  105. }
  106. /**
  107. * 发布忏悔/回向记录
  108. * @return mixed
  109. */
  110. public function noticePublish(Request $request, EnshrineNoticeValidator $validator){
  111. $params = $validator->check($request->all(),'publish');
  112. if(!is_array($params)){
  113. return message($params, false);
  114. }
  115. return $this->noticeService->publish($this->userId);
  116. }
  117. /**
  118. * 忏悔回向记录
  119. * @return mixed
  120. */
  121. public function notice(){
  122. return $this->noticeService->getDataList($this->userId);
  123. }
  124. /**
  125. * 忏悔回向记录删除
  126. * @return mixed
  127. */
  128. public function noticeDel(){
  129. return $this->noticeService->del($this->userId);
  130. }
  131. /**
  132. * 念佛记录
  133. * @return array
  134. */
  135. public function motion(){
  136. return $this->motionService->save($this->userId);
  137. }
  138. /**
  139. * 念佛统计
  140. * @return array
  141. */
  142. public function motionCount(){
  143. return $this->motionService->counts($this->userId);
  144. }
  145. }