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 DouyinCode2tokenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.DouyinCode2TokenRequest if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } l := douyin.NewDouyinCode2tokenLogic(r.Context(), svcCtx) resp, err := l.DouyinCode2token(&req) if err != nil { resp.Code = -1 httpx.ErrorCtx(r.Context(), w, err) } else { httpx.OkJsonCtx(r.Context(), w, resp) } } }