youtu_server/game_open_api/internal/handler/douyin/douyinCode2UserIdHandler.go

29 lines
718 B
Go
Raw Normal View History

2025-01-20 01:55:44 +08:00
package douyin
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"youtu_server/game_open_api/internal/logic/douyin"
"youtu_server/game_open_api/internal/svc"
"youtu_server/game_open_api/internal/types"
)
func DouyinCode2UserIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DouyinCode2UserIdRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := douyin.NewDouyinCode2UserIdLogic(r.Context(), svcCtx)
resp, err := l.DouyinCode2UserId(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}