码农potato' 2022-04-29 22:15 采纳率: 100%
浏览 113
已结题

求微信小程序与PHP服务器交互专家,修改交互的逻辑

小学徒技术有限,3年前开发的小程序,由于官方升级更新后以前的授权连接方式变化了。现在可以开发工具实现交互,上真机就不行。现在报错cookie的get_sessionid有错误。报渲染层错误。
[渲染层网络层错误] Failed to load font http://at.alicdn.com/t/font_409135_swxls4dlirjp2e29.ttf
net::ERR_CACHE_MISS
(env: Windows,mp,1.05.2204180; lib: 2.14.0)

function e() {
var e = new Date();
e.setHours(0), e.setMinutes(0), e.setSeconds(0), e.setMilliseconds(0), e = e.getTime() / 1e3;
var t = "", a = {};
return t = o.default.hexMD5(e + n.fixStr), a.sign = t, a;
}

function t(e) {
    var t = new Date();
    t.setHours(0), t.setMinutes(0), t.setSeconds(0), t.setMilliseconds(0), t = t.getTime() / 1e3;
    var a = "", r = {};
    return "" == e.param ? a = o.default.hexMD5(t + n.fixStr) : (a = o.default.hexMD5(e.path.split("Api/")[1] + t + n.fixStr), 
    r = e.param), r.sign = a, r;
}

var o = function(e) {
    return e && e.__esModule ? e : {
        default: e
    };
}(require("./md5.js")), n = {
    url: "https://www.rieasen.com/",
    fixStr: "luoluo415dsfd328fdf9843rgdyfu7ytfhb383"
};

export function request(o, a, r, i) {
  var s = wx.getStorageSync("PHPSESSID"), l = this;
  if (s) {
    if ("" != (s = "string" == typeof s ? s : s[0]) && null != s)
      u = {
        "content-type": "application/x-www-form-urlencoded",
        Cookie: s
      }; else
      var u = {
        "content-type": "application/x-www-form-urlencoded"
      };
    this.methodStr = i || "POST", this.path = o || "", this.param = a || "", wx.request({
      url: n.url + this.path,
      data: t(this),
      header: u,
      method: this.methodStr.toUpperCase() || "POST",
      dataType: "json",
      success: function (e) {
        "" != s && null != s || !e.header || s || wx.setStorageSync("PHPSESSID", e.header["Set-Cookie"]),
          r && "function" == typeof r && r(e);
      },
      fail: function (e) {
        console.log("err");
      },
      complete: function (e) { }
    });
  } else
    wx.request({
      url: n.url + "Api/Index/get_sessionid",
      data: e(),
      header: {
        "content-type": "application/x-www-form-urlencoded"
      },
      method: "POST",
      dataType: "json",
      success: function (e) {
        if (1 == e.data.code && (s = "PHPSESSID=" + e.data.data.sid + "; path=/", wx.setStorageSync("PHPSESSID", s)),
          "" != s && null != s)
          u = {
            "content-type": "application/x-www-form-urlencoded",
            Cookie: s
          }; else
          var u = {
            "content-type": "application/x-www-form-urlencoded"
          };
        l.methodStr = i || "POST", l.path = o || "", l.param = a || "", wx.request({
          url: n.url + l.path,
          
          data: t(l),
          header: u,
          method: l.methodStr.toUpperCase() || "POST",
          dataType: "json",
          success: function (e) {
            "" != s && null != s || !e.header || s || wx.setStorageSync("PHPSESSID", e.header["Set-Cookie"]),
              r && "function" == typeof r && r(e);
          },
          fail: function (e) {
            console.log("err");
          },
          complete: function (e) { }
        });
      },
      fail: function (e) {
        console.log("err");
      },
      complete: function (e) { }
    });
}
export function upload(e, o, a, r) {
  var i = wx.getStorageSync("PHPSESSID");
  if ("" != i && null != i)
    s = {
      "Content-Type": "multipart/form-data",
      Cookie: i
    }; else
    var s = {
      "Content-Type": "multipart/form-data"
    };
  this.path = e || "", this.param = a || "", wx.uploadFile({
    url: n.url + this.path,
    filePath: o,
    name: "photos",
    header: s,
    formData: t(this),
    success: function (e) {
      "" != i && null != i || !e.header || i || wx.setStorageSync("PHPSESSID", e.header["Set-Cookie"]),
        r && "function" == typeof r && r(e);
    },
    fail: function (e) {
      console.log(e);
    },
    complete: function (e) { }
  });
}

img

试过换其它方法但是技术不到位。
请专家帮忙修改

需要实现真机调试正常。

  • 写回答

8条回答 默认 最新

  • web修理工 2022-04-30 10:52
    关注

    1.更新你的微信开发工具到比较新的版本
    2.使用真机调试 查看报错日志
    3.定位问题 修改代码 调试

    如果可以的话 我可以给你在线修改

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(7条)

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 5月9日
  • 已采纳回答 5月2日
  • 赞助了问题酬金100元 4月29日
  • 创建了问题 4月29日

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)