export function getUserCode(backUrl: string) {
   //此处的ID是在文档的开发-基本配置里面
   const appid = "wx3255043d1b21a4f7";
   window.location.href =
     "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" +
     appid +
     "&redirect_uri=" +
       encodeURIComponent(backUrl) +
     "&response_type=code&scope=snsapi_userinfo&state=bc17befd6d5060f16de95e38f6eaf69c&connect_redirect=1#wechat_redirect";
}

export function checkLoginStatus() {
  const userInfo = localStorage.getItem("YFYC_userInfo");
  if (userInfo) {
    const nowTime = Date.now();
    const data = JSON.parse(userInfo);
    // 超过了6个小时
    if (nowTime - data.time >= 1000 * 60 * 60 * 6) {
      return false
    } else {
      return true
    }
  } else {
    return false
  }
}
