Align origin/main with upstream/main (GitHub). The two branches diverged due to pre-rebase vs post-rebase merge commits for the k8s-amd64-dockerfiles feature. Includes: multi-stage Go compilation Dockerfiles, pan-bolt inventory features, CRM relations, Excel import tooling, proto/gRPC updates, migration scripts, and tools/ directory. Excludes deploy/bin/ pre-compiled binaries (arm64, not needed for amd64 K3s cluster; builds use multi-stage Dockerfiles now).
30 lines
634 B
Go
30 lines
634 B
Go
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,
|
|
})
|
|
}
|
|
}
|