diff --git a/app/controllers/userController/bind.go b/app/controllers/userController/bind.go index 09ea111..910a509 100644 --- a/app/controllers/userController/bind.go +++ b/app/controllers/userController/bind.go @@ -44,26 +44,6 @@ func BindZFPassword(c *gin.Context) { utils.JsonSuccessResponse(c, nil) } -func BindLibraryPassword(c *gin.Context) { - var postForm bindForm - err := c.ShouldBindJSON(&postForm) - if err != nil { - _ = c.AbortWithError(200, apiException.ParamError) - return - } - user, err := sessionServices.GetUserSession(c) - if err != nil { - _ = c.AbortWithError(200, apiException.NotLogin) - return - } - err = userServices.SetLibraryPassword(user, postForm.PassWord) - if err != nil { - _ = c.AbortWithError(200, err) - return - } - utils.JsonSuccessResponse(c, nil) -} - func BindOauthPassword(c *gin.Context) { var postForm bindForm err := c.ShouldBindJSON(&postForm) diff --git a/app/services/funnelServices/libraryService.go b/app/services/funnelServices/libraryService.go index d625e76..4fc6203 100644 --- a/app/services/funnelServices/libraryService.go +++ b/app/services/funnelServices/libraryService.go @@ -8,22 +8,22 @@ import ( ) func GetCurrentBorrow(u *models.User) (interface{}, error) { - if u.LibPassword == "" { + if u.OauthPassword == "" { return nil, apiException.NoThatPasswordOrWrong } form := url.Values{} form.Add("username", u.StudentID) - form.Add("password", u.LibPassword) + form.Add("password", u.OauthPassword) return FetchHandleOfPost(form, funnelApi.LibraryCurrent) } func GetHistoryBorrow(u *models.User) (interface{}, error) { - if u.LibPassword == "" { + if u.OauthPassword == "" { return nil, apiException.NoThatPasswordOrWrong } form := url.Values{} form.Add("username", u.StudentID) - form.Add("password", u.LibPassword) + form.Add("password", u.OauthPassword) return FetchHandleOfPost(form, funnelApi.LibraryHistory) } diff --git a/app/services/userServices/setUser.go b/app/services/userServices/setUser.go index 4950538..d55ed28 100644 --- a/app/services/userServices/setUser.go +++ b/app/services/userServices/setUser.go @@ -29,17 +29,6 @@ func SetOauthPassword(user *models.User, password string) error { return nil } -func SetLibraryPassword(user *models.User, password string) error { - user.LibPassword = password - _, err := funnelServices.GetCurrentBorrow(user) - if err != nil { - return err - } - EncryptUserKeyInfo(user) - database.DB.Save(user) - return nil -} - func SetPhoneNum(user *models.User, phoneNum string) { user.PhoneNum = phoneNum EncryptUserKeyInfo(user) diff --git a/config/router/userRouter.go b/config/router/userRouter.go index bfddc48..8ed3a14 100644 --- a/config/router/userRouter.go +++ b/config/router/userRouter.go @@ -25,7 +25,6 @@ func userRouterInit(r *gin.RouterGroup) { bind := user.Group("/bind", midwares.CheckLogin) { bind.POST("/zf", userController.BindZFPassword) - bind.POST("/library", userController.BindLibraryPassword) bind.POST("/yxy/get/captcha", userController.GetCaptcha) // 待废弃 bind.POST("/yxy/send/captcha", userController.SendVerificationCode) // 兼容用,待删除 bind.POST("/yxy/send/code", userController.SendVerificationCode)