EnshrineController.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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\Services\EnshrineNoticeService;
  6. use App\Services\EnshrineService;
  7. use Illuminate\Http\Request;
  8. /**
  9. * 供奉控制器类
  10. * @author wesmiler
  11. * @since 2020/11/10
  12. * Class EnshrineController
  13. * @package App\Http\Controllers
  14. */
  15. class EnshrineController extends BaseController
  16. {
  17. /**
  18. * 构造函数
  19. * @author wesmiler
  20. * @since 2020/11/11
  21. * EnshrineController constructor.
  22. */
  23. public function __construct()
  24. {
  25. parent::__construct();
  26. $this->service = new EnshrineService();
  27. $this->noticeService = new EnshrineNoticeService();
  28. }
  29. /**
  30. * 供奉记录
  31. * @return array
  32. */
  33. public function index(){
  34. return $this->service->getDataList($this->userId);
  35. }
  36. /**
  37. * 供奉物品
  38. * @return array
  39. */
  40. public function goods(){
  41. return $this->service->goods();
  42. }
  43. /**
  44. * 选择佛像
  45. * @return mixed
  46. */
  47. public function select(){
  48. return $this->service->select($this->userId);
  49. }
  50. /**
  51. * 送圣
  52. * @return array
  53. */
  54. public function packoff(){
  55. return $this->service->packoff($this->userId);
  56. }
  57. /**
  58. * 保存供奉操作记录
  59. * @return array
  60. */
  61. public function actionRecord(){
  62. return $this->service->actionRecord($this->userId);
  63. }
  64. /**
  65. * 供奉操作记录
  66. * @return array
  67. */
  68. public function xinyuan(){
  69. return $this->service->actionList($this->userId);
  70. }
  71. /**
  72. * 供奉操作记录处理
  73. * @return array
  74. */
  75. public function catchXuyuan(){
  76. return $this->service->catchXuyuan($this->userId);
  77. }
  78. /**
  79. * 购买物品
  80. * @return array
  81. */
  82. public function buy(){
  83. return $this->service->buy($this->userId);
  84. }
  85. /**
  86. * 发布忏悔/回向记录
  87. * @return mixed
  88. */
  89. public function noticePublish(Request $request, EnshrineNoticeValidator $validator){
  90. $params = $validator->check($request->all(),'publish');
  91. if(!is_array($params)){
  92. return message($params, false);
  93. }
  94. return $this->noticeService->publish($this->userId);
  95. }
  96. /**
  97. * 忏悔回向记录
  98. * @return mixed
  99. */
  100. public function notice(){
  101. return $this->noticeService->getDataList();
  102. }
  103. /**
  104. * 忏悔回向记录删除
  105. * @return mixed
  106. */
  107. public function noticeDel(){
  108. return $this->noticeService->del($this->userId);
  109. }
  110. }