浏览代码

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

Conflicts:
	core/src/web/templates/member/incmobile/index.html
李广朋 9 年之前
父节点
当前提交
46ea5943e3

+ 6 - 4
core/src/config.json

@@ -28,8 +28,10 @@
     "mailFailureTime": 3,
     "chatServer": "127.0.0.1:83",
     "chatRpc": "127.0.0.1:88",
-	"creditRpc":"127.0.0.1:8765",
-	"pushRpc":"127.0.0.1:8766",
-	"domainName":"http://www.qimingxing.info"
-
+    "creditRpc": "127.0.0.1:8765",
+    "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"
 }

+ 1 - 1
core/src/message.json

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

+ 3 - 0
core/src/qfw/coreconfig/SysConfig.go

@@ -25,6 +25,9 @@ type config struct {
 	PushRpc         string      `json:"pushRpc"`
 	ElasticPoolSize int         `json:"elasticPoolSize"`
 	DomainName      string      `json:"domainName"`
+	Ocr_uid         string      `json:"orc_uid"`
+	Ocr_servicekey  string      `json:"ocr_servicekey"`
+	Ocr_servicecode string      `json:"ocr_servicecode"`
 }
 type smtp struct {
 	Addr     string `json:"addr"`

+ 42 - 0
core/src/qfw/coreutil/imagemsghandler.go

@@ -0,0 +1,42 @@
+package coreutil
+
+import (
+	"bytes"
+	"encoding/base64"
+	"encoding/json"
+	"fmt"
+	"io/ioutil"
+	"net/http"
+	"os"
+	cf "qfw/coreconfig"
+)
+
+//名片识别
+func CardRecognition(picpath string) []interface{} {
+	comps := []interface{}{}
+	//识别
+	fi, _ := os.Open(picpath)
+	bs, _ := ioutil.ReadAll(fi)
+	fi.Close()
+	hurl := fmt.Sprintf("http://api.hanvon.com/rt/ws/v1/ocr/bcard/recg?key=%s&code=%s",
+		cf.SysConfig.Ocr_servicekey, cf.SysConfig.Ocr_servicecode)
+	body := map[string]interface{}{
+		"uid":   cf.SysConfig.Ocr_uid,
+		"color": "original",
+		"lang":  "auto",
+		"image": base64.StdEncoding.EncodeToString(bs),
+	}
+	bs, _ = json.Marshal(body)
+	client := &http.Client{}
+	req, _ := http.NewRequest("POST", hurl, bytes.NewReader(bs))
+	req.Header.Set("Content-Type", "application/octet-stream")
+	resp, _ := client.Do(req) //发送
+	ret, _ := ioutil.ReadAll(resp.Body)
+	resp.Body.Close()
+	ocr_ret := map[string]interface{}{}
+	json.Unmarshal(ret, &ocr_ret)
+	if v, ok := ocr_ret["comp"]; ok {
+		comps, _ = v.([]interface{})
+	}
+	return comps
+}

+ 18 - 0
core/src/qfw/coreutil/weixinrpc.go

@@ -110,3 +110,21 @@ func GetShareQR(url uint32) string {
 	}, func(e interface{}) {})
 	return ret
 }
+
+//根据mediaid下载图片
+func WxDownloadImg(mediaid string) string {
+	var ret string
+	util.Try(func() {
+		client, err := rpc.DialHTTP("tcp", rpcserver)
+		defer client.Close()
+		if err != nil {
+			log.Println(err.Error())
+			return
+		}
+		err = client.Call("WeiXinRpc.DownloadMingpian", mediaid, &ret)
+		if err != nil {
+			log.Println(err.Error())
+		}
+	}, func(e interface{}) {})
+	return ret
+}

+ 2 - 2
core/src/qfw/filemanage/uploadfile.go

