rdluck 4 years ago
parent
commit
10d83c9e10
5 changed files with 6 additions and 6 deletions
  1. 1 1
      controllers/base_auth.go
  2. 3 2
      controllers/user.go
  3. 0 1
      controllers/wechat.go
  4. 1 0
      models/db.go
  5. 1 2
      models/wx_user.go

+ 1 - 1
controllers/base_auth.go

@@ -59,7 +59,7 @@ func (this *BaseAuthController) Prepare() {
 			wxUser, err := models.GetWxUserItemByUserId(session.UserId)
 			if err != nil {
 				if err.Error() == utils.ErrNoRow() {
-					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取admin 信息失败 " + strconv.Itoa(session.UserId)}, false, false)
+					this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取信息失败 " + strconv.Itoa(session.UserId)}, false, false)
 					this.StopRun()
 					return
 				}

+ 3 - 2
controllers/user.go

@@ -82,7 +82,7 @@ func (this *UserController) Login() {
 	if tokenItem == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
 		timeUnix := time.Now().Unix()
 		timeUnixStr := strconv.FormatInt(timeUnix, 10)
-		token := utils.MD5(strconv.Itoa(userId)) + utils.MD5(timeUnixStr)
+		token = utils.MD5(strconv.Itoa(userId)) + utils.MD5(timeUnixStr)
 		//新增session
 		{
 			session := new(models.CygxSession)
@@ -514,4 +514,5 @@ func (this *UserController) BrowseHistoryList() {
 	br.Ret = 200
 	br.Success = true
 	br.Data = resp
-}
+}
+

+ 0 - 1
controllers/wechat.go

@@ -319,7 +319,6 @@ func (this *WechatController) GetPhoneNumber() {
 		return
 	}
 	resp := new(models.WxGetPhoneNumberResp)
-	resp.Authorization = this.Token
 	resp.PhoneNumber = wxMobile.PhoneNumber
 	resp.PurePhoneNumber = wxMobile.PurePhoneNumber
 	resp.CountryCode = wxMobile.CountryCode

+ 1 - 0
models/db.go

@@ -34,5 +34,6 @@ func init() {
 		new(CygxArticleCollect),
 		new(CygxArticleViewRecord),
 		new(CygxAdvice),
+		new(MsgCode),
 	)
 }

+ 1 - 2
models/wx_user.go

@@ -121,7 +121,7 @@ func ModifyWxUserSessionKey(sessionKey string, userId int) (err error) {
 //添加用户信息
 func ModifyWxUserInfo(unionId, nickName, province, city, country, avatar string, gender, userId int) (err error) {
 	o := orm.NewOrm()
-	sql := `UPDATE wx_user SET union_id=?,unionid=?,nick_name=?,sex=?,province=?,city=?,country=?,headimgurl=?, WHERE user_id=? `
+	sql := `UPDATE wx_user SET union_id=?,unionid=?,nick_name=?,sex=?,province=?,city=?,country=?,headimgurl=? WHERE user_id=? `
 	_, err = o.Raw(sql, unionId, unionId, nickName, gender, province, city, country, avatar, userId).Exec()
 	return
 }
@@ -164,7 +164,6 @@ func ModifyUsersMobile(usersId int, phoneNumber string) (err error) {
 }
 
 type WxGetPhoneNumberResp struct {
-	Authorization   string `description:"登陆凭证,后续接口调用时,带在请求头里面Key:Authorization"`
 	PhoneNumber     string `description:"用户绑定的手机号(国外手机号会有区号)"`
 	PurePhoneNumber string `description:"没有区号的手机号"`
 	CountryCode     string `description:"区号"`