redPacket.js 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. let base_url = 'https://denettestapi.piaoquantv.com/denet'
  2. // 获取红包任务详情
  3. export function getPostDetail() {
  4. return new Promise(function (resolve, reject) {
  5. let _url = `${base_url}/post/getDetail`
  6. fetch(_url, {
  7. method: 'POST', // or 'PUT'
  8. headers: {
  9. 'Content-Type': 'application/json',
  10. },
  11. body: JSON.stringify({
  12. "baseInfo": {
  13. "appVersionCode": 0,
  14. "clientTimestamp": 0,
  15. "loginUid": 0,
  16. "requestId": "string",
  17. "token": "string"
  18. },
  19. "params": {
  20. "postId": "05b2f99bbcfa461db3b053df61ca7ae5"
  21. }
  22. }),
  23. })
  24. .then(response => response.json())
  25. .then(data => {
  26. resolve(data);
  27. })
  28. .catch((error) => {
  29. reject(error);
  30. });
  31. })
  32. }
  33. // 领取红包任务
  34. export function getRedPacket() {
  35. return new Promise(function (resolve, reject) {
  36. let _url = `${base_url}/post/luckdrop/receiveLuckdrop`
  37. fetch(_url, {
  38. method: 'POST', // or 'PUT'
  39. headers: {
  40. 'Content-Type': 'application/json',
  41. },
  42. body: JSON.stringify({
  43. "baseInfo": {
  44. "appVersionCode": 0,
  45. "clientTimestamp": 0,
  46. "loginUid": 0,
  47. "requestId": "string",
  48. "token": "d2ef1b74d4dec5338938a58b7fe783360612b8a5"
  49. },
  50. "params": {
  51. "postId": "05b2f99bbcfa461db3b053df61ca7ae5"
  52. }
  53. }),
  54. })
  55. .then(response => response.json())
  56. .then(data => {
  57. resolve(data);
  58. })
  59. .catch((error) => {
  60. reject(error);
  61. });
  62. })
  63. }
  64. // 完成红包任务
  65. export function finishRedPacket() {
  66. return new Promise(function (resolve, reject) {
  67. let _url = `${base_url}/post/luckdrop/finishLuckdrop`
  68. fetch(_url, {
  69. method: 'POST', // or 'PUT'
  70. headers: {
  71. 'Content-Type': 'application/json',
  72. },
  73. body: JSON.stringify({
  74. "baseInfo": {
  75. "appVersionCode": 0,
  76. "clientTimestamp": 0,
  77. "loginUid": 0,
  78. "requestId": "string",
  79. "token": "string"
  80. },
  81. "params": {
  82. "postId": "05b2f99bbcfa461db3b053df61ca7ae5"
  83. }
  84. }),
  85. })
  86. .then(response => response.json())
  87. .then(data => {
  88. resolve(data);
  89. })
  90. .catch((error) => {
  91. reject(error);
  92. });
  93. })
  94. }