张金坤 9 éve
szülő
commit
eb488a74c8

+ 2 - 2
core/src/config.json

@@ -32,6 +32,6 @@
     "pushRpc": "127.0.0.1:8766",
     "domainName": "http://www.qimingxing.info",
     "ocr_uid": "120.25.216.197",
-    "ocr_servicekey": "91e77f8a-cb28-4fc2-96d7-5b08e7dfb6c5",
-    "ocr_servicecode": "cf22e3bb-d41c-47e0-aa44-a92984f5829d"
+    "ocr_servicekey": "c1608f6b-b507-46d4-98de-12e98f613715",
+    "ocr_servicecode": "91f6a58d-e418-4e58-8ec2-61b583c55ba2"
 }

+ 1 - 1
core/src/message.json

@@ -2,7 +2,7 @@
 	"weixinrpc":"127.0.0.1:82",
 	"swordfishaction":"/swordfish/page",
 	"signature":"/member/credit/myCredit",
-	"entsearchaction":"/front/entCommunity.html",
+	"entsearchaction":"/wx/search/enterprise/index.html",
 	"lawsearchaction":"/law/qfw/index",
 	"msiteaction":"/ent/wsite/edit",
 	"wxpushlist":"/wxpush/bidinfo/%s",

+ 3 - 2
core/src/qfw/coreutil/imagemsghandler.go

@@ -9,10 +9,11 @@ import (
 	"net/http"
 	"os"
 	cf "qfw/coreconfig"
+	"qfw/util"
 )
 
 //名片识别
-func CardRecognition(picpath string) []interface{} {
+func CardRecognition(picpath string) (string, []interface{}) {
 	comps := []interface{}{}
 	//识别
 	fi, _ := os.Open(picpath)
@@ -38,5 +39,5 @@ func CardRecognition(picpath string) []interface{} {
 	if v, ok := ocr_ret["comp"]; ok {
 		comps, _ = v.([]interface{})
 	}
-	return comps
+	return util.ObjToString(ocr_ret["code"]), comps
 }

+ 17 - 14
core/src/qfw/search/wxsearchservice.go

@@ -495,35 +495,38 @@ func wxsearhWebContententMp(querymap map[string]string, n *Wxsearch, reqType str
 
 //获取名片名称
 func (n *Wxsearch) WxMingpian() error {
-	res := make(map[string]string)
-	res["name"] = ""
-	res["on"] = "y"
+	res := make(map[string]interface{})
+	names := []string{}
+	res["on"] = "y" //y正常,n调用频繁或超出调用次数
 	if n.GetSession("s_m_openid") != nil {
 		serverId := n.GetString("serverId")
 		ret := coreutil.WxDownloadImg(serverId)
 		if len(ret) > 1 {
 			log.Println("picpath", ret[1])
 			res["on"] = ret[0]
-			names := coreutil.CardRecognition(ret[1])
-			for _, v := range names {
+			code, tmps := coreutil.CardRecognition(ret[1])
+			if code == "434" {
+				res["on"] = "n"
+			}
+			tmps2 := []string{}
+			for _, v := range tmps {
 				name := fmt.Sprint(v)
 				if mpian_reg.MatchString(name) {
-					res["name"] = name
-					break
+					names = append(names, name)
+				} else {
+					tmps2 = append(tmps2, name)
 				}
 			}
-			var name = ""
-			if res["name"] == "" {
-				for _, v := range names {
-					tmp := fmt.Sprint(v)
-					if len(name) < len(tmp) {
-						name = tmp
+			if len(names) < 5 {
+				for _, v := range tmps2 {
+					if len(v) > 5 && len(names) < 6 {
+						names = append(names, v)
 					}
 				}
-				res["name"] = name
 			}
 		}
 	}
+	res["names"] = names
 	n.ServeJson(&res)
 	return nil
 }