|
@@ -11,6 +11,7 @@ import (
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"encoding/pem"
|
|
"encoding/pem"
|
|
"errors"
|
|
"errors"
|
|
|
|
+ "fmt"
|
|
"hash"
|
|
"hash"
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"log"
|
|
"log"
|
|
@@ -363,3 +364,36 @@ func parsePrivateKey(key string) (*rsa.PrivateKey, error) {
|
|
|
|
|
|
return rsaPrivateKey.(*rsa.PrivateKey), nil
|
|
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)
|
|
|
|
+}
|