master
huanghai 5 years ago
parent 635164ce9b
commit 32efa347a7

@ -52,6 +52,8 @@ func Routers(r *gin.RouterGroup) {
r.GET("/checkOpenId", checkOpenId)
//绑定用户
r.POST("/bindWxUser", bindWxUser)
//解除绑定
r.POST("/unBindWxUser", unBindWxUser)
return
}
@ -705,3 +707,28 @@ func bindWxUser(context *gin.Context) {
return
}
}
// @Summary 解除绑定微信用户
// @Description 绑定微信用户
// @Tags 解除登录验证类
// @Accept application/x-www-form-urlencoded
// @Produce json
// @Success 200 {string} string
// @Router /oauth2/unBindWxUser [get]
func unBindWxUser(context *gin.Context) {
identityId, _ := context.Cookie("identity_id")
personId, _ := context.Cookie("person_id")
//进行两者之间的解除绑定
_, err := ServiceLoginPerson.UnBindWxUser(identityId, personId)
if err != nil {
context.JSON(http.StatusOK, Model.Res{
Code: http.StatusNotImplemented,
Msg: "在执行unBindWxUser函数时出错",
})
return
}
context.JSON(http.StatusOK, Model.Res{
Code: http.StatusOK,
Msg: "解除绑定成功!",
})
}

@ -61,3 +61,8 @@ func BindWxUser(identityId string, personId string, openid string) (bool, error)
success, err := DaoSysLoginPerson.BindWxUser(identityId, personId, openid)
return success, err
}
//解除绑定微信的用户
func UnBindWxUser(identityId string, personId string) (bool, error) {
success, err := DaoSysLoginPerson.UnBindWxUser(identityId, personId)
return success, err
}

Loading…
Cancel
Save