rdluck 4 жил өмнө
parent
commit
906fd7520a

+ 1 - 0
controllers/wechat.go

@@ -88,6 +88,7 @@ func (this *WechatCommonController) WechatLogin() {
 			user.Remark = wxUserInfo.Remark
 			user.FirstLogin = 1
 			user.Enabled = 1
+			user.RegisterTime=time.Now()
 			err = models.AddWxUser(user)
 			if wxUserInfo.Unionid != "" {
 				wxUser, err = models.GetWxUserItemByUnionid(wxUserInfo.Unionid)

+ 3 - 2
models/wx_user.go

@@ -39,6 +39,7 @@ type WxUser struct {
 	IsNote          int       `description:"是否备注过信息"`
 	FromType        string    `description:"report' COMMENT 'report:研报,teleconference:电话会"`
 	ApplyMethod     int       `description:"0:未申请,1:已付费客户申请试用,2:非客户申请试用"`
+	RegisterTime    time.Time `description:"注册时间"`
 }
 
 type WxUserItem struct {
@@ -212,9 +213,9 @@ func BindMobile(openId, mobile string, userId, loginType int) (wxUserId int, err
 			}
 			msql := ``
 			if loginType == 1 {
-				msql = ` UPDATE wx_user SET open_id = ?,bind_account = ?,created_time=NOW() WHERE mobile = ? `
+				msql = ` UPDATE wx_user SET open_id = ?,bind_account = ?,created_time=NOW(),register_time=NOW() WHERE mobile = ? `
 			} else {
-				msql = ` UPDATE wx_user SET open_id = ?,bind_account = ?,created_time=NOW() WHERE email = ? `
+				msql = ` UPDATE wx_user SET open_id = ?,bind_account = ?,created_time=NOW(),register_time=NOW() WHERE email = ? `
 			}
 			_, err = o.Raw(msql, openId, mobile, mobile).Exec()
 		} else {