|
|
@@ -19,15 +19,15 @@ class UnbindSocial extends API {
|
|
|
}
|
|
|
|
|
|
async onRequest(req, res) {
|
|
|
- let { uuid, session, social_type } = req.body
|
|
|
- social_type = normalizeSocialType(social_type)
|
|
|
+ let { uuid, session, type, social_type } = req.body
|
|
|
+ const channelType = normalizeSocialType(type ?? social_type)
|
|
|
|
|
|
if ([uuid, session].some(value => value === '' || value === null || value === undefined))
|
|
|
return res.json({
|
|
|
...BaseStdResponse.MISSING_PARAMETER
|
|
|
})
|
|
|
|
|
|
- if (!social_type)
|
|
|
+ if (!channelType)
|
|
|
return res.json({
|
|
|
...BaseStdResponse.ERR,
|
|
|
msg: '不支持的第三方账号类型'
|
|
|
@@ -40,7 +40,7 @@ class UnbindSocial extends API {
|
|
|
|
|
|
try {
|
|
|
const bindings = await getUserSocialBindings(uuid)
|
|
|
- if (!bindings.some(binding => binding.social_type === social_type))
|
|
|
+ if (!bindings.some(binding => binding.social_type === channelType))
|
|
|
return res.json({
|
|
|
...BaseStdResponse.ERR,
|
|
|
msg: '当前账号未绑定该第三方账号'
|
|
|
@@ -59,7 +59,7 @@ class UnbindSocial extends API {
|
|
|
msg: '请先设置登录密码或绑定其他第三方账号后再解绑'
|
|
|
})
|
|
|
|
|
|
- const result = await removeSocialBinding(uuid, social_type)
|
|
|
+ const result = await removeSocialBinding(uuid, channelType)
|
|
|
if (!result || result.affectedRows !== 1)
|
|
|
return res.json({
|
|
|
...BaseStdResponse.ERR,
|