Browse Source

feat:引包

zhangxinlei1996 3 years ago
parent
commit
d3a11118c4
1 changed files with 480 additions and 479 deletions
  1. 480 479
      src/jfw/modules/app/src/app/front/swordfish.go

+ 480 - 479
src/jfw/modules/app/src/app/front/swordfish.go

@@ -1,342 +1,343 @@
 package front
 
 import (
-    _ "app/filter"
-    "jfw/config"
-    "jfw/public"
-    "log"
-    "math/rand"
-    . "mongodb"
-    "qfw/util"
-    "qfw/util/bidsearch"
-    "qfw/util/jy"
-    "qfw/util/redis"
-    "strings"
-    "time"
+	_ "app/filter"
+	. "app/jyutil"
+	"jfw/config"
+	"jfw/public"
+	"log"
+	"math/rand"
+	. "mongodb"
+	"qfw/util"
+	"qfw/util/bidsearch"
+	"qfw/util/jy"
+	"qfw/util/redis"
+	"strings"
+	"time"
 
-    "github.com/go-xweb/httpsession"
-    "go.mongodb.org/mongo-driver/bson"
-    "go.mongodb.org/mongo-driver/bson/primitive"
+	"github.com/go-xweb/httpsession"
+	"go.mongodb.org/mongo-driver/bson"
+	"go.mongodb.org/mongo-driver/bson/primitive"
 )
 
 const (
-    INDEX             = "bidding"
-    TYPE              = "bidding"
-    FINDF             = `"title"`
-    bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","s_subscopeclass","buyerclass","bidamount","budget","spidercode","site"`
-    bidSearch_field   = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
+	INDEX             = "bidding"
+	TYPE              = "bidding"
+	FINDF             = `"title"`
+	bidSearch_field_1 = `"_id","title","publishtime","toptype","subtype","type","area","s_subscopeclass","buyerclass","bidamount","budget","spidercode","site"`
+	bidSearch_field   = bidSearch_field_1 + `,"bidopentime","winner","buyer","projectname","projectcode","projectinfo"`
 )
 
 //剑鱼标讯推送三级页点赞暂弃 改成剑鱼标讯实验室点赞功能
 func (m *Front) Praise() error {
-    defer util.Catch()
-    var flag = "F"
-    var praiseflag = true
-    thistype := m.GetString("type")
-    uod := m.GetString("uod")
-    util.Try(func() {
-        pdata, _ := mongodb.FindOneByField("praise", `{"s_type":"`+thistype+`"}`, `{"s_no":1}`)
-        if len(*pdata) != 0 {
-            if uod == "U" {
-                praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : 1 }}`, false, false)
-            } else {
-                praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : -1 }}`, false, false)
-            }
-            if praiseflag {
-                flag = "T"
-            }
-        }
-    }, func(e interface{}) {
-        log.Println("剑鱼标讯实验室点赞出错", e)
-    })
-    m.ServeJson(map[string]interface{}{
-        "flag": flag,
-    })
-    return nil
+	defer util.Catch()
+	var flag = "F"
+	var praiseflag = true
+	thistype := m.GetString("type")
+	uod := m.GetString("uod")
+	util.Try(func() {
+		pdata, _ := mongodb.FindOneByField("praise", `{"s_type":"`+thistype+`"}`, `{"s_no":1}`)
+		if len(*pdata) != 0 {
+			if uod == "U" {
+				praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : 1 }}`, false, false)
+			} else {
+				praiseflag = mongodb.Update("praise", `{"s_type":"`+thistype+`"}`, `{ "$inc" : { "s_no" : -1 }}`, false, false)
+			}
+			if praiseflag {
+				flag = "T"
+			}
+		}
+	}, func(e interface{}) {
+		log.Println("剑鱼标讯实验室点赞出错", e)
+	})
+	m.ServeJson(map[string]interface{}{
+		"flag": flag,
+	})
+	return nil
 }
 
 //剑鱼标讯保存
 func (m *Front) AjaxReq() error {
-    defer util.Catch()
-    reqType := m.GetString("reqType")
-    var flag = "n"
-    switch reqType {
-    case "feedback": //意见反馈
-        data := make(map[string]interface{})
-        userId, ok := m.GetSession("userId").(string)
-        if !ok || userId == "" {
-            break
-        }
-        userInfo, ok := mongodb.FindById("user", userId, nil)
-        if !ok {
-            break
-        }
-        data["i_type"] = 8
-        data["s_fromName"] = m.GetString("fromName")
-        value := m.GetString("value")
-        if len([]rune(value)) > 200 {
-            value = util.SubString(value, 0, 200)
-        }
-        data["s_remark"] = value
-        //
-        s_name := ""
-        if (*userInfo)["s_name"] != nil {
-            s_name, _ = (*userInfo)["s_name"].(string)
-        }
-        s_nickname := ""
-        if (*userInfo)["s_nickname"] != nil {
-            s_nickname, _ = (*userInfo)["s_nickname"].(string)
-        }
-        s_phone, _ := (*userInfo)["s_phone"].(string)
-        if s_name != "" {
-            data["s_submitname"] = s_name
-        } else if s_nickname != "" {
-            data["s_submitname"] = s_nickname
-        } else if s_phone != "" {
-            data["s_submitname"] = s_phone
-        } else {
-            data["s_submitname"] = userId
-        }
-        //
-        if s_nickname != "" { //昵称
-            data["s_username"] = s_nickname
-        } else if s_name != "" { //s_name
-            data["s_username"] = s_name
-        } else if s_phone != "" {
-            data["s_username"] = s_phone
-        } else { //userId
-            data["s_username"] = userId
-        }
-        //
-        data["s_submitid"] = userId
-        data["s_title"] = m.GetString("title")
-        data["i_status"] = 0
-        data["l_submitdate"] = time.Now().Unix()
-        data["s_source"] = m.GetString("source")
-        data["s_fkid"] = m.GetString("fkid")
-        data["s_from"] = "app"
-        if len(mongodb.Save("interaction", data)) > 0 {
-            flag = "y"
-        }
-        break
-    case "subscribe": //直接订阅
-        if userid := util.ObjToString(m.GetSession("userId")); userid != "" {
-            r, _ := mongodb.FindById("user", userid, `{"o_jy":1}`)
-            o_jy, _ := (*r)["o_jy"].(map[string]interface{})
-            a_key, _ := o_jy["a_key"].([]interface{})
-            keysArray := processKeyword(m.GetString("keys"))
-            if keysArray == nil {
-                break
-            }
-            var isExists bool
-            for _, v := range a_key {
-                //count := 0
-                //for _, kay := range keysArray {
-                keyMap, _ := v.(map[string]interface{})
-                key, _ := keyMap["key"].([]interface{})
-                kystr := ""
-                for _, ky := range key {
-                    kystr = kystr + " " + ky.(string)
-                }
-                if strings.TrimSpace(m.GetString("keys")) == strings.TrimSpace(kystr) {
-                    isExists = true
-                    flag = "y"
-                    break
-                }
-            }
-            //如果不存在
-            if !isExists {
-                if len(a_key) >= 10 {
-                    flag = "o"
-                } else {
-                    if mongodb.UpdateById("user", userid,
-                        bson.M{
-                            "$push": bson.M{"o_jy.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
-                            "$set":  bson.M{"i_ts_guide": 1, "o_jy.l_modifydate": time.Now().Unix()},
-                        }) {
-                        flag = "y"
-                    }
-                }
-            } else {
-                if mongodb.UpdateById("user", userid,
-                    bson.M{
-                        "$set": bson.M{"i_ts_guide": 1},
-                    }) {
-                    flag = "y"
-                }
-            }
-        }
-        break
-    }
-    m.ServeJson(map[string]interface{}{
-        "flag": flag,
-    })
-    return nil
+	defer util.Catch()
+	reqType := m.GetString("reqType")
+	var flag = "n"
+	switch reqType {
+	case "feedback": //意见反馈
+		data := make(map[string]interface{})
+		userId, ok := m.GetSession("userId").(string)
+		if !ok || userId == "" {
+			break
+		}
+		userInfo, ok := mongodb.FindById("user", userId, nil)
+		if !ok {
+			break
+		}
+		data["i_type"] = 8
+		data["s_fromName"] = m.GetString("fromName")
+		value := m.GetString("value")
+		if len([]rune(value)) > 200 {
+			value = util.SubString(value, 0, 200)
+		}
+		data["s_remark"] = value
+		//
+		s_name := ""
+		if (*userInfo)["s_name"] != nil {
+			s_name, _ = (*userInfo)["s_name"].(string)
+		}
+		s_nickname := ""
+		if (*userInfo)["s_nickname"] != nil {
+			s_nickname, _ = (*userInfo)["s_nickname"].(string)
+		}
+		s_phone, _ := (*userInfo)["s_phone"].(string)
+		if s_name != "" {
+			data["s_submitname"] = s_name
+		} else if s_nickname != "" {
+			data["s_submitname"] = s_nickname
+		} else if s_phone != "" {
+			data["s_submitname"] = s_phone
+		} else {
+			data["s_submitname"] = userId
+		}
+		//
+		if s_nickname != "" { //昵称
+			data["s_username"] = s_nickname
+		} else if s_name != "" { //s_name
+			data["s_username"] = s_name
+		} else if s_phone != "" {
+			data["s_username"] = s_phone
+		} else { //userId
+			data["s_username"] = userId
+		}
+		//
+		data["s_submitid"] = userId
+		data["s_title"] = m.GetString("title")
+		data["i_status"] = 0
+		data["l_submitdate"] = time.Now().Unix()
+		data["s_source"] = m.GetString("source")
+		data["s_fkid"] = m.GetString("fkid")
+		data["s_from"] = "app"
+		if len(mongodb.Save("interaction", data)) > 0 {
+			flag = "y"
+		}
+		break
+	case "subscribe": //直接订阅
+		if userid := util.ObjToString(m.GetSession("userId")); userid != "" {
+			r, _ := mongodb.FindById("user", userid, `{"o_jy":1}`)
+			o_jy, _ := (*r)["o_jy"].(map[string]interface{})
+			a_key, _ := o_jy["a_key"].([]interface{})
+			keysArray := processKeyword(m.GetString("keys"))
+			if keysArray == nil {
+				break
+			}
+			var isExists bool
+			for _, v := range a_key {
+				//count := 0
+				//for _, kay := range keysArray {
+				keyMap, _ := v.(map[string]interface{})
+				key, _ := keyMap["key"].([]interface{})
+				kystr := ""
+				for _, ky := range key {
+					kystr = kystr + " " + ky.(string)
+				}
+				if strings.TrimSpace(m.GetString("keys")) == strings.TrimSpace(kystr) {
+					isExists = true
+					flag = "y"
+					break
+				}
+			}
+			//如果不存在
+			if !isExists {
+				if len(a_key) >= 10 {
+					flag = "o"
+				} else {
+					if mongodb.UpdateById("user", userid,
+						bson.M{
+							"$push": bson.M{"o_jy.a_key": bson.M{"key": keysArray, "area": []string{}, "infotype": []string{}, "notkey": []string{}, "from": 1}},
+							"$set":  bson.M{"i_ts_guide": 1, "o_jy.l_modifydate": time.Now().Unix()},
+						}) {
+						flag = "y"
+					}
+				}
+			} else {
+				if mongodb.UpdateById("user", userid,
+					bson.M{
+						"$set": bson.M{"i_ts_guide": 1},
+					}) {
+					flag = "y"
+				}
+			}
+		}
+		break
+	}
+	m.ServeJson(map[string]interface{}{
+		"flag": flag,
+	})
+	return nil
 }
 
 //获取我的反馈列表
 func (f *Front) MyFeedbacks() error {
-    userId, _ := f.GetSession("userId").(string)
-    if userId == "" {
-        return f.Redirect("/jyapp/free/mob/err")
-    }
-    list, ok := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
-    if !ok {
-        return f.Redirect("/jyapp/free/mob/err")
-    }
-    mongodb.Update("jyapp_notice", map[string]interface{}{
-        "s_userid": util.ObjToString(f.GetSession("userId")),
-        "s_type":   "feedback",
-    }, map[string]interface{}{
-        "$set": map[string]interface{}{
-            "i_unread":    0,
-            "l_timestamp": time.Now().Unix(),
-        },
-    }, false, true)
-    if f.Method() == "GET" {
-        f.T["list"] = list
-        f.T["flag"] = true
-        return f.Render("/weixin/feedback.html")
-    }
-    f.ServeJson(map[string]interface{}{
-        "list": list,
-    })
-    return nil
+	userId, _ := f.GetSession("userId").(string)
+	if userId == "" {
+		return f.Redirect("/jyapp/free/mob/err")
+	}
+	list, ok := mongodb.Find("interaction", bson.M{"s_submitid": userId}, `{"l_submitdate":-1}`, `{"s_remark":1,"l_submitdate":1,"s_opinion":1,"i_status":1}`, false, 0, 200)
+	if !ok {
+		return f.Redirect("/jyapp/free/mob/err")
+	}
+	mongodb.Update("jyapp_notice", map[string]interface{}{
+		"s_userid": util.ObjToString(f.GetSession("userId")),
+		"s_type":   "feedback",
+	}, map[string]interface{}{
+		"$set": map[string]interface{}{
+			"i_unread":    0,
+			"l_timestamp": time.Now().Unix(),
+		},
+	}, false, true)
+	if f.Method() == "GET" {
+		f.T["list"] = list
+		f.T["flag"] = true
+		return f.Render("/weixin/feedback.html")
+	}
+	f.ServeJson(map[string]interface{}{
+		"list": list,
+	})
+	return nil
 }
 
 func getRewardText() (string, string) {
-    rewardText, _ := config.Sysconfig["rewardText"].([]interface{})
-    advertText, _ := config.Sysconfig["advertText"].([]interface{})
-    randVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(rewardText))
-    if len(advertText) != 0 {
-        advVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(advertText))
-        return util.ObjToString(rewardText[randVal]), util.ObjToString(advertText[advVal])
-    } else {
-        return util.ObjToString(rewardText[randVal]), ""
-    }
+	rewardText, _ := config.Sysconfig["rewardText"].([]interface{})
+	advertText, _ := config.Sysconfig["advertText"].([]interface{})
+	randVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(rewardText))
+	if len(advertText) != 0 {
+		advVal := rand.New(rand.NewSource(time.Now().UnixNano())).Intn(len(advertText))
+		return util.ObjToString(rewardText[randVal]), util.ObjToString(advertText[advVal])
+	} else {
+		return util.ObjToString(rewardText[randVal]), ""
+	}
 }
 func (m *Front) About() error {
-    return m.Render("/weixin/about.html")
+	return m.Render("/weixin/about.html")
 }
 func (m *Front) WxsearchlistPaging() {
-    defer util.Catch()
-    var list *[]map[string]interface{}
+	defer util.Catch()
+	var list *[]map[string]interface{}
 
-    pageNum, _ := m.GetInteger("pageNum")
-    searchvalue := strings.TrimSpace(m.GetString("searchvalue"))
-    userid := util.ObjToString(m.GetSession("userId"))
-    if userid != "" {
-        //历史记录
-        history := redis.GetStr("other", "s_"+userid)
-        arrs := bidsearch.AddHistory(history, searchvalue)
-        redis.Del("other", "s_"+userid)
-        redis.Put("other", "s_"+userid, strings.Join(arrs, ","), -1)
-        m.T["history"] = arrs
-    }
+	pageNum, _ := m.GetInteger("pageNum")
+	searchvalue := strings.TrimSpace(m.GetString("searchvalue"))
+	userid := util.ObjToString(m.GetSession("userId"))
+	if userid != "" {
+		//历史记录
+		history := redis.GetStr("other", "s_"+userid)
+		arrs := bidsearch.AddHistory(history, searchvalue)
+		redis.Del("other", "s_"+userid)
+		redis.Put("other", "s_"+userid, strings.Join(arrs, ","), -1)
+		m.T["history"] = arrs
+	}
 
-    isLimit := 1
-    var (
-        b_word, a_word string
-        secondKWS      = ""
-        secondFlag     = ""
-        queryItems     []string
-        isPayedUser    bool
-        hasNextPage    bool
-        secondList     []map[string]interface{}
-        fileExists     = ""
-        city           = ""
-    )
+	isLimit := 1
+	var (
+		b_word, a_word string
+		secondKWS      = ""
+		secondFlag     = ""
+		queryItems     []string
+		isPayedUser    bool
+		hasNextPage    bool
+		secondList     []map[string]interface{}
+		fileExists     = ""
+		city           = ""
+	)
 
-    if searchvalue != "" {
-        selectType := m.GetString("selectType")
-        subtype := m.GetString("subtype")
-        scope := m.GetString("scope")
-        publishtime := m.GetString("publishtime")
-        industry := strings.TrimSpace(m.GetString("industry"))
-        minprice := m.GetString("minprice")
-        maxprice := m.GetString("maxprice")
-        winner := "" //仅大会员用户可以查询中标企业
-        //高级筛选 仅vip用户可查询
-        var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
-        buyerclass := ""                              //采购单位类别
-        var notkey string = ""                        //排除词
-        fileExists = m.GetString("fileExists")        //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
+	if searchvalue != "" {
+		selectType := m.GetString("selectType")
+		subtype := m.GetString("subtype")
+		scope := m.GetString("scope")
+		publishtime := m.GetString("publishtime")
+		industry := strings.TrimSpace(m.GetString("industry"))
+		minprice := m.GetString("minprice")
+		maxprice := m.GetString("maxprice")
+		winner := "" //仅大会员用户可以查询中标企业
+		//高级筛选 仅vip用户可查询
+		var hasBuyerTel, hasWinnerTel string = "", "" //是否有采购单位电话、是否有中标单位电话 y:有 n:没有
+		buyerclass := ""                              //采购单位类别
+		var notkey string = ""                        //排除词
+		fileExists = m.GetString("fileExists")        //是否有附件--所有用户都可用此功能 0:全部;1:有附件;-1:无附件
 
-        isPayedUser, publishtime, queryItems, pageNum, _ = bidsearch.PublicSearch(userid, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), pageNum)
-        if isPayedUser {
-            buyerclass = m.GetString("buyerclass")
-            hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
-            notkey = m.GetString("notkey")
-            city = m.GetString("city")
-        }
-        //校验是否有大会员中标企业查询权限
-        if jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW).CheckBigVipBackPower("search") {
-            winner = m.GetString("winner")
-        }
-        //全文检索限制
-        searchLimit := public.IsSearchLimit(queryItems)
-        if searchLimit {
-            //limitFlag = public.Lst.Flag
-            isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session(), isPayedUser)
-            if isLimit == 1 { //没有被限制
-                defer public.Lst.Limit()
-            }
-        }
-        //第一页数据展示多字段(table表格需要)
-        filed := bidSearch_field_1
-        if pageNum == 1 {
-            filed = bidSearch_field
-        }
-        if isLimit == 1 {
-            secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("app", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser, false, "")
-        }
-    }
+		isPayedUser, publishtime, queryItems, pageNum, _ = bidsearch.PublicSearch(userid, selectType, publishtime, util.Int64All(config.Sysconfig["bidSearchOldUserLimit"]), pageNum)
+		if isPayedUser {
+			buyerclass = m.GetString("buyerclass")
+			hasBuyerTel, hasWinnerTel = m.GetString("buyertel"), m.GetString("winnertel")
+			notkey = m.GetString("notkey")
+			city = m.GetString("city")
+		}
+		//校验是否有大会员中标企业查询权限
+		if jy.GetBigVipUserBaseMsg(userid, public.Mysql, public.MQFW).CheckBigVipBackPower("search") {
+			winner = m.GetString("winner")
+		}
+		//全文检索限制
+		searchLimit := public.IsSearchLimit(queryItems)
+		if searchLimit {
+			//limitFlag = public.Lst.Flag
+			isLimit = public.Lst.IsLimited(m.Request, m.ResponseWriter, m.Session(), isPayedUser)
+			if isLimit == 1 { //没有被限制
+				defer public.Lst.Limit()
+			}
+		}
+		//第一页数据展示多字段(table表格需要)
+		filed := bidSearch_field_1
+		if pageNum == 1 {
+			filed = bidSearch_field
+		}
+		if isLimit == 1 {
+			secondKWS, b_word, a_word, _, secondFlag, _, _, list = bidsearch.SearchData("app", m.Request, pageNum, util.ObjToString(m.GetSession("userId")), secondKWS, searchvalue, scope, city, publishtime, subtype, industry, minprice, maxprice, winner, buyerclass, hasBuyerTel, hasWinnerTel, fileExists, pageNum, bidsearch.SearchPageSize_APP, true, queryItems, filed, notkey, isPayedUser, false, "")
+		}
+	}
 
-    secondList, _, hasNextPage = bidsearch.LisetData(3, pageNum, list, secondFlag, config.Seoconfig, isPayedUser)
-    m.ServeJson(map[string]interface{}{
-        "limitFlag":     false,
-        "status":        isLimit,
-        "list":          list,
-        "hasNextPage":   hasNextPage,
-        "history":       m.T["history"],
-        "msgset":        m.T["msgset"],
-        "interceptWord": a_word,
-        "keyWord":       b_word,
-        "isLogin":       m.GetSession("userId") != nil,
-        "secondFlag":    secondFlag,
-        "secondList":    secondList,
-        "secondKWS":     secondKWS,
-    })
+	secondList, _, hasNextPage = bidsearch.LisetData(3, pageNum, list, secondFlag, config.Seoconfig, isPayedUser)
+	m.ServeJson(map[string]interface{}{
+		"limitFlag":     false,
+		"status":        isLimit,
+		"list":          list,
+		"hasNextPage":   hasNextPage,
+		"history":       m.T["history"],
+		"msgset":        m.T["msgset"],
+		"interceptWord": a_word,
+		"keyWord":       b_word,
+		"isLogin":       m.GetSession("userId") != nil,
+		"secondFlag":    secondFlag,
+		"secondList":    secondList,
+		"secondKWS":     secondKWS,
+	})
 
 }
 
 //预览结果
 func (m *Front) WxpushView() error {
-    defer util.Catch()
-    userid := util.ObjToString(m.GetSession("userId"))
-    if userid == "" {
-        return m.Redirect("/jyapp/login")
-    }
-    a_key, list := public.PushViewDatas(userid, "", bidSearch_field_1, 1, bidsearch.SearchPageSize_APP)
-    public.BidListConvert("", list)
-    m.T["firstPage"] = list
-    m.T["hasNextPage"] = list != nil && len(*list) == bidsearch.SearchPageSize_APP
-    m.T["pageSize"] = bidsearch.SearchPageSize_APP
-    m.T["a_key"] = a_key
-    return m.Render("/weixin/resultpreview.html", &m.T)
+	defer util.Catch()
+	userid := util.ObjToString(m.GetSession("userId"))
+	if userid == "" {
+		return m.Redirect("/jyapp/login")
+	}
+	a_key, list := public.PushViewDatas(userid, "", bidSearch_field_1, 1, bidsearch.SearchPageSize_APP)
+	public.BidListConvert("", list)
+	m.T["firstPage"] = list
+	m.T["hasNextPage"] = list != nil && len(*list) == bidsearch.SearchPageSize_APP
+	m.T["pageSize"] = bidsearch.SearchPageSize_APP
+	m.T["a_key"] = a_key
+	return m.Render("/weixin/resultpreview.html", &m.T)
 }
 func (m *Front) WxpushViewPaging() {
-    defer util.Catch()
-    var list *[]map[string]interface{}
-    pageNum, _ := m.GetInteger("pageNum")
-    if userid := util.ObjToString(m.GetSession("userId")); userid != "" && pageNum <= bidsearch.SearchMaxPageNum_APP {
-        _, list = public.PushViewDatas(userid, "", bidSearch_field_1, pageNum, bidsearch.SearchPageSize_APP)
-    }
-    public.BidListConvert("", list)
-    m.ServeJson(map[string]interface{}{
-        "list":        list,
-        "hasNextPage": list != nil && len(*list) == bidsearch.SearchPageSize_APP && pageNum < bidsearch.SearchMaxPageNum_APP,
-    })
+	defer util.Catch()
+	var list *[]map[string]interface{}
+	pageNum, _ := m.GetInteger("pageNum")
+	if userid := util.ObjToString(m.GetSession("userId")); userid != "" && pageNum <= bidsearch.SearchMaxPageNum_APP {
+		_, list = public.PushViewDatas(userid, "", bidSearch_field_1, pageNum, bidsearch.SearchPageSize_APP)
+	}
+	public.BidListConvert("", list)
+	m.ServeJson(map[string]interface{}{
+		"list":        list,
+		"hasNextPage": list != nil && len(*list) == bidsearch.SearchPageSize_APP && pageNum < bidsearch.SearchMaxPageNum_APP,
+	})
 }
 
 /*func (f *Front) HasPushHistory() {
@@ -430,132 +431,132 @@ func (m *Front) WxpushViewPaging() {
 
 //历史推送
 func (f *Front) Historypush() error {
-    if f.GetString("f") == "push" {
-        if f.GetString("t") == "member" {
-            f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
-        } else if f.GetString("t") == "entniche" {
-            f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Entniche)
-        } else {
-            f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
-        }
-    }
-    userId, _ := f.GetSession("userId").(string)
-    if userId != "" {
-        vipSubtips := 1
-        // 打开推送
-        data, ok := mongodb.FindById("user", userId, `{"i_vip_subtips":1,"isread":1}`)
-        if ok && data != nil && len(*data) > 0 {
-            //VIP服务到期
-            i_vip_subtips := (*data)["i_vip_subtips"]
-            if i_vip_subtips == 0 {
-                if mongodb.UpdateById("user", userId, bson.M{"$set": bson.M{"i_vip_subtips": 1}}) {
-                    vipSubtips = 0
-                }
-            }
-        }
-        f.T["isread"] = (*data)["isread"]
-        f.T["vipSubtips"] = vipSubtips
-        f.T["userId"] = userId
-        f.T["isIosExam"], f.T["isIosExamPhone"], f.T["isVip"], _ = IosExamInfo(f.Action, true, false)
-    }
-    return f.Render("/weixin/historypush.html", &f.T)
+	if f.GetString("f") == "push" {
+		if f.GetString("t") == "member" {
+			f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Member)
+		} else if f.GetString("t") == "entniche" {
+			f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Entniche)
+		} else {
+			f.SetSession(jy.SwitchService.SessionKey, jy.SwitchService.Vip)
+		}
+	}
+	userId, _ := f.GetSession("userId").(string)
+	if userId != "" {
+		vipSubtips := 1
+		// 打开推送
+		data, ok := mongodb.FindById("user", userId, `{"i_vip_subtips":1,"isread":1}`)
+		if ok && data != nil && len(*data) > 0 {
+			//VIP服务到期
+			i_vip_subtips := (*data)["i_vip_subtips"]
+			if i_vip_subtips == 0 {
+				if mongodb.UpdateById("user", userId, bson.M{"$set": bson.M{"i_vip_subtips": 1}}) {
+					vipSubtips = 0
+				}
+			}
+		}
+		f.T["isread"] = (*data)["isread"]
+		f.T["vipSubtips"] = vipSubtips
+		f.T["userId"] = userId
+		f.T["isIosExam"], f.T["isIosExamPhone"], f.T["isVip"], _ = IosExamInfo(f.Action, true, false)
+	}
+	return f.Render("/weixin/historypush.html", &f.T)
 }
 
 func MFollow(userId, pname, pcode, title string) (bool, string) {
-    defer util.Catch()
-    var followId string
-    followFlag := false
-    follows, ok := mongodb.Find("follow_project", `{"s_userid":"`+userId+`"}`, `{"_id":1,"s_projectname":1,"s_projectcode":1}`, nil, false, -1, -1)
-    if ok && follows != nil && len(*follows) > 0 {
-        for _, v := range *follows {
-            pc, _ := v["s_projectcode"].(string)
-            pn, _ := v["s_projectname"].(string)
-            if (pc != "" && pc == pcode) || (pn != "" && pn == pname) {
-                followFlag = true
-                followId = util.EncodeArticleId2ByCheck(BsonIdToSId(v["_id"]))
-                break
-            }
-        }
-    }
-    return followFlag, followId
+	defer util.Catch()
+	var followId string
+	followFlag := false
+	follows, ok := mongodb.Find("follow_project", `{"s_userid":"`+userId+`"}`, `{"_id":1,"s_projectname":1,"s_projectcode":1}`, nil, false, -1, -1)
+	if ok && follows != nil && len(*follows) > 0 {
+		for _, v := range *follows {
+			pc, _ := v["s_projectcode"].(string)
+			pn, _ := v["s_projectname"].(string)
+			if (pc != "" && pc == pcode) || (pn != "" && pn == pname) {
+				followFlag = true
+				followId = util.EncodeArticleId2ByCheck(BsonIdToSId(v["_id"]))
+				break
+			}
+		}
+	}
+	return followFlag, followId
 }
 func wxvisitD(sid, userId string, isPayUser bool) (objdata map[string]interface{}) {
-    defer util.Catch()
-    var obj map[string]interface{}
-    if len(sid) > 5 {
-        aobj, ok := public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection, sid, public.MgoBiddingFields)
-        if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
-            aobj, ok = public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection_back, sid, public.MgoBiddingFields)
-        }
-        //aobj, ok := elastic.GetByIdField("bidding", "bidding", sid, ""), true
-        obj = *aobj
-        if ok && obj != nil && len(obj) >= 3 {
-            if !isPayUser && (util.ObjToString(obj["subtype"]) == "拟建" || util.ObjToString(obj["subtype"]) == "采购意向") {
-                for k, _ := range obj {
-                    if k != "title" && k != "area" && k != "subtype" && k != "toptype" && k != "publishtime" && k != "budget" && k != "bidamount" && k != "site" && k != "spidercode" && k != "recommended_service" {
-                        delete(obj, k)
-                    }
-                }
-            }
-            obj["_id"] = util.EncodeArticleId2ByCheck(sid)
-            // obj["url"] = obj["href"]
-            pt := obj["publishtime"]
-            obj["l_publishtime"] = pt
-            obj["publishtime"] = util.FormatDateWithObj(&pt, util.Date_Full_Layout)
-            //查询是否关注
-            obj["followFlag"] = false
-            obj["hasSession"] = false
-            var infoformat = util.IntAllDef(obj["infoformat"], 1)
-            obj["infoformat"] = infoformat
-            //精准字段(竞争对手的地址) 或  拟建项目
-            if obj["competehref"] != nil || infoformat == 2 {
-                delete(obj, "href")
-            }
-            if userId != "" {
-                pcode, _ := obj["projectcode"].(string)
-                pname, _ := obj["projectname"].(string)
-                titleTmp := util.ObjToString(obj["title"])
-                obj["followFlag"], obj["followId"] = MFollow(userId, pname, pcode, titleTmp)
-                if len([]rune(titleTmp)) > 100 {
-                    titleTmp = string([]rune(titleTmp)[:100]) + "..."
-                }
-                titleTmp = public.ClearHtml.ReplaceAllString(titleTmp, "")
-                obj["title"] = titleTmp
-                obj["hasSession"] = true
+	defer util.Catch()
+	var obj map[string]interface{}
+	if len(sid) > 5 {
+		aobj, ok := public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection, sid, public.MgoBiddingFields)
+		if ok && (aobj == nil || *aobj == nil || len(*aobj) == 0) {
+			aobj, ok = public.Mgo_Bidding.FindById(public.DbConf.Mongodb.Bidding.Collection_back, sid, public.MgoBiddingFields)
+		}
+		//aobj, ok := elastic.GetByIdField("bidding", "bidding", sid, ""), true
+		obj = *aobj
+		if ok && obj != nil && len(obj) >= 3 {
+			if !isPayUser && (util.ObjToString(obj["subtype"]) == "拟建" || util.ObjToString(obj["subtype"]) == "采购意向") {
+				for k, _ := range obj {
+					if k != "title" && k != "area" && k != "subtype" && k != "toptype" && k != "publishtime" && k != "budget" && k != "bidamount" && k != "site" && k != "spidercode" && k != "recommended_service" {
+						delete(obj, k)
+					}
+				}
+			}
+			obj["_id"] = util.EncodeArticleId2ByCheck(sid)
+			// obj["url"] = obj["href"]
+			pt := obj["publishtime"]
+			obj["l_publishtime"] = pt
+			obj["publishtime"] = util.FormatDateWithObj(&pt, util.Date_Full_Layout)
+			//查询是否关注
+			obj["followFlag"] = false
+			obj["hasSession"] = false
+			var infoformat = util.IntAllDef(obj["infoformat"], 1)
+			obj["infoformat"] = infoformat
+			//精准字段(竞争对手的地址) 或  拟建项目
+			if obj["competehref"] != nil || infoformat == 2 {
+				delete(obj, "href")
+			}
+			if userId != "" {
+				pcode, _ := obj["projectcode"].(string)
+				pname, _ := obj["projectname"].(string)
+				titleTmp := util.ObjToString(obj["title"])
+				obj["followFlag"], obj["followId"] = MFollow(userId, pname, pcode, titleTmp)
+				if len([]rune(titleTmp)) > 100 {
+					titleTmp = string([]rune(titleTmp)[:100]) + "..."
+				}
+				titleTmp = public.ClearHtml.ReplaceAllString(titleTmp, "")
+				obj["title"] = titleTmp
+				obj["hasSession"] = true
 
-                //obj["title"] = util.If(len([]rune(titleTmp)) > 100, string([]rune(titleTmp)[:100])+"...", string(titleTmp)).(string)
-            }
-            if strings.Trim(util.ObjToString(obj["detail"]), " ") == "" {
-                obj["detail"] = ""
-            }
-        }
-    }
-    return obj
+				//obj["title"] = util.If(len([]rune(titleTmp)) > 100, string([]rune(titleTmp)[:100])+"...", string(titleTmp)).(string)
+			}
+			if strings.Trim(util.ObjToString(obj["detail"]), " ") == "" {
+				obj["detail"] = ""
+			}
+		}
+	}
+	return obj
 }
 func (f *Front) GetRecomKWs() {
-    count, _ := f.GetInteger("count")
-    f.ServeJson(public.RecomKws.GetRecomKws(f.GetString("value"), count, float32(config.Sysconfig["recommendThreshold"].(float64))))
+	count, _ := f.GetInteger("count")
+	f.ServeJson(public.RecomKws.GetRecomKws(f.GetString("value"), count, float32(config.Sysconfig["recommendThreshold"].(float64))))
 }
 
 //记录用户行为--推荐关键词
 func (f *Front) BehaviorRecord() {
-    flag := saveBehaviorRecord(f.Session(),
-        bson.M{
-            "s_word":   f.GetString("value"),
-            "s_type":   f.GetString("type"),
-            "s_source": f.GetString("source"),
-        })
-    f.ServeJson(bson.M{"flag": flag})
+	flag := saveBehaviorRecord(f.Session(),
+		bson.M{
+			"s_word":   f.GetString("value"),
+			"s_type":   f.GetString("type"),
+			"s_source": f.GetString("source"),
+		})
+	f.ServeJson(bson.M{"flag": flag})
 }
 
 //记录用户行为
 func saveBehaviorRecord(sess *httpsession.Session, data bson.M) bool {
-    userId, _ := sess.Get("userId").(string)
-    nickName, _ := sess.Get("s_nickname").(string)
-    data["s_userid"] = userId
-    data["s_nickname"] = nickName
-    data["l_createtime"] = time.Now().Unix()
-    return len(mongodb.Save("behavior", data)) > 0
+	userId, _ := sess.Get("userId").(string)
+	nickName, _ := sess.Get("s_nickname").(string)
+	data["s_userid"] = userId
+	data["s_nickname"] = nickName
+	data["l_createtime"] = time.Now().Unix()
+	return len(mongodb.Save("behavior", data)) > 0
 }
 
 /*func (m *Front) WxpushAjaxReq() error {
@@ -571,78 +572,78 @@ func saveBehaviorRecord(sess *httpsession.Session, data bson.M) bool {
 	return nil
 }*/
 func (m *Front) DelWxHistorySearch() {
-    defer util.Catch()
-    //定义一个无用参数作为返回值
-    var rt string = "rt"
-    userId := m.GetSession("userId")
-    history := redis.GetStr("other", "s_"+userId.(string))
-    if len(history) > 0 || history != "" {
-        redis.Del("other", "s_"+userId.(string))
-    }
-    m.ServeJson(map[string]interface{}{
-        "rt": rt,
-    })
+	defer util.Catch()
+	//定义一个无用参数作为返回值
+	var rt string = "rt"
+	userId := m.GetSession("userId")
+	history := redis.GetStr("other", "s_"+userId.(string))
+	if len(history) > 0 || history != "" {
+		redis.Del("other", "s_"+userId.(string))
+	}
+	m.ServeJson(map[string]interface{}{
+		"rt": rt,
+	})
 }
 func (m *Front) GetIndexData() {
-    defer util.Catch()
-    redis_obj := redis.Get("other", "sw_index")
-    var one map[string]interface{}
-    if redis_obj != nil {
-        one = redis_obj.(map[string]interface{})
-        log.Println("newpage from the cache...")
-    } else {
-        rs, err := mongodb.Find("swordfish_index", nil, `{"_id":-1}`, nil, false, 0, 1)
-        if err {
-            one = (*rs)[0]
-            one["i_site"] = util.IntAll(one["i_entsite"]) + util.IntAll(one["i_govsite"])
-            avg := util.IntAll(one["i_bidmonth"])/21 + util.IntAll(one["i_bidmonth"])%21
-            one["i_avg"] = avg
-            one["i_my"] = util.IntAll(one["i_entsite"]) * 35 / 100
-            one["i_hy"] = util.IntAll(one["i_entsite"]) * 15 / 100
-            one["i_zb"] = util.IntAll(one["i_entsite"]) - util.IntAll(one["i_my"]) - util.IntAll(one["i_hy"])
-            redis.Put("other", "sw_index", one, 60*60*2)
-        } else {
-            m.ServeJson("n")
-        }
-    }
-    m.ServeJson(one)
+	defer util.Catch()
+	redis_obj := redis.Get("other", "sw_index")
+	var one map[string]interface{}
+	if redis_obj != nil {
+		one = redis_obj.(map[string]interface{})
+		log.Println("newpage from the cache...")
+	} else {
+		rs, err := mongodb.Find("swordfish_index", nil, `{"_id":-1}`, nil, false, 0, 1)
+		if err {
+			one = (*rs)[0]
+			one["i_site"] = util.IntAll(one["i_entsite"]) + util.IntAll(one["i_govsite"])
+			avg := util.IntAll(one["i_bidmonth"])/21 + util.IntAll(one["i_bidmonth"])%21
+			one["i_avg"] = avg
+			one["i_my"] = util.IntAll(one["i_entsite"]) * 35 / 100
+			one["i_hy"] = util.IntAll(one["i_entsite"]) * 15 / 100
+			one["i_zb"] = util.IntAll(one["i_entsite"]) - util.IntAll(one["i_my"]) - util.IntAll(one["i_hy"])
+			redis.Put("other", "sw_index", one, 60*60*2)
+		} else {
+			m.ServeJson("n")
+		}
+	}
+	m.ServeJson(one)
 }
 
 //手动删除30天无更新数据
 func (m *Front) DelOL() error {
-    defer util.Catch()
-    var ids []primitive.ObjectID
-    var flag = "F"
-    var arrid = strings.Split(m.GetString("arrid"), ",")
-    log.Println("---->", arrid)
-    if len(arrid) > 0 {
-        for _, chid := range arrid {
-            _id, _ := primitive.ObjectIDFromHex(util.DecodeArticleId2ByCheck(chid)[0])
-            ids = append(ids, _id)
-        }
-    }
-    userId, ok := m.GetSession("userId").(string)
-    log.Println("sss", ids)
-    if !ok || userId == "" || len(ids) < 1 {
-        m.ServeJson(map[string]interface{}{
-            "flag": flag,
-        })
-        return nil
-    }
-    if datas, ok := mongodb.Find("follow_project", bson.M{"_id": bson.M{"$in": ids}, "s_userid": m.GetSession("userId").(string)}, nil, nil, false, -1, -1); ok && datas != nil {
-        for _, v := range *datas {
-            go delRelRedis(v["s_userid"], v["a_relationinfo"])
-            v["s_followid"] = BsonIdToSId(v["_id"])
-            delete(v, "_id")
-            v["i_status"] = 2
-            mongodb.Save("follow_project_back", v)
-        }
-    }
-    if mongodb.Del("follow_project", bson.M{"_id": bson.M{"$in": ids}, "s_userid": m.GetSession("userId").(string)}) {
-        flag = "T"
-    }
-    m.ServeJson(map[string]interface{}{
-        "flag": flag,
-    })
-    return nil
+	defer util.Catch()
+	var ids []primitive.ObjectID
+	var flag = "F"
+	var arrid = strings.Split(m.GetString("arrid"), ",")
+	log.Println("---->", arrid)
+	if len(arrid) > 0 {
+		for _, chid := range arrid {
+			_id, _ := primitive.ObjectIDFromHex(util.DecodeArticleId2ByCheck(chid)[0])
+			ids = append(ids, _id)
+		}
+	}
+	userId, ok := m.GetSession("userId").(string)
+	log.Println("sss", ids)
+	if !ok || userId == "" || len(ids) < 1 {
+		m.ServeJson(map[string]interface{}{
+			"flag": flag,
+		})
+		return nil
+	}
+	if datas, ok := mongodb.Find("follow_project", bson.M{"_id": bson.M{"$in": ids}, "s_userid": m.GetSession("userId").(string)}, nil, nil, false, -1, -1); ok && datas != nil {
+		for _, v := range *datas {
+			go delRelRedis(v["s_userid"], v["a_relationinfo"])
+			v["s_followid"] = BsonIdToSId(v["_id"])
+			delete(v, "_id")
+			v["i_status"] = 2
+			mongodb.Save("follow_project_back", v)
+		}
+	}
+	if mongodb.Del("follow_project", bson.M{"_id": bson.M{"$in": ids}, "s_userid": m.GetSession("userId").(string)}) {
+		flag = "T"
+	}
+	m.ServeJson(map[string]interface{}{
+		"flag": flag,
+	})
+	return nil
 }