Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加qq二维码登录功能 #200

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yunxiangjun
Copy link

No description provided.

Copy link

vercel bot commented Jun 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
qq ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 25, 2024 2:55pm

@qheartq616
Copy link

有示例网站吗 我想试下看看

@59799517
Copy link

_ No description provided. _

代码跑不起来
image
看的修一下把

�[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)�[39m
�[90m at Module._compile (internal/modules/cjs/loader.js:1137:30)�[39m at Object. (/home/qqmusic/app.js:12:17)
�[90m at require (internal/modules/cjs/helpers.js:72:18)�[39m
�[90m at Module.require (internal/modules/cjs/loader.js:1025:19)�[39m
�[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)�[39m
SyntaxError: Unexpected token '.'

最主要应该是这里
obj.headers.Cookie = opts?.customCookie && obj.headers.Cookie || Object.keys(cookieObj).map((k) => ${k}=${encodeURI(cookieObj[k])}).join('; ');

@yunxiangjun
Copy link
Author

_ No description provided. _

代码跑不起来 image 看的修一下把

�[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)�[39m �[90m at Module._compile (internal/modules/cjs/loader.js:1137:30)�[39m at Object. (/home/qqmusic/app.js:12:17) �[90m at require (internal/modules/cjs/helpers.js:72:18)�[39m �[90m at Module.require (internal/modules/cjs/loader.js:1025:19)�[39m �[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)�[39m SyntaxError: Unexpected token '.'

最主要应该是这里 obj.headers.Cookie = opts?.customCookie && obj.headers.Cookie || Object.keys(cookieObj).map((k) => ${k}=${encodeURI(cookieObj[k])}).join('; ');

可能是你的node版本不兼容?.运算,我已经将代码中的?.删除了,但可能其它地方也会报类似的错误

@yunxiangjun
Copy link
Author

有示例网站吗 我想试下看看

没有,可以在项目启动后在控制台调试

const getPic = () => {
  const url = `/user/getLoginQr/qq`
  fetch(url).then(res => res.json()).then(data => {
    console.log(data.img)
    console.log(data.ptqrtoken)
    console.log(data.qrsig)
  })
}

const checkLogin = (ptqrtoken, qrsig) => {
  fetch('/user/checkLoginQr/qq', {
    method: 'POST',
    headers: { 
      'Content-Type': 'application/json'
    }, 
    body: JSON.stringify({ 
      ptqrtoken,
      qrsig
    })
  }).then(res => res.json()).then(data => {
    console.log(data)
  })
}

@jsososo
Copy link
Owner

jsososo commented Jun 26, 2024

非常感谢,试了一下整个链路没有问题,不过用了原生 fetch,node 版本应该还是要 18+

@59799517
Copy link

_ No description provided. _

代码跑不起来 image 看的修一下把
�[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)�[39m �[90m at Module._compile (internal/modules/cjs/loader.js:1137:30)�[39m at Object. (/home/qqmusic/app.js:12:17) �[90m at require (internal/modules/cjs/helpers.js:72:18)�[39m �[90m at Module.require (internal/modules/cjs/loader.js:1025:19)�[39m �[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)�[39m SyntaxError: Unexpected token '.'
最主要应该是这里 obj.headers.Cookie = opts?.customCookie && obj.headers.Cookie || Object.keys(cookieObj).map((k) => ${k}=${encodeURI(cookieObj[k])}).join('; ');

可能是你的node版本不兼容?.运算,我已经将代码中的?.删除了,但可能其它地方也会报类似的错误
我使用的docker打包用的也是项目带的dockerFile node版本应该是 node:12.18.3 我试试看兼容咋样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants