mirror of
https://gitlab.com/Binaryify/neteasecloudmusicapi.git
synced 2025-05-23 22:37:41 +08:00
38 lines
915 B
JavaScript
38 lines
915 B
JavaScript
// 手机登录
|
|
|
|
const CryptoJS = require('crypto-js')
|
|
|
|
const createOption = require('../util/option.js')
|
|
module.exports = async (query, request) => {
|
|
const data = {
|
|
phone: query.phone,
|
|
countrycode: query.countrycode || '86',
|
|
captcha: query.captcha,
|
|
[query.captcha ? 'captcha' : 'password']: query.captcha
|
|
? query.captcha
|
|
: query.md5_password || CryptoJS.MD5(query.password).toString(),
|
|
rememberLogin: 'true',
|
|
}
|
|
let result = await request(`/api/login/cellphone`, data, {
|
|
...createOption(query, 'weapi'),
|
|
uaType: 'pc',
|
|
})
|
|
|
|
if (result.body.code === 200) {
|
|
result = {
|
|
status: 200,
|
|
body: {
|
|
...JSON.parse(
|
|
JSON.stringify(result.body).replace(
|
|
/avatarImgId_str/g,
|
|
'avatarImgIdStr',
|
|
),
|
|
),
|
|
cookie: result.cookie.join(';'),
|
|
},
|
|
cookie: result.cookie,
|
|
}
|
|
}
|
|
return result
|
|
}
|