|
@@ -28,7 +28,7 @@ import (
|
|
|
const (
|
|
|
query = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","subtype","s_winner","buyertel","winnertel","buyerclass","filetext"],"from":0,"size":%d}`
|
|
|
mongodb_fields = `{"_id":1,"area":1,"publishtime":1,"s_subscopeclass":1,"subtype":1,"title":1,"toptype":1,"type":1, "buyerclass":1,"budget":1,"bidamount":1,"winnertel":1,"s_winner":1,"buyertel":1,"attach_text":1}`
|
|
|
- querys = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","title","detail","area","city","publishtime","projectname","buyer","buyerclass","s_winner","bidamount","subtype","toptype","projectcode","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel","filetext","spidercode","site"],"from":0,"size":%d}`
|
|
|
+ querys = `{"query":{"terms":{"_id":["%s"]}},"_source":["_id","title","detail","area","city","publishtime","projectname","buyer","buyerclass","s_winner","bidamount","subtype","toptype","projectcode","buyertel","budget","bidopentime","agency","projectscope","winnerperson","winnertel","filetext","spidercode","site"],"from":0,"size":%d}}`
|
|
|
)
|
|
|
|
|
|
var (
|
|
@@ -36,7 +36,7 @@ var (
|
|
|
insertCollKey2 = []string{"userid", "bid", "labelid", "buyerclass", "buyerinfo", "winnerinfo", "createdate"}
|
|
|
)
|
|
|
|
|
|
-// 招标信息是否被收藏 并返回标签
|
|
|
+//招标信息是否被收藏 并返回标签
|
|
|
func IsCollByBidsBackInfo(bids, userid string) map[string]interface{} {
|
|
|
res := map[string]interface{}{
|
|
|
"iscoll": false,
|
|
@@ -75,7 +75,7 @@ func IsCollByBidsBackInfo(bids, userid string) map[string]interface{} {
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
-// 招标信息是否被收藏
|
|
|
+//招标信息是否被收藏
|
|
|
func IsCollByBids(bids, userid string) []string {
|
|
|
res := []string{}
|
|
|
collBidMap := map[string]bool{}
|
|
@@ -125,7 +125,7 @@ func IsCollByBids(bids, userid string) []string {
|
|
|
return res
|
|
|
}
|
|
|
|
|
|
-// 获取用户标签
|
|
|
+//获取用户标签
|
|
|
type LabelByUser struct {
|
|
|
Lid string `json:"lid"`
|
|
|
Lname string `json:"lanme"`
|
|
@@ -162,7 +162,7 @@ type BidAction struct {
|
|
|
Binfo []BidInfo `json:"binfo"`
|
|
|
}
|
|
|
|
|
|
-// 招标信息 bid&userid 唯一
|
|
|
+//招标信息 bid&userid 唯一
|
|
|
type BidInfo struct {
|
|
|
Bid string `json:"bid"` //招标信息id 加密后
|
|
|
Buyerclass string `json:"buyerclass"` //采购单位类型
|
|
@@ -173,7 +173,7 @@ type BidInfo struct {
|
|
|
Labelid string `json:"labelid"` //标签ids
|
|
|
}
|
|
|
|
|
|
-// 收藏招标信息(批量收藏)|取消收藏(批量取消)
|
|
|
+//收藏招标信息(批量收藏)|取消收藏(批量取消)
|
|
|
func BidCollOrRemByIds(bidAction BidAction, session *httpsession.Session) map[string]interface{} {
|
|
|
var i = 0
|
|
|
ok, msg := true, ""
|
|
@@ -244,7 +244,7 @@ func BidCollOrRemByIds(bidAction BidAction, session *httpsession.Session) map[st
|
|
|
return m
|
|
|
}
|
|
|
|
|
|
-// 添加或绑定标签|删除标签
|
|
|
+//添加或绑定标签|删除标签
|
|
|
type LabelInfo struct {
|
|
|
Lids string `json:"lids"` //标签ids
|
|
|
Lname string `json:"lname"` //标签名称
|
|
@@ -252,7 +252,7 @@ type LabelInfo struct {
|
|
|
Laction string `json:"laction"` //用户行为:S添加或绑定标签;D删除标签
|
|
|
}
|
|
|
|
|
|
-// 新增标签(并使用)|删除标签 RV0=
|
|
|
+//新增标签(并使用)|删除标签 RV0=
|
|
|
func LabelAction(labInfo *LabelInfo, session *httpsession.Session) map[string]interface{} {
|
|
|
userid := qu.ObjToString(session.Get("userId"))
|
|
|
ibool, ok, msg := true, true, ""
|
|
@@ -434,7 +434,7 @@ func GetCollList(c *util.CollList, session *httpsession.Session) map[string]inte
|
|
|
return rdata
|
|
|
}
|
|
|
|
|
|
-// 是否是付费用户 -bool: true:是 fasle:不是
|
|
|
+//是否是付费用户 -bool: true:是 fasle:不是
|
|
|
func Power(session *httpsession.Session) (bool, map[string]interface{}) {
|
|
|
isVip, isMember, isEnt, privatedata := false, false, false, false
|
|
|
vipstatus := 0
|
|
@@ -484,7 +484,7 @@ type InfoList struct {
|
|
|
Spidercode string `json:"spidercode"`
|
|
|
}
|
|
|
|
|
|
-// 根据id取内容
|
|
|
+//根据id取内容
|
|
|
func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist []map[string]interface{}) []*InfoList {
|
|
|
var array []*InfoList
|
|
|
if len(idlist) == 0 {
|
|
@@ -502,9 +502,7 @@ func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist
|
|
|
infos := map[string]map[string]interface{}{}
|
|
|
// log.Println("es_ids:", len(es_ids))
|
|
|
if len(es_ids) > 0 {
|
|
|
- q := fmt.Sprintf(querys, strings.Join(es_ids, `","`), len(es_ids))
|
|
|
- log.Println("bidcoll query:", q)
|
|
|
- list := elastic.Get("bidding", "bidding", q)
|
|
|
+ list := elastic.Get("bidding", "bidding", fmt.Sprintf(querys, strings.Join(es_ids, `","`), len(es_ids)))
|
|
|
if list != nil {
|
|
|
for _, v := range *list {
|
|
|
_id := qu.ObjToString(v["_id"])
|
|
@@ -567,7 +565,7 @@ func GetInfoById(Mgo_bidding mg.MongodbSim, bidding, bidding_back string, idlist
|
|
|
return array
|
|
|
}
|
|
|
|
|
|
-// 列表单条信息格式化
|
|
|
+//列表单条信息格式化
|
|
|
func InfoFormat(p string, info *map[string]interface{}) *InfoList {
|
|
|
area := qu.ObjToString((*info)["area"])
|
|
|
if area == "A" {
|
|
@@ -681,7 +679,7 @@ func getwinnertel(company interface{}) string {
|
|
|
return ""
|
|
|
}
|
|
|
|
|
|
-// 新增标签
|
|
|
+//新增标签
|
|
|
func AddLab(name, userid string) map[string]interface{} {
|
|
|
m := map[string]interface{}{
|
|
|
"labid": "",
|
|
@@ -778,10 +776,8 @@ func UpdateCollListRedis(typ, userid string, list []string) bool {
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
- isColl int: 收藏条数的状态 (是否超过100条 超过:2 没超过:1)
|
|
|
-
|
|
|
+ isColl int: 收藏条数的状态 (是否超过100条 超过:2 没超过:1)
|
|
|
return
|
|
|
-
|
|
|
[]string:收藏的id
|
|
|
*/
|
|
|
func GetCollRedis(userid string, isColl int) []string {
|