CenterController.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace addons\OperationCenter\backend\controllers;
  3. use addons\OperationCenter\common\services\CenterService;
  4. /**
  5. * 运营中心控制器
  6. *
  7. * Class CenterController
  8. * @package addons\OperationCenter\backend\controllers
  9. */
  10. class CenterController extends BaseController
  11. {
  12. /**
  13. * @var CenterService
  14. */
  15. protected $service;
  16. public function init()
  17. {
  18. parent::init();
  19. $this->service = new CenterService(['mall_id' => $this->mall_id]);
  20. }
  21. /**
  22. * 首页
  23. *
  24. * @return string
  25. */
  26. public function actionIndex()
  27. {
  28. if ($this->request->isAjax) {
  29. $params = $this->request->get();
  30. return $this->success('ok', $this->service->getPageList($params));
  31. }
  32. return $this->render($this->action->id);
  33. }
  34. /**
  35. * 删除
  36. *
  37. * @return string
  38. */
  39. public function actionDelUser()
  40. {
  41. $id = $this->request->get('id', 0);
  42. return $this->service->delUser($id)
  43. ? $this->success('ok')
  44. : $this->error($this->service->getError());
  45. }
  46. }