rdluck hace 3 años
padre
commit
e6fc2eb32c
Se han modificado 2 ficheros con 12 adiciones y 6 borrados
  1. 5 0
      models/wx_user.go
  2. 7 6
      services/user.go

+ 5 - 0
models/wx_user.go

@@ -43,6 +43,7 @@ type WxUser struct {
 	IsFreeLogin      bool      `description:"是否免登陆,true:免登陆,false:非免登陆"`
 	LoginTime        time.Time `description:"最近一次登录时间"`
 	SessionKey       string    `description:"微信小程序会话密钥"`
+	IsRegister       int       `description:"是否注册:1:已注册,0:未注册"`
 }
 
 //添加用户信息
@@ -185,3 +186,7 @@ func GetWxUserItemByEmail(email string) (item *WxUserItem, err error) {
 	err = orm.NewOrm().Raw(sql, email).QueryRow(&item)
 	return
 }
+
+func ModifyReportLast_view_time() {
+
+}

+ 7 - 6
services/user.go

@@ -191,10 +191,11 @@ func BindWxUser(openid, mobile, email string) (wxUser *models.WxUserItem, err er
 			CreatedTime:      time.Now(),
 			FirstLogin:       1,
 			Enabled:          1,
-			RegisterPlatform: 1,
+			RegisterPlatform: 4,
 			RegisterTime:     time.Now(),
 			Mobile:           mobile,
 			Email:            email,
+			IsRegister:       1,
 		}
 		tmpUserId, addUserErr := models.AddWxUser(user)
 		if err != nil {
@@ -220,11 +221,11 @@ func BindWxUser(openid, mobile, email string) (wxUser *models.WxUserItem, err er
 	userRecord.UserId = userId
 
 	//如果当前该第三方用户信息的昵称为空串的话,那么需要去查询该用户的第一个绑定信息的数据作为来源做数据修复
-	if userRecord.NickName == ""{
+	if userRecord.NickName == "" {
 		oldUserRecord, err := models.GetUserThirdRecordByUserId(userId)
-		if err == nil && oldUserRecord != nil{
+		if err == nil && oldUserRecord != nil {
 			//如果该用户绑定的第一条数据的头像信息不为空串,那么就去做新数据的修复
-			if oldUserRecord.NickName != ""{
+			if oldUserRecord.NickName != "" {
 				_ = models.ModifyUserRecordByDetail(userRecord.OpenId, userRecord.UnionId, oldUserRecord.NickName, oldUserRecord.Headimgurl, oldUserRecord.City, oldUserRecord.Province, oldUserRecord.Country, oldUserRecord.Sex, userId)
 			}
 		}
@@ -251,7 +252,7 @@ QUERY_WX_USER:
 		//先添加第三方信息(openid等信息)
 		_, recordErr := AddUserRecord(openId, unionId, wxUserInfo.Nickname, "", wxUserInfo.Province, wxUserInfo.City, wxUserInfo.Country, wxUserInfo.Headimgurl, wxUserInfo.SessionKey, utils.WxPlatform, wxUserInfo.Sex, 0)
 		//如果插入失败,那么直接将错误信息返回
-		if recordErr != nil{
+		if recordErr != nil {
 			err = recordErr
 			return
 		}
@@ -372,4 +373,4 @@ func AddUserRecord(openId, unionId, nickName, realName, province, city, country,
 	}
 	userRecord.UserRecordId = int(recordId)
 	return
-}
+}