Browse Source

#1494

add wechat bind time
tags/v1.22.2.2^2
chenyifan01 3 years ago
parent
commit
13fb47a5a6
2 changed files with 4 additions and 3 deletions
  1. +2
    -1
      models/user.go
  2. +2
    -2
      models/wechat_bind.go

+ 2
- 1
models/user.go View File

@@ -179,7 +179,8 @@ type User struct {
PrivateKey string `xorm:"INDEX"`

//Wechat
WechatOpenId string `xorm:"INDEX"`
WechatOpenId string `xorm:"INDEX"`
WechatBindTime time.Time
}

// SearchOrganizationsOptions options to filter organizations


+ 2
- 2
models/wechat_bind.go View File

@@ -27,7 +27,7 @@ func BindWechatOpenId(userId int64, wechatOpenId string) error {
return err
}

param := &User{WechatOpenId: wechatOpenId}
param := &User{WechatOpenId: wechatOpenId, WechatBindTime: time.Now()}
n, err := sess.Where("ID = ?", userId).Update(param)
if err != nil {
log.Error("update wechat_open_id failed,e=%v", err)
@@ -66,7 +66,7 @@ func UnbindWechatOpenId(userId int64, oldWechatOpenID string) error {
return err
}

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


Loading…
Cancel
Save