|
@@ -34,6 +34,9 @@ func GetWxUserItemByOpenId(openid string) (item *models.WxUserItem,err error){
|
|
|
//该openid没有绑定用户
|
|
|
if userRecord.UserId <= 0{
|
|
|
err = ERR_USER_NOT_BIND
|
|
|
+ item = new(models.WxUserItem)
|
|
|
+ //格式化返回用户数据
|
|
|
+ formatWxUserAndUserRecord(item,userRecord)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -229,7 +232,7 @@ func WxLogin(code string,wxAccessToken *WxAccessToken,wxUserInfo *WxUserInfo)(to
|
|
|
return
|
|
|
}else if wxUserErr == ERR_USER_NOT_BIND{
|
|
|
//没有用户信息
|
|
|
- wxUser.FirstLogin = 1
|
|
|
+ //wxUser.FirstLogin = 1
|
|
|
}else if wxUserErr != nil{
|
|
|
err = wxUserErr
|
|
|
return
|
|
@@ -318,6 +321,15 @@ func UserLogin() {
|
|
|
|
|
|
//添加第三方用户(微信)记录
|
|
|
func AddUserRecord(openId,unionId,nickName,realName,province,city,country,headimgurl,sessionKey string,platform,sex,subscribe int) (userRecord *models.UserRecord,err error) {
|
|
|
+ find,err := models.GetUserRecordByOpenId(openId)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow(){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if find != nil{
|
|
|
+ userRecord = find
|
|
|
+ return
|
|
|
+
|
|
|
+ }
|
|
|
userRecord = &models.UserRecord{
|
|
|
OpenId :openId, //用户open_id
|
|
|
UnionId :unionId,//用户union_id
|