api.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // 获取入住记录
  2. export const getCheckinInfo = (hotelId) => {
  3. return new Promise((resolve, reject) => {
  4. uni.request({
  5. url: `/user/checkinInfo/${hotelId}`,
  6. method: "GET",
  7. success: (res) => {
  8. // console.log("获取入住记录结果", res)
  9. resolve(res.data)
  10. },
  11. fail: (err) => {
  12. console.log("获取入住记录失败", err)
  13. reject(res)
  14. }
  15. })
  16. })
  17. }
  18. export const getOpenDoorInfo = (data) => {
  19. return new Promise((resolve, reject) => {
  20. uni.request({
  21. url: `/user/openDoorInfo`,
  22. method: "POST",
  23. data: data,
  24. success: (res) => {
  25. // console.log("获取门锁信息", res)
  26. resolve(res.data)
  27. },
  28. fail: (err) => {
  29. console.log("获取门锁信息失败", err)
  30. reject(res)
  31. }
  32. })
  33. })
  34. }
  35. export const unloadBLEOpenDoorLog = (data) => {
  36. return new Promise((resolve, reject) => {
  37. uni.request({
  38. url: `/user/bleOpLogs`,
  39. method: "POST",
  40. data: data,
  41. success: (res) => {
  42. // console.log("上传蓝牙开门记录", res)
  43. resolve(res.data)
  44. },
  45. fail: (err) => {
  46. console.log("上传蓝牙开门记录失败", err)
  47. reject(res)
  48. }
  49. })
  50. })
  51. }
  52. export const getElevatorQRCode = (data) => {
  53. return new Promise((resolve, reject) => {
  54. uni.request({
  55. url: `/user/qrCode`,
  56. method: "POST",
  57. data: data,
  58. success: (res) => {
  59. // console.log("获取梯控二维码", res)
  60. resolve(res.data)
  61. },
  62. fail: (err) => {
  63. console.log("获取梯控二维码失败", err)
  64. reject(res)
  65. }
  66. })
  67. })
  68. }
  69. export const moveElevator = (deviceId, floor) => {
  70. return new Promise((resolve, reject) => {
  71. uni.request({
  72. url: `/user/elevator/${deviceId}/${floor}`,
  73. method: "POST",
  74. success: (res) => {
  75. // console.log("获取梯控二维码", res)
  76. resolve(res.data)
  77. },
  78. fail: (err) => {
  79. console.log("获取梯控二维码失败", err)
  80. reject(res)
  81. }
  82. })
  83. })
  84. }