diff --git a/models/user.go b/models/user.go index 5b90c38b5..f7857248b 100755 --- a/models/user.go +++ b/models/user.go @@ -180,7 +180,7 @@ type User struct { //Wechat WechatOpenId string `xorm:"INDEX"` - WechatBindTime time.Time + WechatBindUnix timeutil.TimeStamp } // SearchOrganizationsOptions options to filter organizations diff --git a/models/wechat_bind.go b/models/wechat_bind.go index 5609fa259..fde1b2222 100644 --- a/models/wechat_bind.go +++ b/models/wechat_bind.go @@ -2,6 +2,7 @@ package models import ( "code.gitea.io/gitea/modules/log" + "code.gitea.io/gitea/modules/timeutil" "time" ) @@ -27,7 +28,7 @@ func BindWechatOpenId(userId int64, wechatOpenId string) error { return err } - param := &User{WechatOpenId: wechatOpenId, WechatBindTime: time.Now()} + param := &User{WechatOpenId: wechatOpenId, WechatBindUnix: timeutil.TimeStampNow()} n, err := sess.Where("ID = ?", userId).Update(param) if err != nil { log.Error("update wechat_open_id failed,e=%v", err) @@ -66,7 +67,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": "", "wechat_bind_time": nil}) + n, err := x.Table(new(User)).Where("ID = ? AND wechat_open_id =?", userId, oldWechatOpenID).Update(map[string]interface{}{"wechat_open_id": "", "wechat_bind_unix": nil}) if err != nil { log.Error("update wechat_open_id failed,e=%v", err) return err