Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello_uni-id-pages
提交
62c2c41f
H
hello_uni-id-pages
项目概览
DCloud
/
hello_uni-id-pages
通知
1054
Star
31
Fork
43
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
2
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello_uni-id-pages
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
62c2c41f
编写于
10月 12, 2022
作者:
C
chenruilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 增加解绑第三方账号接口
上级
7ba8f0f0
变更
14
显示空白变更内容
内联
并排
Showing
14 changed file
with
541 addition
and
195 deletion
+541
-195
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
+232
-185
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/constants.js
...ges/uniCloud/cloudfunctions/uni-id-co/common/constants.js
+5
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/error.js
...d-pages/uniCloud/cloudfunctions/uni-id-co/common/error.js
+5
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/config/permission.js
...es/uniCloud/cloudfunctions/uni-id-co/config/permission.js
+12
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
...i-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
+31
-2
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lang/en.js
...uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lang/en.js
+4
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lang/zh-hans.js
...d-pages/uniCloud/cloudfunctions/uni-id-co/lang/zh-hans.js
+4
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lib/utils/relate.js
...ges/uniCloud/cloudfunctions/uni-id-co/lib/utils/relate.js
+92
-2
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-alipay.js
...oud/cloudfunctions/uni-id-co/module/relate/bind-alipay.js
+1
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/index.js
.../uniCloud/cloudfunctions/uni-id-co/module/relate/index.js
+5
-1
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-alipay.js
...d/cloudfunctions/uni-id-co/module/relate/unbind-alipay.js
+32
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-apple.js
...ud/cloudfunctions/uni-id-co/module/relate/unbind-apple.js
+32
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-qq.js
...Cloud/cloudfunctions/uni-id-co/module/relate/unbind-qq.js
+46
-0
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-weixin.js
...d/cloudfunctions/uni-id-co/module/relate/unbind-weixin.js
+40
-0
未找到文件。
uni_modules/uni-id-pages/pages/userinfo/userinfo.vue
浏览文件 @
62c2c41f
...
...
@@ -14,6 +14,16 @@
<uni-list-item
v-if=
"hasPwd"
class=
"item"
@
click=
"changePassword"
title=
"修改密码"
link
>
</uni-list-item>
</uni-list>
<uni-list
class=
"mt10"
>
<uni-list-item
@
click=
"bindThirdAccount('Weixin')"
title=
"微信"
link
:rightText=
"userInfo.wx_openid ? '已绑定': '未绑定' "
></uni-list-item>
<uni-list-item
@
click=
"bindThirdAccount('QQ')"
title=
"QQ"
link
:rightText=
"userInfo.qq_openid ? '已绑定': '未绑定' "
></uni-list-item>
<uni-list-item
@
click=
"bindThirdAccount('Alipay')"
title=
"支付宝"
link
:rightText=
"userInfo.ali_openid ? '已绑定': '未绑定' "
></uni-list-item>
<uni-list-item
@
click=
"bindThirdAccount('Apple')"
title=
"Apple"
link
:rightText=
"userInfo.apple_openid ? '已绑定': '未绑定' "
></uni-list-item>
</uni-list>
<uni-list
class=
"mt10"
>
<uni-list-item
@
click=
"deactivate"
title=
"注销账号"
link=
"navigateTo"
></uni-list-item>
</uni-list>
...
...
@@ -30,11 +40,11 @@
</view>
</template>
<
script
>
const
db
=
uniCloud
.
database
();
const
usersTable
=
db
.
collection
(
'
uni-id-users
'
)
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
import
common
from
'
@/uni_modules/uni-id-pages/common/common.js
'
;
export
default
{
const
db
=
uniCloud
.
database
();
const
usersTable
=
db
.
collection
(
'
uni-id-users
'
)
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
import
common
from
'
@/uni_modules/uni-id-pages/common/common.js
'
;
export
default
{
data
()
{
return
{
univerifyStyle
:
{
...
...
@@ -46,12 +56,12 @@
}
},
userInfo
:
{
mobile
:
''
,
nickname
:
''
mobile
:
''
,
nickname
:
''
},
hasLogin
:
false
,
hasPwd
:
false
,
showLoginManage
:
false
//通过页面传参隐藏登录&退出登录按钮
hasPwd
:
false
,
showLoginManage
:
false
//通过页面传参隐藏登录&退出登录按钮
}
},
async
onShow
()
{
...
...
@@ -59,7 +69,7 @@
this
.
univerifyStyle
.
otherLoginButton
.
title
=
"
其他号码绑定
"
},
async
onLoad
(
e
)
{
if
(
e
.
showLoginManage
)
{
if
(
e
.
showLoginManage
)
{
this
.
showLoginManage
=
true
//通过页面传参隐藏登录&退出登录按钮
}
this
.
getUserInfo
()
...
...
@@ -76,8 +86,8 @@
}
})
},
logout
:
common
.
logout
,
changePassword
()
{
logout
:
common
.
logout
,
changePassword
()
{
uni
.
navigateTo
({
url
:
'
/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd
'
,
complete
:
(
e
)
=>
{
...
...
@@ -89,8 +99,8 @@
uni
.
showLoading
({
mask
:
true
});
usersTable
.
where
(
"
'_id' == $cloudEnv_uid
"
).
field
(
'
mobile,nickname,email
'
).
get
().
then
(
res
=>
{
console
.
log
({
res
});
usersTable
.
where
(
"
'_id' == $cloudEnv_uid
"
).
field
(
'
mobile,nickname,email,wx_openid,wx_unionid,ali_openid,apple_open,qq_openid,qq_unionid
'
).
get
().
then
(
res
=>
{
console
.
log
({
res
});
this
.
userInfo
=
res
.
result
.
data
[
0
]
console
.
log
(
'
this.userInfo
'
,
this
.
userInfo
);
this
.
hasLogin
=
true
...
...
@@ -136,7 +146,7 @@
this
.
getUserInfo
()
}).
catch
(
e
=>
{
console
.
log
(
e
);
}).
finally
(
e
=>
{
}).
finally
(
e
=>
{
console
.
log
(
e
);
uni
.
closeAuthView
()
})
...
...
@@ -187,28 +197,64 @@
this
.
$refs
.
dialog
.
open
()
}
},
deactivate
()
{
deactivate
()
{
uni
.
navigateTo
({
url
:
"
/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate
"
url
:
"
/uni_modules/uni-id-pages/pages/userinfo/deactivate/deactivate
"
})
},
async
bindThirdAccount
(
provider
)
{
const
uniIdCo
=
uniCloud
.
importObject
(
"
uni-id-co
"
)
const
bindField
=
{
weixin
:
'
wx_openid
'
,
alipay
:
'
ali_openid
'
,
apple
:
'
apple_openid
'
,
qq
:
'
qq_openid
'
}[
provider
.
toLowerCase
()]
if
(
this
.
userInfo
[
bindField
])
{
await
uniIdCo
[
'
unbind
'
+
provider
]()
await
this
.
getUserInfo
()
}
else
{
uni
.
login
({
provider
:
provider
.
toLowerCase
(),
onlyAuthorize
:
true
,
success
:
async
e
=>
{
const
res
=
await
uniIdCo
[
'
bind
'
+
provider
]({
code
:
e
.
code
})
if
(
res
.
errCode
)
{
uni
.
showToast
({
title
:
res
.
errMsg
||
'
绑定失败
'
})
}
await
this
.
getUserInfo
()
},
fail
:
async
(
err
)
=>
{
console
.
log
(
err
);
uni
.
hideLoading
()
}
})
}
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
@import
url("/uni_modules/uni-id-pages/common/login-page.scss")
;
@import
url("/uni_modules/uni-id-pages/common/login-page.scss")
;
.uni-content
{
.uni-content
{
padding
:
0
;
}
}
/* #ifndef APP-NVUE */
view
{
/* #ifndef APP-NVUE */
view
{
display
:
flex
;
box-sizing
:
border-box
;
flex-direction
:
column
;
}
@media
screen
and
(
min-width
:
690px
)
{
}
@media
screen
and
(
min-width
:
690px
)
{
.uni-content
{
padding
:
0
;
max-width
:
690px
;
...
...
@@ -218,31 +264,32 @@
border-radius
:
0
;
box-shadow
:
none
;
}
}
/* #endif */
.avatar
{
}
/* #endif */
.avatar
{
align-items
:
center
;
justify-content
:
center
;
margin
:
22px
0
;
width
:
100%
;
}
}
.item
{
.item
{
flex
:
1
;
flex-direction
:
row
;
justify-content
:
space-between
;
align-items
:
center
;
}
}
button
{
button
{
margin
:
10%
;
margin-top
:
40px
;
border-radius
:
0
;
background-color
:
#FFFFFF
;
width
:
80%
;
}
}
.mt10
{
.mt10
{
margin-top
:
10px
;
}
}
</
style
>
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/constants.js
浏览文件 @
62c2c41f
...
...
@@ -52,7 +52,11 @@ const LOG_TYPE = {
BIND_WEIXIN
:
'
bind-weixin
'
,
BIND_QQ
:
'
bind-qq
'
,
BIND_APPLE
:
'
bind-apple
'
,
BIND_ALIPAY
:
'
bind-alipay
'
BIND_ALIPAY
:
'
bind-alipay
'
,
UNBIND_WEIXIN
:
'
unbind-weixin
'
,
UNBIND_QQ
:
'
unbind-qq
'
,
UNBIND_ALIPAY
:
'
unbind-alipay
'
,
UNBIND_APPLE
:
'
unbind-apple
'
}
const
SMS_SCENE
=
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/common/error.js
浏览文件 @
62c2c41f
...
...
@@ -30,7 +30,11 @@ const ERROR = {
SET_INVITE_CODE_FAILED
:
'
uni-id-set-invite-code-failed
'
,
INVALID_INVITE_CODE
:
'
uni-id-invalid-invite-code
'
,
CHANGE_INVITER_FORBIDDEN
:
'
uni-id-change-inviter-forbidden
'
,
BIND_CONFLICT
:
'
uni-id-bind-conflict
'
BIND_CONFLICT
:
'
uni-id-bind-conflict
'
,
UNBIND_FAIL
:
'
uni-id-unbind-failed
'
,
UNBIND_NOT_SUPPORTED
:
'
uni-id-unbind-not-supported
'
,
UNBIND_UNIQUE_LOGIN
:
'
uni-id-unbind-unique-login
'
}
function
isUniIdError
(
errCode
)
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/config/permission.js
浏览文件 @
62c2c41f
...
...
@@ -62,5 +62,17 @@ module.exports = {
},
getAccountInfo
:
{
auth
:
true
},
unbindWeixin
:
{
auth
:
true
},
unbindAlipay
:
{
auth
:
true
},
unbindQQ
:
{
auth
:
true
},
unbindApple
:
{
auth
:
true
}
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/index.obj.js
浏览文件 @
62c2c41f
...
...
@@ -42,7 +42,11 @@ const {
bindAlipay
,
bindApple
,
bindQQ
,
bindWeixin
bindWeixin
,
unbindWeixin
,
unbindAlipay
,
unbindQQ
,
unbindApple
}
=
require
(
'
./module/relate/index
'
)
const
{
updatePwd
,
...
...
@@ -543,5 +547,30 @@ module.exports = {
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#get-supported-login-type
* @returns
*/
getSupportedLoginType
getSupportedLoginType
,
/**
* 解绑微信
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-weixin
* @returns
*/
unbindWeixin
,
/**
* 解绑支付宝
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-alipay
* @returns
*/
unbindAlipay
,
/**
* 解绑QQ
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-qq
* @returns
*/
unbindQQ
,
/**
* 解绑Apple
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-apple
* @returns
*/
unbindApple
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lang/en.js
浏览文件 @
62c2c41f
...
...
@@ -36,7 +36,10 @@ const sentence = {
'
uni-id-invalid-invite-code
'
:
'
Invalid invite code
'
,
'
uni-id-change-inviter-forbidden
'
:
'
Change inviter is not allowed
'
,
'
uni-id-bind-conflict
'
:
'
This account has been bound
'
,
'
uni-id-admin-exist-in-other-apps
'
:
'
Administrator is registered in other consoles
'
'
uni-id-admin-exist-in-other-apps
'
:
'
Administrator is registered in other consoles
'
,
'
uni-id-unbind-failed
'
:
'
Please bind first and then unbind
'
,
'
uni-id-unbind-not-supported
'
:
'
Unbinding is not supported
'
,
'
uni-id-unbind-unique-login
'
:
'
This is the only way to login at the moment, please bind your phone number and then try to unbind
'
}
module
.
exports
=
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lang/zh-hans.js
浏览文件 @
62c2c41f
...
...
@@ -36,7 +36,10 @@ const sentence = {
'
uni-id-invalid-invite-code
'
:
'
邀请码不可用
'
,
'
uni-id-change-inviter-forbidden
'
:
'
禁止修改邀请人
'
,
'
uni-id-bind-conflict
'
:
'
此账号已被绑定
'
,
'
uni-id-admin-exist-in-other-apps
'
:
'
超级管理员已在其他控制台注册
'
'
uni-id-admin-exist-in-other-apps
'
:
'
超级管理员已在其他控制台注册
'
,
'
uni-id-unbind-failed
'
:
'
请先绑定后再解绑
'
,
'
uni-id-unbind-not-supported
'
:
'
不支持解绑
'
,
'
uni-id-unbind-unique-login
'
:
'
这是当前唯一登录方式,请绑定手机号后再尝试解绑
'
}
module
.
exports
=
{
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/lib/utils/relate.js
浏览文件 @
62c2c41f
...
...
@@ -5,8 +5,15 @@ const {
ERROR
}
=
require
(
'
../../common/error
'
)
const
{
userCollection
userCollection
,
dbCmd
,
USER_IDENTIFIER
}
=
require
(
'
../../common/constants
'
)
const
{
getUserIdentifier
}
=
require
(
'
../../lib/utils/account
'
)
const
{
batchFindObjctValue
}
=
require
(
'
../../common/utils
'
)
const
merge
=
require
(
'
lodash.merge
'
)
/**
...
...
@@ -56,7 +63,90 @@ async function postBind ({
}
}
async
function
preUnBind
({
uid
,
unBindAccount
,
logType
})
{
const
notUnBind
=
[
'
username
'
,
'
mobile
'
,
'
email
'
]
const
userIdentifier
=
getUserIdentifier
(
unBindAccount
)
const
condition
=
Object
.
keys
(
userIdentifier
).
reduce
((
res
,
key
)
=>
{
if
(
userIdentifier
[
key
])
{
if
(
notUnBind
.
includes
(
key
))
{
throw
{
errCode
:
ERROR
.
UNBIND_NOT_SUPPORTED
}
}
res
.
push
({
[
key
]:
userIdentifier
[
key
]
})
}
return
res
},
[])
const
currentUnBindAccount
=
Object
.
keys
(
userIdentifier
).
reduce
((
res
,
key
)
=>
{
if
(
userIdentifier
[
key
])
{
res
.
push
(
key
)
}
return
res
},
[])
const
{
data
:
users
}
=
await
userCollection
.
where
(
dbCmd
.
and
(
{
_id
:
uid
},
dbCmd
.
or
(
condition
)
)).
get
()
if
(
users
.
length
<=
0
)
{
await
this
.
middleware
.
uniIdLog
({
data
:
{
user_id
:
uid
},
type
:
logType
,
success
:
false
})
throw
{
errCode
:
ERROR
.
UNBIND_FAIL
}
}
const
[
user
]
=
users
const
otherAccounts
=
batchFindObjctValue
(
user
,
Object
.
keys
(
USER_IDENTIFIER
).
filter
(
key
=>
!
notUnBind
.
includes
(
key
)
&&
!
currentUnBindAccount
.
includes
(
key
)))
let
hasOtherAccountBind
=
false
for
(
const
key
in
otherAccounts
)
{
if
(
otherAccounts
[
key
])
{
hasOtherAccountBind
=
true
break
}
}
if
(
!
hasOtherAccountBind
&&
!
user
.
mobile
)
{
throw
{
errCode
:
ERROR
.
UNBIND_UNIQUE_LOGIN
}
}
}
async
function
postUnBind
({
uid
,
unBindAccount
,
logType
})
{
await
userCollection
.
doc
(
uid
).
update
(
unBindAccount
)
await
this
.
middleware
.
uniIdLog
({
data
:
{
user_id
:
uid
},
type
:
logType
})
return
{
errCode
:
0
}
}
module
.
exports
=
{
preBind
,
postBind
postBind
,
preUnBind
,
postUnBind
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/bind-alipay.js
浏览文件 @
62c2c41f
...
...
@@ -47,7 +47,7 @@ module.exports = async function (params = {}) {
}
=
getAlipayAccountResult
const
bindAccount
=
{
a
pple
_openid
:
openid
a
li
_openid
:
openid
}
await
preBind
.
call
(
this
,
{
uid
,
...
...
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/index.js
浏览文件 @
62c2c41f
...
...
@@ -5,5 +5,9 @@ module.exports = {
bindAlipay
:
require
(
'
./bind-alipay
'
),
bindApple
:
require
(
'
./bind-apple
'
),
bindQQ
:
require
(
'
./bind-qq
'
),
bindWeixin
:
require
(
'
./bind-weixin
'
)
bindWeixin
:
require
(
'
./bind-weixin
'
),
unbindWeixin
:
require
(
'
./unbind-weixin
'
),
unbindAlipay
:
require
(
'
./unbind-alipay
'
),
unbindQQ
:
require
(
'
./unbind-qq
'
),
unbindApple
:
require
(
'
./unbind-apple
'
)
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-alipay.js
0 → 100644
浏览文件 @
62c2c41f
const
{
preUnBind
,
postUnBind
}
=
require
(
'
../../lib/utils/relate
'
)
const
{
LOG_TYPE
,
dbCmd
}
=
require
(
'
../../common/constants
'
)
/**
* 解绑支付宝
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-alipay
* @returns
*/
module
.
exports
=
async
function
()
{
const
{
uid
}
=
this
.
authInfo
await
preUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
ali_openid
:
dbCmd
.
exists
(
true
)
},
logType
:
LOG_TYPE
.
UNBIND_ALIPAY
})
return
await
postUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
ali_openid
:
dbCmd
.
remove
()
},
logType
:
LOG_TYPE
.
UNBIND_ALIPAY
})
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-apple.js
0 → 100644
浏览文件 @
62c2c41f
const
{
preUnBind
,
postUnBind
}
=
require
(
'
../../lib/utils/relate
'
)
const
{
LOG_TYPE
,
dbCmd
}
=
require
(
'
../../common/constants
'
)
/**
* 解绑apple
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-apple
* @returns
*/
module
.
exports
=
async
function
()
{
const
{
uid
}
=
this
.
authInfo
await
preUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
apple_openid
:
dbCmd
.
exists
(
true
)
},
logType
:
LOG_TYPE
.
UNBIND_APPLE
})
return
await
postUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
apple_openid
:
dbCmd
.
remove
()
},
logType
:
LOG_TYPE
.
UNBIND_APPLE
})
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-qq.js
0 → 100644
浏览文件 @
62c2c41f
const
{
preUnBind
,
postUnBind
}
=
require
(
'
../../lib/utils/relate
'
)
const
{
LOG_TYPE
,
dbCmd
}
=
require
(
'
../../common/constants
'
)
const
{
getQQPlatform
}
=
require
(
'
../../lib/utils/qq
'
)
/**
* 解绑QQ
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-qq
* @returns
*/
module
.
exports
=
async
function
()
{
const
{
uid
}
=
this
.
authInfo
const
{
appId
}
=
this
.
getClientInfo
()
const
qqPlatform
=
getQQPlatform
.
call
(
this
)
await
preUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
qq_openid
:
dbCmd
.
or
([
{
[
qqPlatform
]:
dbCmd
.
exists
(
true
)
},
{
[
`
${
qqPlatform
}
_
${
appId
}
`
]:
dbCmd
.
exists
(
true
)
}
]),
qq_unionid
:
dbCmd
.
exists
(
true
)
},
logType
:
LOG_TYPE
.
UNBIND_QQ
})
return
await
postUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
qq_openid
:
dbCmd
.
remove
(),
qq_unionid
:
dbCmd
.
remove
()
},
logType
:
LOG_TYPE
.
UNBIND_QQ
})
}
uni_modules/uni-id-pages/uniCloud/cloudfunctions/uni-id-co/module/relate/unbind-weixin.js
0 → 100644
浏览文件 @
62c2c41f
const
{
preUnBind
,
postUnBind
}
=
require
(
'
../../lib/utils/relate
'
)
const
{
LOG_TYPE
,
dbCmd
}
=
require
(
'
../../common/constants
'
)
const
{
getWeixinPlatform
}
=
require
(
'
../../lib/utils/weixin
'
)
/**
* 解绑微信
* @tutorial https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#unbind-weixin
* @returns
*/
module
.
exports
=
async
function
()
{
const
{
uid
}
=
this
.
authInfo
const
weixinPlatform
=
getWeixinPlatform
.
call
(
this
)
await
preUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
wx_openid
:
{
[
weixinPlatform
]:
dbCmd
.
exists
(
true
)
},
wx_unionid
:
dbCmd
.
exists
(
true
)
},
logType
:
LOG_TYPE
.
UNBIND_WEIXIN
})
return
await
postUnBind
.
call
(
this
,
{
uid
,
unBindAccount
:
{
wx_openid
:
dbCmd
.
remove
(),
wx_unionid
:
dbCmd
.
remove
()
},
logType
:
LOG_TYPE
.
UNBIND_WEIXIN
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录