ReviewController.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace addons\OperationCenter\backend\controllers;
  3. use addons\OperationCenter\common\services\ReviewService;
  4. /**
  5. * 审核控制器
  6. *
  7. * Class ReviewController
  8. * @package addons\OperationCenter\backend\controllers
  9. */
  10. class ReviewController extends BaseController
  11. {
  12. /**
  13. * @var boolean
  14. */
  15. public $enableCsrfValidation = false;
  16. /**
  17. * @var ReviewService
  18. */
  19. protected $service;
  20. public function init()
  21. {
  22. parent::init();
  23. $this->service = new ReviewService(['mall_id' => $this->mall_id]);
  24. }
  25. /**
  26. * 首页
  27. *
  28. * @return string
  29. */
  30. public function actionIndex()
  31. {
  32. if ($this->request->isAjax) {
  33. $params = $this->request->get();
  34. return $this->success('ok', $this->service->getPageList($params));
  35. }
  36. return $this->render($this->action->id);
  37. }
  38. /**
  39. * 通过
  40. *
  41. * @return string
  42. */
  43. public function actionPass()
  44. {
  45. $id = $this->request->get('id');
  46. $level_id = $this->request->post('level');
  47. return $this->service->pass($id, $level_id)
  48. ? $this->success('ok')
  49. : $this->error($this->service->getError());
  50. }
  51. /**
  52. * 驳回
  53. *
  54. * @return string
  55. */
  56. public function actionReject()
  57. {
  58. $id = $this->request->get('id');
  59. $content = $this->request->post('content');
  60. return $this->service->reject($id, $content)
  61. ? $this->success('ok')
  62. : $this->error($this->service->getError());
  63. }
  64. }