package relation import ( "net/http" "strconv" "muyu-apiserver/gateway/internal/svc" "github.com/zeromicro/go-zero/rest/httpx" ) func SearchTenantsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { keyword := r.URL.Query().Get("keyword") limit, _ := strconv.Atoi(r.URL.Query().Get("limit")) if limit <= 0 { limit = 20 } tenants, err := svcCtx.CrmRepo.SearchTenants(r.Context(), keyword, limit) if err != nil { httpx.ErrorCtx(r.Context(), w, err) return } httpx.OkJsonCtx(r.Context(), w, map[string]interface{}{ "list": tenants, }) } }