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

32 lines
670 B
Go
Raw Normal View History

2024-07-16 16:51:39 +08:00
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)
}
}
}