diff --git a/.gitignore b/.gitignore index 22b3284..d1d8fa4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,31 +1,3 @@ -# ---> Go -# If you prefer the allow list template instead of the deny list, see community template: -# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore -# -# Binaries for programs and plugins -*.exe -*.exe~ -*.dll -*.so -*.dylib - -# Test binary, built with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out - -# Dependency directories (remove the comment below to include it) -# vendor/ - -# Go workspace file -go.work - -data/ -dist/ -venv/ -tmp/ -.env -.env.example -main -.vscode +data +dist +tmp diff --git a/Makefile b/Makefile index e0480e6..3618a8a 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ build: # 更新部署到服务器 update: build - host="root@main" + host=main ssh $host "mv ~/webp/main ~/webp/main_old" scp dist/main $host:~/webp/main rm -rf dist diff --git a/api/graphql.go b/api/graphql.go index 2ecebc6..7d0fb6a 100644 --- a/api/graphql.go +++ b/api/graphql.go @@ -400,6 +400,9 @@ func NewSchema(config Config) (graphql.Schema, error) { if args.Text != "" { resp, err := models.ZincSearch(map[string]interface{}{ "query": map[string]interface{}{ + //"term": map[string]interface{}{ + // "text": args.Text, + //}, "bool": map[string]interface{}{ "must": []map[string]interface{}{ { @@ -505,7 +508,9 @@ func NewSchema(config Config) (graphql.Schema, error) { } if args.First == 0 && args.Last == 0 { - list = list[:10] + if len(list) > 10 { + list = list[:10] + } } // 存在外部筛选条件 diff --git a/go.mod b/go.mod index 3d876bf..49bfb1a 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,9 @@ require ( github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.9.0 + github.com/thoas/go-funk v0.9.3 + gorm.io/driver/mysql v1.5.7 + gorm.io/gorm v1.25.12 ) require ( @@ -51,9 +54,7 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.4.2 // indirect - github.com/thoas/go-funk v0.9.3 // indirect github.com/tjfoc/gmsm v1.3.2 // indirect - github.com/yalue/onnxruntime_go v1.12.1 // indirect golang.org/x/net v0.28.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect @@ -64,8 +65,6 @@ require ( gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gorm.io/driver/mysql v1.5.7 // indirect - gorm.io/gorm v1.25.12 // indirect ) require ( diff --git a/go.sum b/go.sum index 6002e65..c4300e5 100644 --- a/go.sum +++ b/go.sum @@ -171,8 +171,6 @@ github.com/thoas/go-funk v0.9.3 h1:7+nAEx3kn5ZJcnDm2Bh23N2yOtweO14bi//dvRtgLpw= github.com/thoas/go-funk v0.9.3/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q= github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM= github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w= -github.com/yalue/onnxruntime_go v1.12.1 h1:joCCmBnNjHy04jK9EMP/UV6oPPqySXlRgf3gcUcnI/g= -github.com/yalue/onnxruntime_go v1.12.1/go.mod h1:b4X26A8pekNb1ACJ58wAXgNKeUCGEAQ9dmACut9Sm/4= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.30/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -302,7 +300,6 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo= gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM= -gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A= gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8= gorm.io/gorm v1.25.12 h1:I0u8i2hWQItBq1WfE0o2+WuL9+8L21K9e2HHSTE/0f8= gorm.io/gorm v1.25.12/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=