genKeys.js 869 B

1234567891011121314151617181920212223242526272829303132333435
  1. const app = getApp();
  2. const appConfig = require("../config");
  3. const utils = require("../utils/util");
  4. var genKeys = function(that){
  5. var header = {
  6. 'content-type': 'application/x-www-form-urlencoded',
  7. 'cookie': wx.getStorageSync(appConfig.storeKeys.sessionId)
  8. };
  9. wx.showLoading({
  10. title: '正在拉取数据',
  11. });
  12. wx.request({
  13. url: utils.getUrl("requestSslKey"),
  14. header : header,
  15. dataType : 'json',
  16. success : function(res){
  17. wx.hideLoading();
  18. if(res.data.code > 0) {
  19. wx.showToast({
  20. title: res.data.msg || "获取公私钥失败",
  21. duration:appConfig.duration
  22. });
  23. return;
  24. }
  25. app.sslKeyRequestSync(res.data);
  26. },
  27. fail: function(){
  28. app.sslKeyRequestSync(appConfig.networkError);
  29. wx.hideLoading();
  30. }
  31. })
  32. }
  33. module.exports = genKeys