apiConfig.js 592 B

1234567891011121314151617181920212223242526272829
  1. let v = wx.getAccountInfoSync();
  2. let { envVersion } = v.miniProgram;
  3. envVersion = "release";
  4. let apiUrl = `${
  5. envVersion == "release"
  6. ? "https://interface.huihenduo.cc/hhd-ship/"
  7. : "https://interface.huihenduo.com.cn/hhd-ship-dev/"
  8. }`;
  9. function api(url, data, method) {
  10. return new Promise((resolve, reject) => {
  11. wx.request({
  12. url: `${apiUrl}/${url}`,
  13. method,
  14. data,
  15. dataType: "json",
  16. header: {
  17. "content-type": "application/json",
  18. },
  19. success: resolve,
  20. fail: reject,
  21. });
  22. });
  23. }
  24. module.exports = {
  25. apiUrl,
  26. api,
  27. };