transfer_yl/cmd/api/internal/handler/yl/ylHandler.go

32 lines
670 B
Go

package yl
import (
"net/http"
"rs/untils/response"
"github.com/zeromicro/go-zero/rest/httpx"
"rs/cmd/api/internal/logic/yl"
"rs/cmd/api/internal/svc"
"rs/cmd/api/internal/types"
)
// 卡密同步发放接口
func YlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Req
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := yl.NewYlLogic(r.Context(), svcCtx)
resp, err := l.Yl(&req)
if err != nil {
response.Err(w, response.HTTP_REUEST_FAIL, err.Error())
} else {
response.Suc(w, response.HTTP_SUCCESS, resp)
}
}
}