12345678910111213141516171819202122232425262728 |
- package handler
- import (
- "net/http"
- "apklink/service/internal/logic"
- "apklink/service/internal/svc"
- "apklink/service/internal/types"
- "github.com/zeromicro/go-zero/rest/httpx"
- )
- func ServiceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- var req types.Request
- if err := httpx.Parse(r, &req); err != nil {
- httpx.Error(w, err)
- return
- }
- l := logic.NewServiceLogic(r.Context(), svcCtx)
- resp, err := l.Service(req)
- if err != nil {
- httpx.Error(w, err)
- } else {
- httpx.OkJson(w, resp)
- }
- }
- }
|