package handler

import (
	"net/http"

	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/logic"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/svc"
	"bp.jydev.jianyu360.cn/BaseService/resourceCenter/api/internal/types"
	"github.com/zeromicro/go-zero/rest/httpx"
)

func haspowersHandler(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.Error(w, err)
			return
		}

		l := logic.NewHaspowersLogic(r.Context(), svcCtx)
		resp, err := l.Haspowers(&req)
		if err != nil {
			httpx.Error(w, err)
		} else {
			httpx.OkJson(w, resp)
		}
	}
}