@@ -44,7 +44,7 @@ func (m *Files) Upload() error {
 				if fileInfo.Size() > FileSize {
 					res["msg"] = "上传文件大小超出限制"
 				} else {
-					temp := getfilepath(str[len(str)-1])
+					temp := Getfilepath(str[len(str)-1])
 					err := m.SaveToFile(filetype, temp)
 					if err != nil {
 						log.Error(err.Error())
@@ -107,7 +107,7 @@ type Size interface {
 }
 
 //获取文件路径、名称
-func getfilepath(str string) (s string) {
+func Getfilepath(str string) (s string) {
 	var strs = time.Now().Format("20060102150405001")
 	var name = strs + util.GetRandom(5) + "." + str
 	var paht = "./web/staticres/upload/" + strs[:4] + "/" + strs[4:6] + "/" + strs[6:8] + "/"

+ 5 - 0
core/src/qfw/search/wxsearch.go

@@ -5,14 +5,19 @@ package search
 
 import (
 	"github.com/go-xweb/xweb"
+	"regexp"
 )
 
 type Wxsearch struct {
 	*xweb.Action
+	wxEnterprise        xweb.Mapper `xweb:"/wx/search/enterprise/index.html"`             //查询首页
+	wxMingpian          xweb.Mapper `xweb:"/wx/search/enterprise/mingpian"`               //获取名片
 	wxgetEnterpriseList xweb.Mapper `xweb:"/wx/search/enterprise/([^.]*)ent([^.]*).html"` //查询企业列表
 	wxsearchEntSer      xweb.Mapper `xweb:"/wx/searchEntSer/(.*)"`                        //获取企业的服务列表
 }
 
+var mpian_reg *regexp.Regexp //名片
 func init() {
+	mpian_reg, _ = regexp.Compile("公司|集团|厂|企业|投资")
 	xweb.AddAction(&Wxsearch{})
 }

+ 165 - 9
core/src/qfw/search/wxsearchservice.go

@@ -7,8 +7,10 @@ import (
 	"github.com/go-xweb/xweb"
 	"html/template"
 	"log"
+	"qfw/coreutil"
 	"qfw/front"
 	. "qfw/member"
+	"qfw/mobile"
 	. "qfw/util"
 	"qfw/util/consts"
 	"qfw/util/elastic"
@@ -17,9 +19,37 @@ import (
 	"qfw/util/redis"
 	"strconv"
 	"strings"
-	_ "strings"
 )
 
+//微信企业查询首页
+func (s *Wxsearch) WxEnterprise() error {
+	s.T["signature"] = mobile.GetSignature(s.Url())
+	return s.Render("/member/incombile/index.html", &s.T)
+}
+
+//获取名片名称
+func (s *Wxsearch) WxMingpian() error {
+	res := make(map[string]string)
+	if s.GetSession("s_m_openid") != nil {
+		serverId := s.GetString("serverId")
+		picpath := coreutil.WxDownloadImg(serverId)
+		log.Println("picpath", picpath)
+		names := coreutil.CardRecognition(picpath)
+		for k, v := range names {
+			name := fmt.Sprint(v)
+			if mpian_reg.MatchString(name) {
+				res["name"] = name
+				break
+			}
+			if k == len(names)-1 {
+				res["name"] = name
+			}
+		}
+	}
+	s.ServeJson(&res)
+	return nil
+}
+
 //获取某个企业服务列表数据
 func (search *Wxsearch) WxsearchEntSer(id string) error {
 	if search.Method() == "POST" {
@@ -83,7 +113,7 @@ func (n *Wxsearch) WxgetEnterpriseList(reqType, param /*参数*/ string) error {
 	//必须是登录之后的已认证用户才可以进入企业社区
 	//if ui, _ := (n.GetSession("userInfo")).(*map[string]interface{}); reqType == "m_" || (n.GetSession("userType") != nil && IntAll(n.GetSession("userType")) > 0) && ((n.GetSession("identWay") != nil && IntAll(n.GetSession("identWay")) == 1) || ((*ui)["s_pid"] != nil && (*ui)["s_pid"].(string) != "")) {
 	//n.T["uri"] = n.Uri()
-
+	i_mingpian := n.GetString("i_mingpian") //是否走名片查询
 	if len(param) == 0 {
 		//请求是表单提交,走的查询
 		//拼装查询对象
@@ -96,11 +126,20 @@ func (n *Wxsearch) WxgetEnterpriseList(reqType, param /*参数*/ string) error {
 			"c_zb":        n.GetString("c_zb"),
 			"all":         n.GetString("all"),
 			"c_author":    n.GetString("c_author"),
-			"cityNo":      n.GetString("cityNo"), // 是否是第一次查询并且没有选择地市,自动根据IP来设
+			"cityNo":      n.GetString("cityNo"), //是否是第一次查询并且没有选择地市,自动根据IP来设
 		}
 		//查询生成列表数据
-		data, pagination := wxsearhWebContentent(querymap, n, reqType)
-		n.Render("/search/wxentlist.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
+		if i_mingpian != "" {
+			data, pagination, has := wxsearhWebContententMp(querymap, n, reqType, false)
+			n.Render("/member/incombile/list.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
+			if !has {
+				data, pagination := wxsearhWebContentent(querymap, n, reqType)
+				n.Render("/member/incombile/list.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
+			}
+		} else {
+			data, pagination := wxsearhWebContentent(querymap, n, reqType)
+			n.Render("/member/incombile/list.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
+		}
 	} else {
 		//反转生成map
 		paramstr := param[1:]
@@ -110,12 +149,9 @@ func (n *Wxsearch) WxgetEnterpriseList(reqType, param /*参数*/ string) error {
 		json.Unmarshal(bs, &querymap)
 		log.Println(querymap)
 		data, pagination := wxsearhWebContentent(querymap, n, reqType)
-		n.Render("/search/wxentlist.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
+		n.Render("/member/incombile/list.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
 	}
 	return nil
-	//} else {
-	//return n.Render("/search/entcommunity.html")
-	//}
 }
 
 //实际的查询企业社区业务逻辑
@@ -433,3 +469,123 @@ func wxsearhWebContentent(querymap map[string]string, n *Wxsearch, reqType strin
 	return &res, &pagination
 
 }
+
+//通过企业名片查询
+func wxsearhWebContententMp(querymap map[string]string, n *Wxsearch, reqType string, has bool) (*[]map[string]interface{}, *[]interface{}, bool) {
+	queryStr := querymap["query"]
+	fmt.Println("检索条件:", queryStr)
+	keyword := queryStr
+	var query = `{
+	    "query": {
+	        "bool": {
+	            "must": ["match": {"enterprise.EntName": {"query": "` + keyword + `","operator": "and"}}}],
+	            "must_not": {"terms": {"SourceType": ["03", "04"]}},
+	            "should": [],
+	            "minimum_should_match": 1
+	        }
+	    },
+	    "highlight": {
+	        "pre_tags": ["<span class='highlight'>"],
+	        "post_tags": ["</span>"],
+	        "fields": {
+	            "EntName": {"force_source": true},
+	            "LeRep": {"force_source": true},
+	            "s_servicenames": {"force_source": true},
+	            "RegNo": {"force_source": true},
+	            "OpScope": {"force_source": true},
+	            "s_synopsis": {"force_source": true},
+	            "stock": {"force_source": true}
+	        }
+	    },
+	    "_source": [
+	        "_id","EntName","RegOrgName","RegNo","EntType",
+	        "LeRep","EstDate","OpLocDistrictName","OpStateName",
+	        "s_servicenames","s_action","OpLocDistrict","s_submitid"
+	    ],
+	    "from": 0,"size": 10,
+	    "sort": [{"OpSint": "desc","RegCap": "desc"}]
+	}`
+	//查询列表数据
+	client := elastic.GetEsConn()
+	defer elastic.DestoryEsConn(client)
+	if client == nil {
+		return nil, nil, false
+	}
+	searchResult, err := client.Search().Index("enterprise").Type("enterprise").Source(query).Do()
+	if err != nil {
+		return nil, nil, false
+	}
+	var res []map[string]interface{}
+	if searchResult.Hits != nil {
+		resNum := len(searchResult.Hits.Hits)
+		res = make([]map[string]interface{}, resNum)
+		for i, hit := range searchResult.Hits.Hits {
+			json.Unmarshal(*hit.Source, &res[i])
+			//查询结果数据加工处理
+			for k, v := range hit.Highlight {
+				res[i][k] = v[0]
+			}
+			EntName, _ := res[i]["EntName"].(string)
+			if EntName != keyword {
+				continue
+			} else {
+				has = true
+			}
+			tmpNo := res[i]["EntType"]
+			if tmpNo != nil {
+				switch tmpNo.(string) {
+				case "4500", "6800", "6810", "6820", "7100", "7110", "7120", "7130", "7190", "9200", "6840", "2100", "2110", "2120", "2121", "2122", "2123", "2130", "2140", "2150", "2151", "2152", "2190", "2200", "2210", "2211", "2212", "2213", "2219", "2220", "2221", "2222", "2223", "2229", "4000", "4300", "4310", "4320", "4330", "4340", "4550", "4551", "4552", "4553", "4560", "5800", "5810", "5820":
+					res[i]["EntType"] = "5810"
+				}
+			}
+
+			entlerp, _ := res[i]["LeRep"].(string)
+			tmpentno, _ := res[i]["RegNo"].(string)
+			if len(keyword) < 1 {
+				tmpentno = strings.Replace(tmpentno, "highlight", "", -1)
+				EntName = strings.Replace(EntName, "highlight", "", -1)
+			}
+			res[i]["RegNo"] = template.HTML(tmpentno)
+			if tmpNo == "9600" && strings.Contains(EntName, tmpentno) {
+				res[i]["EntName"] = template.HTML(strings.Replace(EntName, tmpentno, entlerp, -1))
+			} else {
+				res[i]["EntName"] = template.HTML(EntName)
+			}
+
+			id := res[i]["s_submitid"]
+			if id != nil {
+				ud := FindById("user", id.(string), `{"i_comauthenttype":1}`)
+				res[i]["i_comauthenttype"] = (*ud)["i_comauthenttype"]
+			}
+			//
+
+			res[i]["tmpentno"] = template.HTML(tmpentno)
+			LeRep, _ := res[i]["LeRep"].(string)
+			res[i]["LeRep"] = template.HTML(LeRep)
+			s_servicenames, _ := res[i]["s_servicenames"].(string)
+			res[i]["s_servicenames"] = template.HTML(s_servicenames)
+
+			OpScope, _ := res[i]["OpScope"].(string)
+			if len(OpScope) > 0 {
+				res[i]["OpScope"] = template.HTML(OpScope)
+			}
+			s_synopsis, _ := res[i]["s_synopsis"].(string)
+			if len(s_synopsis) > 0 {
+				res[i]["s_synopsis"] = template.HTML(s_synopsis)
+			}
+			stock, _ := res[i]["stock"].(string)
+			if len(stock) > 0 {
+				res[i]["stock"] = template.HTML(stock)
+			}
+			tmpdate, _ := res[i]["EstDate"]
+			if tmpdate != nil {
+				res[i]["EstDate"] = FormatDateWithObj(&tmpdate, Date_Short_Layout)
+			} else {
+				res[i]["EstDate"] = ""
+			}
+		}
+	}
+	//生成分页
+	pagination := front.MakePagination(1, 1, 1, querymap, "/wx/search/enterprise/"+reqType+"ent_%s.html")
+	return &res, &pagination, has
+}

+ 12 - 8
core/src/qfw/swordfish/swordfish.go

@@ -9,14 +9,18 @@ import (
 
 type SwordFish struct {
 	*xweb.Action
-	swordfish     xweb.Mapper `xweb:"/front/swordfish"`                //剑鱼
-	rssSet        xweb.Mapper `xweb:"/member/swordfish/rssset"`        //订阅消息设置
-	infolist      xweb.Mapper `xweb:"/member/swordfish/infolist"`      //剑鱼
-	swordfishlist xweb.Mapper `xweb:"/member/swordfish/swordfishlist"` //剑鱼列表
-	setVisited    xweb.Mapper `xweb:"/member/swordfish/setVisited"`    //已经访问过的列表
-	visitRedirect xweb.Mapper `xweb:"/visit/redirect"`                 //剑鱼跳转访问请求,后续统计
-	protocol      xweb.Mapper `xweb:"/member/swordfish/protocol"`      //剑鱼协议
-	wxprotocol    xweb.Mapper `xweb:"/member/swordfish/wxprotocol"`    //微信剑鱼协议
+	swordfish      xweb.Mapper `xweb:"/front/swordfish"`                 //剑鱼
+	rssSet         xweb.Mapper `xweb:"/member/swordfish/rssset"`         //订阅消息设置
+	infolist       xweb.Mapper `xweb:"/member/swordfish/infolist"`       //剑鱼
+	swordfishlist  xweb.Mapper `xweb:"/member/swordfish/swordfishlist"`  //剑鱼列表
+	setVisited     xweb.Mapper `xweb:"/member/swordfish/setVisited"`     //已经访问过的列表
+	visitRedirect  xweb.Mapper `xweb:"/visit/redirect"`                  //剑鱼跳转访问请求,后续统计
+	protocol       xweb.Mapper `xweb:"/member/swordfish/protocol"`       //剑鱼协议
+	wxprotocol     xweb.Mapper `xweb:"/member/swordfish/wxprotocol"`     //微信剑鱼协议
+	searchinfolist xweb.Mapper `xweb:"/member/swordfish/searchinfolist"` //剑鱼查询
+	wxsearch       xweb.Mapper `xweb:"/member/wxswordfish/search"`       //剑鱼微信查询
+	wxsearchlist   xweb.Mapper `xweb:"/member/wxswordfish/searchlist"`   //剑鱼微信查询结果展示
+
 }
 
 func init() {

+ 100 - 0
core/src/qfw/swordfish/swordfishmanage.go

@@ -1,11 +1,15 @@
 package swordfish
 
 import (
+	"encoding/json"
 	_ "encoding/json"
 	"gopkg.in/mgo.v2/bson"
+	"log"
+	"net/rpc"
 	"qfw/util"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
+	qrpc "qfw/util/rpc"
 	"time"
 )
 
@@ -67,6 +71,102 @@ func (s *SwordFish) Wxprotocol() error {
 	return s.Render("/swordfish/wxprotocol.html")
 }
 
+//剑鱼微信查询页面
+func (s *SwordFish) Wxsearch() error {
+	s.T["keywords"] = ""
+	keywords := s.GetSession("sf_keywords")
+	if keywords != nil {
+		s.T["keywords"] = keywords
+	}
+	return s.Render("/swordfish/wxsearch.html", &s.T)
+}
+
+//剑鱼微信查询结果页面
+func (s *SwordFish) Wxsearchlist() error {
+	s_type := s.GetString("s_type")
+	s_name := s.GetString("s_name")
+	keywords := s.GetString("searchname")
+	if s_type == "1" {
+		s_type = "tender"
+	} else if s_type == "2" {
+		s_type = "bid"
+	}
+	s.T["keywords"] = keywords
+	s.SetSession("sf_keywords", keywords)
+	s.T["s_name"] = s_name
+	s.T["success"] = false
+	s.T["s_type"] = s.GetString("s_type")
+	log.Println("s_type:", s_type, "s_name:", s_name, "keywords:", keywords)
+	if len(s_name) > 0 {
+		clent, errs := rpc.DialHTTP("tcp", "127.0.0.1:8766")
+		defer clent.Close()
+		rpcData := qrpc.PushData{
+			//Mopenid: "oJULtwzXo6EFV1Ah-XeyRBimXGM8",
+			PushType: map[string]string{
+				s_type: s_type,
+			},
+			Words: s_name,
+		}
+		var repl []byte
+		clent.Call("PushInfo.ResultView", &rpcData, &repl)
+		if errs == nil && repl != nil && len(repl) > 0 {
+			var mp map[string]interface{}
+			json.Unmarshal(repl, &mp)
+			s.T["msglist"] = mp
+			bmatch := mp["bmatch"]
+			if bmatch == true {
+				s.T["success"] = true
+			}
+			log.Println(s.T["msglist"])
+		}
+	}
+	return s.Render("/swordfish/wxsearchlist.html", &s.T)
+}
+
+//跳转到用户中心查询剑鱼信息列表
+func (s *SwordFish) Searchinfolist() error {
+	//moborpc := s.GetString("moborpc")
+	s_type := s.GetString("s_type")
+	s_name := s.GetString("s_name")
+	keywords := s.GetString("searchname")
+	//	if moborpc == "pc" {
+	//	}
+	if s_type == "1" {
+		s_type = "tender"
+	} else if s_type == "2" {
+		s_type = "bid"
+	}
+	s.T["keywords"] = keywords
+	s.SetSession("sf_keywords", keywords)
+	s.T["s_name"] = s_name
+	s.T["success"] = false
+	s.T["s_type"] = s.GetString("s_type")
+	if len(s_name) > 0 {
+		clent, errs := rpc.DialHTTP("tcp", "127.0.0.1:8766")
+		defer clent.Close()
+		rpcData := qrpc.PushData{
+			//Mopenid: "oJULtwzXo6EFV1Ah-XeyRBimXGM8",
+			PushType: map[string]string{
+				s_type: s_type,
+			},
+			Words: s_name,
+		}
+		var repl []byte
+		clent.Call("PushInfo.ResultView", &rpcData, &repl)
+		if errs == nil && repl != nil && len(repl) > 0 {
+			var mp map[string]interface{}
+			json.Unmarshal(repl, &mp)
+			s.T["msglist"] = mp
+			bmatch := mp["bmatch"]
+			if bmatch == true {
+				s.T["success"] = true
+			}
+			log.Println(s.T["msglist"])
+		}
+	}
+	return s.Render("/swordfish/searchinfolist.html", &s.T)
+}
+
 //跳转到用户中心剑鱼信息列表
 func (s *SwordFish) Infolist() error {
 	ms := mongodb.FindById("user", s.GetSession("userId").(string), `{"o_msgset":1}`)

+ 1 - 1
core/src/seo.json

@@ -1,4 +1,4 @@
-{	"cdn":"//test.qmx.top:9010",
+{	"cdn":"//cdn.qmx.top:9000",
     "qfw": {
         "enterprise": {
             "description": "提供企业信息查询,企业产品服务查询,企业关系网展示",

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-03-16 08:54:17"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-03-16 08:54:17"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-03-21 15:35:25"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-03-21 15:35:25"}},"marketisstart":true,"marketrate":300}

二进制
core/src/web/staticres/images/wxjs.png


二进制
core/src/web/staticres/images/wxjss.png


二进制
core/src/web/staticres/images/wxqc.png


+ 7 - 1
core/src/web/templates/common/swordfishhead.html

@@ -5,7 +5,10 @@
 		<ul>
 			<li class="b-nav-logo"><a href="/"><img src="{{Msg "seo" "cdn"}}/images/logo.png" class="logo"></a></li>
 			<li class="b-nav-link b-nav-main"><a href="/front/swordfish">剑鱼</a></li>
-			<li class="b-nav-link b-nav-other"><a id="goToRssset">订阅设置</a><a class="b-nav-s"></a></li>
+			<li class="b-nav-link b-nav-other"><a id="goToSearch">信息查询</a>
+			<a class="b-nav-s"></a></li>
+			<li class="b-nav-link b-nav-other"><a id="goToRssset">我的订阅</a>
+			<a class="b-nav-s"></a></li>
 			<li class="b-nav-link b-nav-other"><a id="goToInfolist">推送记录</a></li>
 			<li class="pull-right b-loginStatus" id="b-loginStatus"></li>
 		</ul>
@@ -24,6 +27,9 @@ function b_afterLogin(flag,result){
 		$("#experience").click(function(){
 			window.location.href = "/member/swordfish/rssset";
 		});
+		$("#goToSearch").click(function(){
+			window.location.href = "/member/swordfish/searchinfolist";
+		});
 		$("#goToRssset").click(function(){
 			window.location.href = "/member/swordfish/rssset";
 		});

+ 3 - 14
core/src/web/templates/manage/web_newexpresslist.html

@@ -4,12 +4,8 @@
 {{include "/common/inc.html"}}
 <meta name="Keywords" content="{{Msg "seo" "qfw.newexpress.key"}}"/>
 <meta name="Description" content="{{Msg "seo" "qfw.newexpress.description"}}"/>
-<<<<<<< HEAD
-<script src="/js/validform-min.js"></script>
-<script src="/js/jquery.cookie.js"></script>
-=======
 <script src="{{Msg "seo" "cdn"}}/js/validform-min.js"></script>
->>>>>>> release
+<script src="{{Msg "seo" "cdn"}}/js/jquery.cookie.js"></script>
 <style type="text/css">
 <!--
 body{
@@ -192,9 +188,9 @@ font-weight:normal;
 		<div style="margin:15px 0px 0px 3px;"><a target="_blank" href="/front/webcontent/{{index $v "_id"}}.html" style="font-weight: bold; font-size: 16px;">{{index $v "s_title"}}</a></div>
 		<div class="form-group" style="margin-top:10px;height: 90px;" >
         <div class="col-sm-3 control-label" for="name">
-		<img class="newListImg" style="width:150px;height:90px; padding:2px;" src="{{if (index $v "s_pic1")}}{{index $v "s_pic1"}}{{else}}/images/services/default.png{{end}}"/>
+		<img class="newListImg" style="width:150px;height:90px; padding:2px;" src="{{if (index $v "s_pic1")}}{{Msg "seo" "cdn"}}{{index $v "s_pic1"}}{{else}}{{Msg "seo" "cdn"}}/images/services/default.png{{end}}"/>
 		</div>
-<<<<<<< HEAD
+
 	    <div class="col-sm-9 control-label" for="name" id="newsdiv">
 		<div class="newsdiv1">{{if eq (index $v "s_content") ""}}{{index $v "s_description"}}{{else}}{{index $v "s_content"}}{{end}}</div>
 		<div class="newsdiv2 font-size-12">
@@ -229,13 +225,6 @@ font-weight:normal;
 			
 		</div>
 		
-=======
-	    <div class="col-sm-10" class="control-label" for="name" >
-		<div><a target="_blank" href="/front/webcontent/{{index $v "_id"}}.html" style="font-weight: bold; font-size: 16px;">{{index $v "s_title"}}</a></div>
-		<div><p style="font-size:14px;  padding:10px 0px; color: #999999;" >{{if eq (index $v "s_author") ""}}{{else}}作者:{{index $v "s_author"}}  {{end}}文章来源:{{index $v "s_source"}}  发布日期:{{if eq (index $v "releasetime") ""}}{{index $v "l_createdate"}}{{else}}{{index $v "releasetime"}}{{end}}
-		<span style="float:right; color:#CCCCCC;"><img style="width:18px;" src="{{Msg "seo" "cdn"}}/images/u164.png"/> <div style="float:right; color:#999999; margin-top:-48px; margin-right:-15px;">{{index $v "praise"}}</div></span></p></div>
-		<div style=" font-size:14px;line-height:24px;color: #000000;">{{if eq (index $v "s_content") ""}}{{index $v "s_description"}}{{else}}{{index $v "s_content"}}{{end}}</div>
->>>>>>> release
 		</div>
 		</div>
 		</td>

+ 86 - 7
core/src/web/templates/member/incmobile/index.html

@@ -7,6 +7,7 @@
 		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0" user-scalable="yes" />
 		<link href="/css/bootstrap.min.css" rel="stylesheet">
 		<link href="/css/mobile/incmobile.css" rel="stylesheet">
+		<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
 		<style>
 			.index-bodybg{
 				color:#FFF;
@@ -75,6 +76,51 @@
 				padding-left:25px;
 			}
 		</style>
+<script>
+var signature = {{.T.signature}};
+var shareTitle = "企业社区";
+var shareLink = "http://www.qimingxing.info/wx/search/enterprise/index.html";
+var shareIcon = "";
+if(typeof(signature) != "undefined" && signature != null && signature.length == 4){
+	wx.config({
+	    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+	    appId: signature[0], // 必填,公众号的唯一标识
+	    timestamp:signature[1], // 必填,生成签名的时间戳
+	    nonceStr: signature[2], // 必填,生成签名的随机串
+	    signature: signature[3],// 必填,签名,见附录1
+	    jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage',
+					'chooseImage','uploadImage','downloadImage']
+	});
+	wx.ready(function () {
+        wx.onMenuShareTimeline({
+		    title: shareTitle, // 分享标题
+		    link: shareLink, // 分享链接
+		    imgUrl: shareIcon, // 分享图标
+		    success: function () { 
+		       //alert('分享成功');
+		    },
+		    cancel: function () { 
+		       //alert('分享失败,或用户取消了');
+		    }
+		});
+
+		wx.onMenuShareAppMessage({
+		    title: shareTitle, // 分享标题
+		    desc: '企明星企业', // 分享描述
+		    link:  shareLink,// 分享链接
+		    imgUrl: shareIcon, // 分享图标
+		    type: 'link', // 分享类型,music、video或link,不填默认为link'
+		    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+		    success: function () { 
+		        //alert('分享成功');
+		    },
+		    cancel: function () { 
+				//alert('分享失败,或用户取消了');
+		    }
+		});
+    });
+}	
+</script>
 	</head>
 <body class="index-bodybg">
 		<div class="main">
@@ -103,12 +149,45 @@
 						</div>
 	      </div>
 		</footer>
-		<script src="/js/jquery.js"></script>
-		<script src="/js/qfw.js"></script>
-		<script>
-		//	$("#query").keyup(function(){
-		//		imFind(this);
-		//	});
-		</script>
+<script src="/js/jquery.js"></script>
+<script src="/js/qfw.js"></script>
+<script>
+$(".input-group-addon").click(function(){
+alert();
+	wx.chooseImage({
+	    count: 1, // 默认9
+	    sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
+	    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
+	    success: function (res) {
+	        var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
+			uploadImage(localIds[0]);
+	 	}
+	});
+})
+
+function uploadImage(localId){
+	wx.uploadImage({
+	    localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
+	    isShowProgressTips: 1, // 默认为1,显示进度提示
+	    success: function (res) {
+	        getmpname(res.serverId); // 返回图片的服务器端ID
+	 	}
+	});
+} 
+//获取企业名称
+function getmpname(serverId){
+	$.ajax({ 
+        type: 'post', 
+        url: '/wx/search/enterprise/mingpian', 
+		data:{serverId:serverId},
+        cache: false, 
+        error: function(){return false;}, 
+        success:function(obj){
+			alert(obj["name"]);
+        } 
+    }); 
+}
+</script>
+
 </body>
 </html>

+ 0 - 11
core/src/web/templates/search/entcommunity.html

@@ -49,17 +49,6 @@
 			</div>
 		</div>
 	</div>
-<<<<<<< HEAD
-=======
-	{{if session "userId"}}
-	<a href="/member/authentication/index" class="btn btn-primary">认证</a><br>
-	<span class="text-muted">认证后可正常使用</span><br>
-	{{else}}
-	<a href="/front/register" class="btn btn-primary">注册</a><br>
-	<span class="text-muted">注册认证后可正常使用,已有账号<a class="a-com-login">立即登录</a></span><br>
-	{{end}}
-	<img src="{{Msg "seo" "cdn"}}/images/qysq-1.png">
->>>>>>> release
 </div>
 {{include "/common/bottom.html"}}
 <script>

+ 107 - 0
core/src/web/templates/search/wxent.html

@@ -0,0 +1,107 @@
+<html>
+<head>
+<title>{{Msg "seo" "qfw.enterprise.title"}}</title>
+<meta name="msvalidate.01" content="D5F3ADC7EB4E65FFB8BF943AD56DD1F7" />
+{{include "/common/inc.html"}}
+<link href="/css/entcommunity.css" rel="stylesheet">
+<meta name="Keywords" content="{{Msg "seo" "qfw.enterprise.key"}}"/>
+<meta name="Description" content="{{Msg "seo" "qfw.enterprise.description"}}"/>
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script>
+var signature = {{.T.signature}};
+var shareTitle = "企业社区";
+var shareLink = "http://www.qimingxing.info/wx/search/enterprise/wxent.html";
+var shareIcon = "";
+if(typeof(signature) != "undefined" && signature != null && signature.length == 4){
+	wx.config({
+	    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+	    appId: signature[0], // 必填,公众号的唯一标识
+	    timestamp:signature[1], // 必填,生成签名的时间戳
+	    nonceStr: signature[2], // 必填,生成签名的随机串
+	    signature: signature[3],// 必填,签名,见附录1
+	    jsApiList: ['onMenuShareTimeline','onMenuShareAppMessage',
+					'chooseImage','uploadImage','downloadImage']
+	});
+	wx.ready(function () {
+        wx.onMenuShareTimeline({
+		    title: shareTitle, // 分享标题
+		    link: shareLink, // 分享链接
+		    imgUrl: shareIcon, // 分享图标
+		    success: function () { 
+		       //alert('分享成功');
+		    },
+		    cancel: function () { 
+		       //alert('分享失败,或用户取消了');
+		    }
+		});
+
+		wx.onMenuShareAppMessage({
+		    title: shareTitle, // 分享标题
+		    desc: '企明星企业', // 分享描述
+		    link:  shareLink,// 分享链接
+		    imgUrl: shareIcon, // 分享图标
+		    type: 'link', // 分享类型,music、video或link,不填默认为link'
+		    dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+		    success: function () { 
+		        //alert('分享成功');
+		    },
+		    cancel: function () { 
+				//alert('分享失败,或用户取消了');
+		    }
+		});
+		
+		
+    });
+}	
+</script>
+</head>
+<body>
+<div class="b-content container-fluid">
+	 <div class="b-com-third input-group">
+		<input type="text" class="form-control" name="entIndexSearch" id="header-searchInput" placeholder="找企业"  aria-describedby="search-btn" value=""> 
+		<span class="input-group-addon" id="search-btn"><span class="glyphicon sousuo"></span>照相</span>
+	</div>
+ <img src="" id="testimg"/>
+
+</div>
+<script>
+$("#search-btn").click(function(){
+	wx.chooseImage({
+	    count: 1, // 默认9
+	    sizeType: ['compressed'], // 可以指定是原图还是压缩图,默认二者都有
+	    sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
+	    success: function (res) {
+	        var localIds = res.localIds; // 返回选定照片的本地ID列表,localId可以作为img标签的src属性显示图片
+			uploadImage(localIds[0]);
+	 	}
+	});
+})
+function uploadImage(localId){
+	wx.uploadImage({
+	    localId: localId, // 需要上传的图片的本地ID,由chooseImage接口获得
+	    isShowProgressTips: 1, // 默认为1,显示进度提示
+	    success: function (res) {
+	        var serverId = res.serverId; // 返回图片的服务器端ID
+			alert(serverId);
+			//document.write(serverId);
+			getmpname(serverId);
+	 	}
+	});
+} 
+ 
+//获取企业名称
+function getmpname(serverId){
+	$.ajax({ 
+        type: 'post', 
+        url: '/wx/search/enterprise/mingpian', 
+		data:{serverId:serverId},
+        cache: false, 
+        error: function(){return false;}, 
+        success:function(obj){
+			alert(obj["name"]);
+        } 
+    }); 
+}
+</script>
+</body>
+</html>

+ 1 - 1
core/src/web/templates/swordfish/infolist.html

@@ -15,7 +15,7 @@
 		a_interest={{.T.msgset.o_msgset.tender.a_key}};
 	}
 $(function(){
-	$(".b-nav>ul>li:eq(3)").addClass("b-nav-active");
+	$(".b-nav>ul>li:eq(4)").addClass("b-nav-active");
 	if(s_words.length!=0){
 		$("#okeywords").append(s_words.join(" ; ").replace(/\+/gm," "));
 	}else{

+ 1 - 1
core/src/web/templates/swordfish/rssset.html

@@ -351,7 +351,7 @@ $(function(){
 			autoChecked("bid",i_switchstatus==1?true:false,i_switchstatus);
 		}
 	}
-	$(".b-nav>ul>li:eq(2)").addClass("b-nav-active");
+	$(".b-nav>ul>li:eq(3)").addClass("b-nav-active");
 	$("#ckys").click(function(){
 		window.location.href="/front/swordfish";
 	});

+ 366 - 0
core/src/web/templates/swordfish/searchinfolist.html

@@ -0,0 +1,366 @@
+<html>
+<head>
+<title>信息检索</title>
+{{include "/common/inc.html"}}
+</head>
+<body>
+<script type="text/javascript">
+$(function(){
+	
+	$(".b-nav>ul>li:eq(2)").addClass("b-nav-active");
+	var seap = {{.T.s_type}};
+	if (seap.length < 1){
+		seap = "1"
+	}
+	type(seap);
+	var s_words = [];
+	s_words = {{.T.s_name}};
+	
+	var flog = {{.T.success}};
+	if (!flog){
+		$("#conlist").html('<div class="text-center"><div ><img style="width:137px;margin-top:60px;" src="/images/findnull.png"></div><div style="margin-bottom:50px;">没有找到和该关键词匹配的信息</div></div>');
+	}else{
+		$("#searchts").removeClass("hidden");
+		var str = ""
+		var temp = {{.T.msglist}}
+		str+=temp["s_content"];
+		a_visitedindex=temp["a_visitedindex"];
+		a_publishtime=temp["a_publishtime"];
+		f_id=temp["_id"];
+		$("#conlist").append('<div id="ycwords" datatype="'+temp["s_type"]+'">'+str+'</div>')
+		//信息条总数
+		le=$(".tslist").length;
+		//
+		$(".tslist").each(function(i){
+			$(this).children(".xh").text(function(i,v){
+				v = v.replace(".","")
+				return v
+			});
+			//关键词高亮
+			var html = $(this).html();
+				if(s_words != ""){
+					var wordsArray = s_words.split("+");
+					for(var si=0;si<wordsArray.length;si++){
+						var reg = new RegExp(wordsArray[si],"g");
+						html = html.replace(reg,function(word){
+							return '<font class="keyword">'+word+'</font>';
+						});
+					}
+				}
+			
+			
+			$(this).html(html);
+			//已访问过的灰色
+			var xh = $(this).children(".xh").text();
+			if(typeof(a_visitedindex)!= "undefined"){
+				for(var i=0;i<a_visitedindex.length;i++){
+					if(xh == a_visitedindex[i]){
+						$(this).find("a.bt").addClass("visited");
+					}
+				}
+			}
+			var datatype = $(this).parents("#ycwords").attr("datatype");
+			//if(datatype == "bid"){
+			//	datatype = "【中标公告】";
+			//}else if(datatype == "tender"){
+			//	datatype = "【招标公告】";
+			//}else{
+				datatype = "";
+			//}
+			$(this).find("a.bt").prepend(datatype).wrap("<div class='bt-parent' id="+xh+"></div>");
+			$(this).append(function(){
+				if(a_publishtime == "" || typeof(a_publishtime[xh]) == "undefined"){
+					return "";
+				}else{
+					var date1=new Date(Number(a_publishtime[xh]+"000"));//开始时间
+					var date2=new Date();//结束时间
+					var date3=date2.getTime()-date1.getTime();//时间差的毫秒数
+					//计算出相差天数
+					var days=Math.floor(date3/(24*3600*1000));
+					//计算出小时数
+					var leave1=date3%(24*3600*1000);//计算天数后剩余的毫秒数
+					var hours=Math.floor(leave1/(3600*1000));
+					//计算相差分钟数
+					var leave2=leave1%(3600*1000);//计算小时数后剩余的毫秒数
+					var minutes=Math.floor(leave2/(60*1000));
+					//计算相差秒数
+					/*var leave3=leave2%(60*1000);//计算分钟数后剩余的毫秒数
+					var seconds=Math.round(leave3/1000);*/
+					var timeDiff = "1分钟";
+					if(days > 0){
+						timeDiff = days+"天";
+					}else if(hours > 0){
+						timeDiff = hours+"小时";
+					}else if(minutes > 0){
+						timeDiff = minutes+"分钟";
+					}
+					return '<span class="time-diff">'+timeDiff+'前</span>';
+				}
+			});
+		});
+	}
+	setTimeout(function(){
+			var abt=$("a.bt");
+			abt.each(function(){
+				var h=$(this).attr("href");
+				$(this).removeAttr("target");
+				$(this).removeAttr("href");
+				if (h.indexOf("java")==-1){							
+					$(this).attr("s",h)
+					$(this).attr("f_id",f_id)
+					$(this).attr("href","javascript:void(0);")	
+				}
+			})
+			abt.click(function(){
+				var h=$(this).attr("s");
+				open_window(h);
+				return false;
+			})
+		},800)
+});
+
+
+	
+</script>
+<style type="text/css">
+#kong{
+	margin-top:120px; 
+	margin-bottom:150px;
+	font-size:18px;
+	cursor:hand;
+}
+.visited{
+	color: #a0a0a0;
+}
+.time-diff{
+	color: #a0a0a0;
+	font-size: 14px;
+	display: inline-block;
+	width: 40px;
+	white-space:nowrap;
+	margin-left: 50px;
+}
+.keyword{
+	color: #FF5A5F;
+}
+.tim{
+	padding:21px 0px;
+}
+.row{
+	margin-left:10px;
+	margin-right:10px;
+}
+#ycwords>div:first-of-type{
+	display:none;
+}
+#forkw{
+	margin-top: 15px;
+	padding:10px 0px 10px 50px;
+	background-color: #F7F8FA;
+	color: #a0a0a0;
+}
+.xh{
+	width: 10%;
+	color:#35C5DA;
+	font-size:15px;
+	font-weight:bold;
+	margin:0px 10px;
+	float:left;
+	display: inline-block; 
+	width:18px;
+	text-align:right;
+}
+.tslist{
+	border-bottom:1px solid #ccc;
+	width:100%; 
+	padding:15px 0px;
+}
+#timestamp{
+	color:#ccc;
+}
+#bt{
+	font-size:15px;
+}
+#more{
+	border:1px solid #ccc; 
+	margin:20px;
+}
+.btn-link:hover{
+	text-decoration:none;
+}
+.btn-link{
+	text-decoration:none; 
+	color:#000;
+}
+.bt-parent{
+	width: 82%;
+	display: inline-block;
+}
+#searchtitle{
+	padding:25px 30px 10px 30px;
+}
+#searchtitle span{
+	padding:0px 20px;
+	font-size:16px;
+	cursor:hand;
+	margin-left:-10px;
+}
+#searchtitle span:hover{
+	color:#37c6da;
+}
+#searchzhb2{
+	border-left:2px solid rgb(229, 230, 233);
+	border-right:2px solid rgb(229, 230, 233);
+}
+.searchactive{
+	color:rgb(53, 197, 218);
+}
+.searchbtn{
+	border:1px solid #37c6da;
+	background-color:#37c6da;
+	height:38px; 
+	width:130px; 
+	line-height:38px;
+	border-radius: 4px;
+	color:#fff;
+	padding-left:28px;
+	font-size:15px;
+	cursor:hand;
+}
+.rsssetbtn{
+	border:1px solid #37c6da; 
+	height:38px; 
+	width:180px; 
+	line-height:38px;
+	vertical-align: middle;
+	border-radius: 4px;
+	padding-left:28px;
+	font-size:15px;
+	cursor:hand;
+}
+#conlist{
+	padding:20px 50px 10px 0px;
+	margin-left:30px;
+}
+.tslist {
+	padding-left:0px !important;
+}
+
+.dybtn{
+	border:1px solid #37c6da;
+	background-color:#37c6da;
+	height:38px; 
+	width:130px; 
+	line-height:38px;
+	border-radius: 4px;
+	color:#fff;
+	font-size:15px;
+	cursor:hand;
+    display: inline-block;
+	margin:10px;
+}
+</style>
+<!-- 头部 -->
+{{include "/common/swordfishhead.html"}}
+<!-- 中间 -->
+<div class="b-content container-fluid">
+	<div class="b-left">
+		<div class="swordfish-page-title">
+			<i class="img-circle glyphicon jianyu"></i>信息查询
+		</div>
+		<!-- 关键词提示start -->
+		<div id="searchtitle" >
+		<span onClick="type(1)" id="searchzhb1" class="searchactive">招标公告</span>
+		<span onClick="type(2)" id="searchzhb2">中标公告</span>
+		<span id="searchzhb3">企业情报</span>
+		</div>
+		<div id="listform" style="padding:0px 0px 10px 40px">
+		<form action="/member/swordfish/searchinfolist" name="searchsword" method="post">
+		<div class="form-group">
+		<div class="col-sm-7">
+        <input class="form-control" id="searchname" name="searchname" value="{{.T.keywords}}" style="background-color:#FFFFFF; border:1px solid #e5e6e9;" placeholder="输入关键词查询"/>
+	    </div>
+		<div class="col-sm-2">
+		<input name="s_type" id="sea_type" value="1" style="display:none;"/>
+		<input name="s_name" id="sea_name" value="" style="display:none;"/>
+		<div class="searchbtn" onclick="subsea()"><i class="glyphicon sousuo"></i> 查询</div>
+		</div>
+		<div class="col-sm-3">
+        <!--<div class="rsssetbtn" onClick="window.location.href='/member/swordfish/rssset';">进入我的信息订阅</div>-->
+		</div>
+		</div>
+		</form>
+		</div>
+		<!-- 关键词提示end -->
+		<!-- 列表start -->
+		<div class="row"><div  class="col-sm-12" id="conlist"></div></div>
+		<!-- 列表end -->
+		<div id="more" class="hidden">
+			<div class="row">
+			    <div class="col-sm-12 btn btn-link text-center" onClick="loadMore()">
+		        点击加载更多
+				</div>
+			</div>
+		</div>
+		<div id="searchts" class="text-center hidden">
+		<div class="dybtn"  onClick="window.location.href='/member/swordfish/rssset';">订阅</div>
+		<div>确认该关键词查询结果无误</div>
+		</div>	
+	</div>
+	<div class="b-right swordfish-qrcode text-center">
+		<img src="/images/swordfish/qrcode.png">
+		<br>关注微信公众号:企明星
+	</div>
+</div>
+
+<!-- 按钮触发模态框 -->
+<button class="btn hidden kfing" data-toggle="modal" 
+   data-target="#myModal">
+</button>
+
+<!-- 模态框(Modal) -->
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" 
+   aria-labelledby="myModalLabel" aria-hidden="true">
+   <div class="modal-dialog">
+      <div class="modal-content" style="height:500px;">
+         <div class="modal-header">
+            <button type="button" class="close" 
+               data-dismiss="modal" aria-hidden="true">
+                  &times;
+            </button>
+            <h4 class="modal-title" id="myModalLabel">
+               企业情报
+            </h4>
+         </div>
+         <div class="modal-body text-center" style="margin-top:150px;">
+            开发中,敬请期待!
+         </div>
+         
+      </div><!-- /.modal-content -->
+</div><!-- /.modal -->
+</div>
+<!-- 底部 -->
+{{include "/common/bottom.html"}}
+<script type="text/javascript">
+$("#searchzhb3").click(function(){
+	$(".kfing").click();
+});
+function subsea(){
+	var searchname = $("#searchname").val();
+	searchname = searchname.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"+");
+	document.getElementById("sea_name").value = searchname;
+	document.forms['searchsword'].submit();
+}
+function type(i){
+	document.getElementById("sea_type").value = i;
+	for (j=1;j<3;j++){
+		if (j==i){
+			$("#searchzhb"+i).addClass("searchactive");
+		}else{
+			$("#searchzhb"+j).removeClass("searchactive");
+		}
+	}
+}
+</script>
+</body>
+</html>

+ 167 - 0
core/src/web/templates/swordfish/wxsearch.html

@@ -0,0 +1,167 @@
+<html>
+<head>
+<title>企明星-剑鱼-信息检索</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="renderer" content="webkit">
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+{{include "/common/inc.html"}}
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/main.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/jquery.resize.js"></script>
+<script>
+	var msgset= {{.T.msgset}};
+	initShare({{.T.signature}},{{.T.shareid}});
+	$(function(){
+		$(".searchname").focus();
+	});
+</script>
+<style type="text/css">
+.searchname{
+	background-color:#FFFFFF; 
+	border:1px solid #e5e6e9;
+	height:45px;
+	width:100%;
+    border-radius: 10px;
+	padding:2px 10px 2px 60px;
+	font-size:16px;
+	position:relative;
+}
+.wxhead{
+    padding: 10px 15px;
+	background-color:#F0F0F0;
+}
+.tubiao img{
+    position: absolute;
+    z-index: 10;
+    margin-top: 12px;
+    color: #000;
+	margin-left:20px;
+	height:25px;
+}
+.xiaochu{
+	float:right;
+}
+.xiaochu img{
+    position: absolute;
+    z-index: 10;
+    top: 20px;
+	right: 30px;
+	height:25px;
+}
+.searchzhao1,.searchzhong1{
+	float:left;
+	width:10%;
+	margin-top: 10px;
+	cursor:hand;
+}
+
+.searchzhao1 img,.searchzhong1 img{
+	height:25px;
+	
+}
+.searchzhao2,.searchzhong2{
+	float:left;
+	margin:0px 5px;
+	width:35%;
+}
+.searchzhao3,.searchzhong3{
+	float:left;
+	width:140px;
+    white-space: nowrap;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+.searchzhao3 span , .searchzhong3 span{
+	float:left;
+	
+}
+.rsssetbtn{
+	border:1px solid #37c6da; 
+	background-color:#37c6da;
+	height:38px; 
+	width:100%; 
+	line-height:38px;
+	vertical-align: middle;
+	border-radius: 4px;
+	font-size:15px;
+	color:#fff;
+}
+#myorder{
+	width:100%; 
+	margin-top:40px;
+	padding:0px 30px;
+}
+.searchshow{
+	border-top:1px solid #e5e6e9;
+	padding:10px 20px;
+}
+</style>
+</head>
+<body>
+
+<div class="wxhead"><span class="tubiao"><img src="/images/wxjss.png"/></span><input class="form-control searchname" name="searchnameshow" value="{{.T.keywords}}" placeholder="输入关键词查询"/>
+<span class="xiaochu"><img class="qcimg" src="/images/wxqc.png"/></span>
+</div>
+<div class="searchshow">
+	<form action="/member/wxswordfish/searchlist" name="searchone" method="post">
+		<div onClick="searchbiao(1)" style="height:45px;line-height:45px;cursor:hand;">
+		<div class="searchzhao1"><img src="/images/wxjs.png"/></div>
+		<div class="searchzhao2">查询招标公告:</div>
+		<div class="searchzhao3">
+		<span>{{.T.keywords}}</span>
+		</div>
+		<div style="both:clear;"></div>
+		<input name="searchname" id="searchname1" value="" style="display:none;"/>
+		<input name="s_type" id="sea_type" value="1" style="display:none;"/>
+		<input name="s_name" id="sea_name1" value="" style="display:none;"/>
+		</div>
+	</form>
+		<div  style="border-top:1px solid #e5e6e9; width:100%;"></div>
+	<form action="/member/wxswordfish/searchlist" name="searchtwo" method="post">
+		<div onClick="searchbiao(2)" style="height:45px;line-height:45px;cursor:hand;">
+		<div class="searchzhong1"><img src="/images/wxjs.png"/></div>
+		<div class="searchzhong2">查询中标公告:</div>
+		<div class="searchzhong3">
+		<span>{{.T.keywords}}</span>
+		</div>
+		<div style="both:clear;"></div>
+		<input name="searchname" id="searchname2" value="" style="display:none;"/>
+		<input name="s_type" id="sea_type" value="2" style="display:none;"/>
+		<input name="s_name" id="sea_name2" value="" style="display:none;"/>
+		</div>
+	</form>
+		<div style="border-top:1px solid #e5e6e9; width:100%;"></div>
+		<div id="myorder" class="text-center">
+		<div class="rsssetbtn" onClick="window.location.href='/swordfish/page';">进入我的信息订阅</div>
+		</div>
+</div>
+{{include "/swordfish/wxtoolbar.html"}}
+<script type="text/javascript">
+	$(".searchname").keyup(function(){
+        var restr = $(".searchname").val();
+		$(".searchzhao3 span").html(restr);
+		$(".searchzhong3 span").html(restr);
+    });
+	$(".qcimg").click(function(){
+		$(".searchname").val("");
+		$(".searchzhao3 span").html("");
+		$(".searchzhong3 span").html("");
+	});
+	function searchbiao(i){
+		var searchname = $(".searchname").val();
+		document.getElementById("searchname"+i).value = searchname;
+		searchname = searchname.replace(/^\s+|\s+$/g,"").replace(/\s+/g,"+");
+		document.getElementById("sea_name"+i).value = searchname;
+		if (i==1){
+			document.forms['searchone'].submit();
+		}else{
+			document.forms['searchtwo'].submit();
+		}
+		
+	}
+</script>
+</body>
+</html>

+ 317 - 0
core/src/web/templates/swordfish/wxsearchlist.html

@@ -0,0 +1,317 @@
+<html>
+<head>
+<title>企明星-剑鱼-信息检索结果</title>
+<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<meta name="renderer" content="webkit">
+<link href="{{Msg "seo" "cdn"}}/wxswordfish/style.css" rel="stylesheet">
+{{include "/common/inc.html"}}
+<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
+<script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/main.js"></script>
+<script src="{{Msg "seo" "cdn"}}/wxswordfish/jquery.resize.js"></script>
+<script>
+	var msgset= {{.T.msgset}};
+	initShare({{.T.signature}},{{.T.shareid}});
+</script>
+
+<script type="text/javascript">
+$(function(){
+	
+	var s_words = [];
+	s_words = {{.T.s_name}};
+	
+	var flog = {{.T.success}};
+	if (!flog){
+		$(".nullcontent").removeClass("hidden");
+		$(".resbm").addClass("hidden");
+		$(".rescontent").addClass("hidden");
+	}else{
+		$("#resbm").removeClass("hidden");
+		var str = ""
+		var temp = {{.T.msglist}}
+		console.log({{.T.msglist}})
+		str+=temp["s_content"];
+		a_visitedindex=temp["a_visitedindex"];
+		a_publishtime=temp["a_publishtime"];
+		f_id=temp["_id"];
+		$(".rescontent").append('<div id="ycwords" datatype="'+temp["s_type"]+'">'+str+'</div>')
+		//信息条总数
+		le=$(".tslist").length;
+		//
+		$(".tslist").each(function(i){
+			$(this).children(".xh").text(function(i,v){
+				v = v.replace(".","")
+				return v
+			});
+			$(this).children(".xh").wrap('<div class="resnumb"><div class="one"></div></div>');
+			//关键词高亮
+			var html = $(this).html();
+				if(s_words != ""){
+					var wordsArray = s_words.split("+");
+					for(var si=0;si<wordsArray.length;si++){
+						var reg = new RegExp(wordsArray[si],"g");
+						html = html.replace(reg,function(word){
+							return '<font class="keyword">'+word+'</font>';
+						});
+					}
+				}
+			
+			
+			$(this).html(html);
+			//已访问过的灰色
+			var xh = $(this).find("span.xh").text();
+			if(typeof(a_visitedindex)!= "undefined"){
+				for(var i=0;i<a_visitedindex.length;i++){
+					if(xh == a_visitedindex[i]){
+						$(this).find("a.bt").addClass("visited");
+					}
+				}
+			}
+			var datatype = $(this).parents("#ycwords").attr("datatype");
+			//if(datatype == "bid"){
+			//	datatype = "【中标公告】";
+			//}else if(datatype == "tender"){
+			//	datatype = "【招标公告】";
+			//}else{
+				datatype = "";
+			//}
+			$(this).find("a.bt").prepend(datatype).wrap("<div class='two bt-parent' id="+xh+"></div>");
+			$(this).find(".two").appendTo($(this).find(".resnumb"));
+			$(this).append(function(){
+				if(a_publishtime == "" || typeof(a_publishtime[xh]) == "undefined"){
+					return "";
+				}else{
+					var date1=new Date(Number(a_publishtime[xh]+"000"));//开始时间
+					var date2=new Date();//结束时间
+					var date3=date2.getTime()-date1.getTime();//时间差的毫秒数
+					//计算出相差天数
+					var days=Math.floor(date3/(24*3600*1000));
+					//计算出小时数
+					var leave1=date3%(24*3600*1000);//计算天数后剩余的毫秒数
+					var hours=Math.floor(leave1/(3600*1000));
+					//计算相差分钟数
+					var leave2=leave1%(3600*1000);//计算小时数后剩余的毫秒数
+					var minutes=Math.floor(leave2/(60*1000));
+					//计算相差秒数
+					/*var leave3=leave2%(60*1000);//计算分钟数后剩余的毫秒数
+					var seconds=Math.round(leave3/1000);*/
+					var timeDiff = "1分钟";
+					if(days > 0){
+						timeDiff = days+"天";
+					}else if(hours > 0){
+						timeDiff = hours+"小时";
+					}else if(minutes > 0){
+						timeDiff = minutes+"分钟";
+					}
+					return '<div style="clear:both;"></div><div  class="restime time-diff">'+timeDiff+'前</div>';
+				}
+			});
+		});
+	}
+	setTimeout(function(){
+			var abt=$("a.bt");
+			abt.each(function(){
+				var h=$(this).attr("href");
+				$(this).removeAttr("target");
+				$(this).removeAttr("href");
+				if (h.indexOf("java")==-1){							
+					$(this).attr("s",h)
+					$(this).attr("f_id",f_id)
+					$(this).attr("href","javascript:void(0);")	
+				}
+			})
+			abt.click(function(){
+				var h=$(this).attr("s");
+				open_window(h);
+				return false;
+			})
+		},800)
+});
+
+
+	
+</script>
+
+<style type="text/css">
+body{
+	background-color:#F0F0F0;
+}
+#ycwords>div:first-of-type{
+	display:none;
+}
+.searchname{
+	background-color:#FFFFFF; 
+	border:1px solid #e5e6e9;
+	height:45px;
+	width:100%;
+    border-radius: 10px;
+	padding:2px 10px 2px 60px;
+	font-size:16px;
+	position:relative;
+}
+.wxhead{
+    padding: 10px 15px;
+	background-color:#F0F0F0;
+}
+.tubiao img{
+    position: absolute;
+    z-index: 10;
+    margin-top: 12px;
+    color: #000;
+	margin-left:20px;
+	height:25px;
+}
+.xiaochu{
+	float:right;
+}
+.xiaochu img{
+    position: absolute;
+    z-index: 10;
+    top: 20px;
+	right: 30px;
+	height:25px;
+}
+.rsssetbtn{
+	border:1px solid #37c6da; 
+	background-color:#37c6da;
+	height:38px; 
+	width:100%; 
+	line-height:38px;
+	vertical-align: middle;
+	border-radius: 4px;
+	font-size:15px;
+	color:#fff;
+}
+#myorder{
+	width:100%; 
+	margin-top:40px;
+	padding:0px 30px;
+}
+.reslist{
+	width:100%;
+	height:90px;
+	border-bottom:1px solid #e5e6e9;
+	padding-top:5px;
+}
+.resnumb .one{
+	color:#37c6da;
+	font-size:16px;
+	width:5%;
+	height:45px;
+	display: inline-block;
+	float:left;
+}
+.resnumb .two{
+	font-size:16px;
+	font-weight:500;
+	margin-left:10px;
+	display: inline-block;
+	height:45px;
+	width:88%;
+	float:left;
+	line-height:24px;
+    overflow: hidden;
+}
+.restime{
+	float:right; 
+	color:#999;
+	margin-top:5px;
+}
+.resbm {
+    display: table;
+    position: fixed;
+    left: 0px;
+    right: 0px;
+    bottom: 0px;
+    height: 50px;
+    width: 100%;
+    background-color: #37c6da;
+	border:1px solid #37c6da
+}
+.resdy{
+	float:right; 
+	height:40px; 
+	margin:5px 10px; 
+	width:100px; 
+	border:1px solid #fff;
+	line-height:40px;
+	border-radius:4px;
+	color:#fff;
+	padding-left:20px;
+	cursor:hand;
+}
+.rests{
+	height:50px;
+	line-height:50px;
+	padding-left:15px;
+	color:#fff;
+	font-size:14px;
+	float:left;
+    overflow: hidden;
+	width:60%;
+}
+.rescontent,.nullcontent{
+	border-top:1px solid #e5e6e9;
+	padding:10px 20px;
+	background-color:#fff;
+	width:100%;
+	height:100%;
+}
+.tslist{
+	height:80px;
+	border-bottom: 1px solid #ccc;
+	padding: 5px;
+}
+.keyword{
+	color: #FF5A5F;
+}
+</style>
+</head>
+<body>
+<div style="background-color:#fff;">
+<div class="wxhead"><span class="tubiao"><img src="/images/wxjss.png"/></span><input class="form-control searchname" name="searchname" value="{{.T.keywords}}" placeholder="输入关键词查询"/>
+<span class="xiaochu"><img class="qcimg" src="/images/wxqc.png"/></span>
+</div>
+<div class="rescontent">
+	
+</div>
+
+
+</div>
+<div class="resbm" >
+<div class="rests">确认关键词的查询结果无误</div>
+<div class="resdy"  onClick="window.location.href='/swordfish/page';">
+直接订阅
+</div>
+
+<div style="both:clear;"></div>
+</div>
+
+<div class="nullcontent text-center  hidden">
+<div >
+<img style="width:137px;margin-top:160px;" src="/images/findnull.png">
+</div>
+<div>没有找到和该关键词匹配的信息</div>
+</div>
+
+
+<script type="text/javascript">
+	$(".searchname").click(function(){
+        window.location.href="/member/wxswordfish/search";
+    });
+	$(".qcimg").click(function(){
+		$(".searchname").val("");
+		$(".searchzhao3 span").html("");
+		$(".searchzhong3 span").html("");
+	})
+	function open_window(link){
+		if(!/^http/.test(link)){
+			link="http://"+link
+		}
+		window.open("/visit/redirect?url="+escape(link));
+	}
+</script>
+</body>
+</html>

+ 0 - 102
weixin/src/qfw/weixin/imagemsghandler.go

@@ -1,15 +1,6 @@
 package weixin
 
 import (
-	"bytes"
-	"encoding/base64"
-	"encoding/json"
-	"fmt"
-	"github.com/disintegration/imaging"
-	"io/ioutil"
-	"math"
-	"net/http"
-
 	"log"
 	"os"
 	"qfw/util"
@@ -18,14 +9,6 @@ import (
 	"time"
 )
 
-const (
-	OCR_SERVERKEY   = "1fb48799-5379-485c-9047-f886b535759b"
-	OCR_SERVICECODE = "cf22e3bb-d41c-47e0-aa44-a92984f5829d"
-)
-
-var upload_lock chan bool = make(chan bool, 500) //支持500并发
-var max_size float64 = 1200                      //最大1200像素
-
 //微信图像处理
 func ImageMsgHandler(w ResponseWriter, r *Request) {
 	//TODO 先验证是否存在用户,
@@ -36,13 +19,7 @@ func ImageMsgHandler(w ResponseWriter, r *Request) {
 			return
 		}
 		processIndenfyUpload(us, openid, w, r)
-	} else { //走的是名片识别
-		//TODO 需要加上调用次数限制
-		upload_lock <- true
-		go cardRecognition(r.MediaId, r.FromUserName)
-		w.ReplyOK()
 	}
-
 }
 
 func processIndenfyUpload(us *usersession, openid string, w ResponseWriter, r *Request) {
@@ -78,82 +55,3 @@ func getSavePath() string {
 
 	return path + name
 }
-
-//名片识别
-func cardRecognition(mediaid, openid string) {
-	defer func() {
-		<-upload_lock
-	}()
-	//下载
-	picpath := getSavePath()
-	err := Mux.DownloadMediaToFile(mediaid, wf.SysConfig.Imgpath+picpath)
-	if err != nil {
-		log.Println(err.Error())
-		return
-	}
-	//图像处理
-	fi, _ := os.Open(wf.SysConfig.Imgpath + picpath)
-	srcimg, err := imaging.Decode(fi)
-	fi.Close()
-	if err != nil {
-		log.Println("read image file:::", err.Error())
-	}
-	bound := srcimg.Bounds().Size()
-	log.Println(bound.X, bound.Y)
-	w, h := bound.X, bound.Y
-	if max := math.Max(float64(w), float64(h)); max > max_size {
-		bl := max / max_size
-		w = int(float64(w) / bl)
-		h = int(float64(h) / bl)
-	}
-	small_file := wf.SysConfig.Imgpath + getSavePath()
-	destimg := imaging.Resize(srcimg, w, h, imaging.Linear)
-	imaging.Save(destimg, small_file)
-	//识别
-	fi, _ = os.Open(small_file)
-	bs, _ := ioutil.ReadAll(fi)
-	fi.Close()
-	hurl := fmt.Sprintf("http://api.hanvon.com/rt/ws/v1/ocr/bcard/recg?key=%s&code=%s",
-		OCR_SERVERKEY, OCR_SERVICECODE)
-	body := map[string]interface{}{
-		"uid":   "123.160.231.13",
-		"color": "original",
-		"lang":  "auto",
-		"image": base64.StdEncoding.EncodeToString(bs),
-	}
-	bs, _ = json.Marshal(body)
-	//
-	client := &http.Client{}
-	req, _ := http.NewRequest("POST", hurl, bytes.NewReader(bs))
-	req.Header.Set("Content-Type", "application/octet-stream")
-	resp, _ := client.Do(req) //发送
-	ret, _ := ioutil.ReadAll(resp.Body)
-	resp.Body.Close()
-	log.Println(string(ret))
-	ocr_ret := map[string]interface{}{}
-	json.Unmarshal(ret, &ocr_ret)
-	if v, ok := ocr_ret["comp"]; ok {
-		comps, _ := v.([]interface{})
-		if len(comps) > 0 {
-			searchcomp := comps[0].(string)
-			//发送客服消息
-			var msg struct {
-				ToUser  string `json:"touser"`
-				MsgType string `json:"msgtype"`
-				Text    struct {
-					Content string `json:"content"`
-				} `json:"text"`
-			}
-			msg.ToUser = openid
-			msg.MsgType = "text"
-			msg.Text.Content = searchcomp
-			bs, err := Mux.PostCustomMsg("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=", msg)
-			if err != nil {
-				log.Println(err.Error())
-			} else {
-				log.Println(string(bs))
-			}
-		}
-	}
-
-}

+ 34 - 0
weixin/src/qfw/weixin/rpc/downimg.go

@@ -0,0 +1,34 @@
+// downloadimg
+package rpc
+
+import (
+	"log"
+	"os"
+	"qfw/util"
+	wf "qfw/weixinconfig"
+	"time"
+)
+
+func (wxrpc *WeiXinRpc) DownloadMingpian(mediaid string, picpath *string) error {
+	*picpath = getSavePath()
+	err := wxrpc.wx.DownloadMediaToFile(mediaid, *picpath)
+	if err != nil {
+		log.Println("DownloadMingpian err", err.Error())
+		*picpath = ""
+	} else {
+		log.Println("图片路径", *picpath)
+	}
+	return nil
+}
+
+func getSavePath() string {
+	strs := time.Now().Format("20060102150405001")
+	name := strs + util.GetRandom(5) + ".jpg"
+	path := "/upload/" + strs[:4] + "/" + strs[4:6] + "/" + strs[6:8] + "/"
+	fs, err := os.Open(wf.SysConfig.Imgpath + path)
+	if err != nil {
+		os.MkdirAll(wf.SysConfig.Imgpath+path, 0700)
+	}
+	defer fs.Close()
+	return wf.SysConfig.Imgpath + path + name
+}