User.Class.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * 用户管理Controller
  4. * Created by PhpStorm.
  5. * User: 小威
  6. * Date: 2020/03/28
  7. * Time: 14:59
  8. */
  9. namespace JinDouYun\Controller\Manage;
  10. use Mall\Framework\Core\ErrorCode;
  11. use Mall\Framework\Core\StatusCode;
  12. use JinDouYun\Controller\BaseController;
  13. use JinDouYun\Model\Manage\MUser;
  14. class User extends BaseController
  15. {
  16. private $objMUser;
  17. public function __construct($isCheckAcl = false, $isMustLogin = false, $checkToken = false)
  18. {
  19. parent::__construct($isCheckAcl, $isMustLogin, $checkToken);
  20. $this->objMUser = new MUser();
  21. }
  22. /**
  23. * 获取用户列表
  24. * @throws \Exception
  25. */
  26. public function getAllUser()
  27. {
  28. $params = $this->request->getRawJson();
  29. $data = [
  30. 'page' => isset($params['page']) ? $params['page'] : 1,
  31. 'pageSize' => isset($params['pageSize']) ? $params['pageSize'] : 10,
  32. ];
  33. $selectParams = [
  34. 'offset' => ($data['page'] - 1) * $data['pageSize'],
  35. 'limit' => $data['pageSize'],
  36. ];
  37. $result = $this->objMUser->getAllUser($selectParams);
  38. if ($result->isSuccess()) {
  39. parent::sendOutput($result->getData());
  40. } else {
  41. parent::sendOutput($result->getData(), ErrorCode::$dberror);
  42. }
  43. }
  44. }