xuzhiheng 4 dni temu
rodzic
commit
31f787b475

+ 1 - 0
jyservice/src/usermanager/usermanager.go

@@ -51,6 +51,7 @@ func init() {
 	Route.HandleFunc("/data/getBeforeBid", GetBeforeBid).Methods("POST")
 	//芝麻
 	Route.HandleFunc("/data/getzhima", GetZhiMa).Methods("GET", "POST")
+	Route.HandleFunc("/data/getpanchong", GetPanChong).Methods("GET", "POST")
 	//测试工具
 	Route.HandleFunc("/api1/testApi", SendMailByAppid).Methods("GET", "POST")
 	//子路由,需中间件处理

+ 34 - 0
jyservice/src/usermanager/zhima.go

@@ -11,6 +11,7 @@ import (
 	"encoding/json"
 	"encoding/pem"
 	"errors"
+	"fmt"
 	"hash"
 	"io/ioutil"
 	"log"
@@ -363,3 +364,36 @@ func parsePrivateKey(key string) (*rsa.PrivateKey, error) {
 
 	return rsaPrivateKey.(*rsa.PrivateKey), nil
 }
+
+func GetPanChong(w http.ResponseWriter, r *http.Request) {
+	title := r.FormValue("title")
+	appid := r.FormValue("appid")
+	log.Println("title-appid ", title, appid)
+	ret := map[string]interface{}{}
+	if appid == "jianyu360" && title != "" {
+		qstr := fmt.Sprintf(`{
+  "query": {
+    "bool": {
+      "must": [
+        {
+          "multi_match": {
+            "query": "%s",
+            "type": "phrase",
+            "fields": [
+              "title"
+            ]
+          }
+        }
+      ]
+    }
+  }
+}`, title)
+		count := Es.Count("bidding", "", qstr)
+		if count > 0 {
+			ret["res"] = 1
+		} else {
+			ret["res"] = 0
+		}
+	}
+	WriteJSON("", w, &ret)
+}