Index.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use app\common\model\Feedback;
  5. use app\api\validate\Feedback as FeedbackValidate;
  6. use app\common\Service\Pay\PayOperService;
  7. /**
  8. * 首页接口
  9. */
  10. class Index extends Api
  11. {
  12. protected $noNeedLogin = ['index'];
  13. protected $noNeedRight = ['*'];
  14. /**
  15. * 首页
  16. *
  17. */
  18. public function index()
  19. {
  20. // $result = PayOperService::settle('20250628031925000000028802', '0.05','czdcd');
  21. // echo "<pre>";
  22. // print_r($result);
  23. // echo "</pre>";
  24. // exit;
  25. $this->success(__('User Center'));
  26. }
  27. public function feedback()
  28. {
  29. $user = $this->auth->getUser();
  30. $params = $this->request->only(['type', 'content', 'images', 'phone']);
  31. // 使用验证器
  32. $validate = new FeedbackValidate();
  33. if (!$validate->check($params)) {
  34. $this->error($validate->getError());
  35. }
  36. if ($user) {
  37. $params['user_id'] = $user->id;
  38. }
  39. $result = Feedback::create($params);
  40. if ($result) {
  41. $this->success('感谢您的反馈');
  42. }
  43. }
  44. }