user.ts 734 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Request, Response } from 'express';
  2. /**
  3. * @author bianlanzhou
  4. * @since 2024-10-21
  5. * @desc 用户
  6. */
  7. /** 等待时间 */
  8. const waitTime = (time: number = 100) => {
  9. return new Promise((resolve) => {
  10. setTimeout(() => {
  11. resolve(true);
  12. }, time);
  13. });
  14. };
  15. /** 查询用户响应数据 */
  16. const queryUserRespData = {
  17. "success": true,
  18. "errCode": null,
  19. "errMessage": null,
  20. "data": [
  21. {
  22. "id": "10000",
  23. "deptId": "10001",
  24. "username": "admin",
  25. "status": "ok"
  26. }
  27. ]
  28. }
  29. /** 查询用户 */
  30. const handleQueryUser = async (req: Request, res: Response) => {
  31. await waitTime(2000);
  32. res.json(queryUserRespData);
  33. }
  34. export default {
  35. 'GET /system/user/list': handleQueryUser,
  36. };