Browse Source

#1494

update
tags/v1.22.2.2^2
Gitea 4 years ago
parent
commit
4ee2f3d3ee
2 changed files with 5 additions and 3 deletions
  1. +1
    -2
      models/wechat_bind.go
  2. +4
    -1
      routers/authentication/wechat.go

+ 1
- 2
models/wechat_bind.go View File

@@ -54,8 +54,7 @@ func UnbindWechatOpenId(userId int64, oldWechatOpenID string) error {
return err
}

param := &User{WechatOpenId: ""}
n, err := x.Where("ID = ? AND wechat_open_id =?", userId, oldWechatOpenID).Update(param)
n, err := x.Table(new(User)).Where("ID = ? AND wechat_open_id =?", userId, oldWechatOpenID).Update(map[string]interface{}{"wechat_open_id": ""})
if err != nil {
log.Error("update wechat_open_id failed,e=%v", err)
return err


+ 4
- 1
routers/authentication/wechat.go View File

@@ -67,7 +67,10 @@ func GetBindStatus(ctx *context.Context) {

// UnbindWechat
func UnbindWechat(ctx *context.Context) {
wechat.UnbindWechat(ctx.User.ID, ctx.User.WechatOpenId)
if ctx.User.WechatOpenId != "" {
wechat.UnbindWechat(ctx.User.ID, ctx.User.WechatOpenId)
}

ctx.JSON(200, map[string]interface{}{
"code": "00",
"msg": "success",


Loading…
Cancel
Save