12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package User
- import (
- "net/http"
- jwtutils "wechat-api/internal/utils/jwt"
- "github.com/zeromicro/go-zero/rest/httpx"
- "wechat-api/internal/logic/User"
- "wechat-api/internal/svc"
- "wechat-api/internal/types"
- )
- // swagger:route post /gpts/user/password User UpdateGptsUserPwd
- //
- // Get user basic information | 获取用户基本信息
- //
- // Get user basic information | 获取用户基本信息
- //
- // Parameters:
- // + name: body
- // require: true
- // in: body
- // type: PasswordReq
- //
- // Responses:
- // 200: BaseDataInfo
- func UpdateGptsUserPwdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req types.PasswordReq
- if err := httpx.Parse(r, &req, true); err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- return
- }
- tokenStr := jwtutils.StripBearerPrefixFromToken(r.Header.Get("Authorization"))
- l := User.NewUpdateGptsUserPwdLogic(r.Context(), svcCtx)
- resp, err := l.UpdateGptsUserPwd(tokenStr, &req)
- if err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- } else {
- httpx.OkJsonCtx(r.Context(), w, resp)
- }
- }
- }
|