123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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/update User UpdateGptsUserInfo
- //
- // Update user basic information | 修改用户基本信息
- //
- // Update user basic information | 修改用户基本信息
- //
- // Parameters:
- // + name: body
- // require: true
- // in: body
- // type: UserInfo
- //
- // Responses:
- // 200: BaseDataInfo
- func UpdateGptsUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req types.UserInfo
- 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.NewUpdateGptsUserInfoLogic(r.Context(), svcCtx)
- resp, err := l.UpdateGptsUserInfo(&req, tokenStr)
- if err != nil {
- httpx.ErrorCtx(r.Context(), w, err)
- } else {
- httpx.OkJsonCtx(r.Context(), w, resp)
- }
- }
- }
|