|
@@ -7,7 +7,6 @@ import (
|
|
|
"github.com/go-xweb/xweb"
|
|
|
"gopkg.in/mgo.v2/bson"
|
|
|
"html/template"
|
|
|
- "log"
|
|
|
"qfw/front"
|
|
|
. "qfw/member"
|
|
|
. "qfw/util"
|
|
@@ -17,6 +16,7 @@ import (
|
|
|
ip "qfw/util/ip17mon"
|
|
|
. "qfw/util/mongodb"
|
|
|
"qfw/util/redis"
|
|
|
+ "regexp"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
)
|
|
@@ -33,8 +33,9 @@ type EntInfo struct {
|
|
|
|
|
|
//企业社区首页
|
|
|
func (search *Search) EntCommunity() error {
|
|
|
- ismobile := strings.Index(search.Header("User-Agent"), "Mobile")
|
|
|
- if ismobile > -1 {
|
|
|
+ regex, _ := regexp.Compile("(Android|Mobile)")
|
|
|
+ ismobile := regex.FindAllString(search.Header("User-Agent"), -1)
|
|
|
+ if len(ismobile) > 0 {
|
|
|
search.Render("/member/incmobile/index.html")
|
|
|
return nil
|
|
|
}
|
|
@@ -137,8 +138,7 @@ func (n *Search) GetEnterpriseList(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()
|
|
|
- ismobile := strings.Index(n.Header("User-Agent"), "Mobile")
|
|
|
- i_mingpian := n.GetString("i_mingpian") //是否走名片查询
|
|
|
+
|
|
|
if len(param) == 0 {
|
|
|
//请求是表单提交,走的查询
|
|
|
//拼装查询对象
|
|
@@ -155,18 +155,8 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
|
|
|
"cityNo": n.GetString("cityNo"), // 是否是第一次查询并且没有选择地市,自动根据IP来设
|
|
|
}
|
|
|
//查询生成列表数据
|
|
|
- var data *[]map[string]interface{}
|
|
|
- var pagination *[]interface{}
|
|
|
- var has bool = false
|
|
|
- if i_mingpian != "" {
|
|
|
- data, pagination, has = searhWebContententMp(querymap, n, reqType, false)
|
|
|
- if !has {
|
|
|
- data, pagination = searhWebContentent(querymap, n, reqType)
|
|
|
- }
|
|
|
- } else {
|
|
|
- data, pagination = searhWebContentent(querymap, n, reqType)
|
|
|
- }
|
|
|
- log.Println(len(*data))
|
|
|
+ data, pagination := searhWebContentent(querymap, n, reqType)
|
|
|
+
|
|
|
//查询送积分
|
|
|
queryStr := querymap["query"]
|
|
|
if len(queryStr) > 0 {
|
|
@@ -181,25 +171,7 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if ismobile > -1 {
|
|
|
- entinfos := make([]map[string]string, 0)
|
|
|
- for _, v := range *data {
|
|
|
- tmp := map[string]string{
|
|
|
- "_id": fmt.Sprint(v["_id"]),
|
|
|
- "EntName": fmt.Sprint(v["EntName"]),
|
|
|
- "RegNo": fmt.Sprint(v["RegNo"]),
|
|
|
- "LeRep": fmt.Sprint(v["LeRep"]),
|
|
|
- "OpLocDistrict": fmt.Sprint(v["OpLocDistrict"]),
|
|
|
- "EstDate": fmt.Sprint(v["EstDate"]),
|
|
|
- "OpStateName": fmt.Sprint(v["OpStateName"]),
|
|
|
- }
|
|
|
- entinfos = append(entinfos, tmp)
|
|
|
- }
|
|
|
- d, _ := json.Marshal(entinfos)
|
|
|
- n.Render("/member/incmobile/list.html", &xweb.T{"data": string(d)})
|
|
|
- } else {
|
|
|
- n.Render("/search/enterpriseList.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
|
|
|
- }
|
|
|
+ n.Render("/search/enterpriseList.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
|
|
|
} else {
|
|
|
//反转生成map
|
|
|
paramstr := param[1:]
|
|
@@ -208,27 +180,12 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
|
|
|
|
|
|
json.Unmarshal(bs, &querymap)
|
|
|
data, pagination := searhWebContentent(querymap, n, reqType)
|
|
|
- if ismobile > -1 {
|
|
|
- entinfos := make([]map[string]string, 0)
|
|
|
- for _, v := range *data {
|
|
|
- tmp := map[string]string{
|
|
|
- "_id": fmt.Sprint(v["_id"]),
|
|
|
- "EntName": fmt.Sprint(v["EntName"]),
|
|
|
- "RegNo": fmt.Sprint(v["RegNo"]),
|
|
|
- "LeRep": fmt.Sprint(v["LeRep"]),
|
|
|
- "OpLocDistrict": fmt.Sprint(v["OpLocDistrict"]),
|
|
|
- "EstDate": fmt.Sprint(v["EstDate"]),
|
|
|
- "OpStateName": fmt.Sprint(v["OpStateName"]),
|
|
|
- }
|
|
|
- entinfos = append(entinfos, tmp)
|
|
|
- }
|
|
|
- d, _ := json.Marshal(entinfos)
|
|
|
- n.Render("/member/incmobile/list.html", &xweb.T{"data": string(d)})
|
|
|
- } else {
|
|
|
- n.Render("/search/enterpriseList.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
|
|
|
- }
|
|
|
+ n.Render("/search/enterpriseList.html", &xweb.T{"querymap": querymap, "data": data, "pagination": pagination})
|
|
|
}
|
|
|
return nil
|
|
|
+ //} else {
|
|
|
+ //return n.Render("/search/entcommunity.html")
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
//即时搜索
|