|
@@ -8,6 +8,7 @@ import (
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mongodb"
|
|
"app.yhyue.com/moapp/jybase/mysql"
|
|
"app.yhyue.com/moapp/jybase/mysql"
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
"app.yhyue.com/moapp/jybase/redis"
|
|
|
|
+ "database/sql"
|
|
"encoding/json"
|
|
"encoding/json"
|
|
"fmt"
|
|
"fmt"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
@@ -34,6 +35,15 @@ const (
|
|
MemberFlag = "mType"
|
|
MemberFlag = "mType"
|
|
EntnicheFlag = "eType"
|
|
EntnicheFlag = "eType"
|
|
oneDay = 24 * 60 * 60
|
|
oneDay = 24 * 60 * 60
|
|
|
|
+ Pushbidding = "pushbidding"
|
|
|
|
+ Province = "province"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+var (
|
|
|
|
+ buildingInsertCollKey = []string{"infoid", "area", "city", "buyerclass", "toptype", "subtype", "subscopeclass", "budget", "bidamount", "attachment_count", "publishtime"}
|
|
|
|
+ ennicheInsertCollKey = []string{"entid", "deptid", "userid", "bidid", "matchkeys", "date"}
|
|
|
|
+ subscribeInsertCollKey = []string{"userid", "bidid", "matchkeys", "date"}
|
|
|
|
+ memberInsertCollKey = []string{"userid", "bidid", "matchkeys", "date"}
|
|
)
|
|
)
|
|
|
|
|
|
var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
|
|
var aboutDbMsg map[string]*AboutDbMsg = map[string]*AboutDbMsg{
|
|
@@ -67,26 +77,26 @@ type PushCa struct {
|
|
|
|
|
|
//查询参数
|
|
//查询参数
|
|
type SubPushQueryParam struct {
|
|
type SubPushQueryParam struct {
|
|
- Mgo_bidding mongodb.MongodbSim //
|
|
|
|
- Bidding string //
|
|
|
|
- Bidding_back string //
|
|
|
|
- PushMysql *mysql.Mysql //
|
|
|
|
- UserId string //用户id
|
|
|
|
- PageNum int //页面
|
|
|
|
- PageSize int //每页数量
|
|
|
|
- SelectTime string //时间
|
|
|
|
- Area string //区域
|
|
|
|
- City string //城市
|
|
|
|
- Buyerclass string //采购单位行业
|
|
|
|
- Subtype string //信息类型 二级分类
|
|
|
|
- Subscopeclass string //信息行业
|
|
|
|
- Key string //订阅词
|
|
|
|
- Export bool //导出
|
|
|
|
- EntId string //企业id
|
|
|
|
- Price string //价格
|
|
|
|
- FileExists string //是否有附件;默认全部;1:有附件;-1:无附件
|
|
|
|
- EntUserId string //商机管理用户id
|
|
|
|
- DeptId string //商机管理用户部门id
|
|
|
|
|
|
+ Mgo_bidding mongodb.MongodbSim //
|
|
|
|
+ Bidding string //
|
|
|
|
+ Bidding_back string //
|
|
|
|
+ UserId string //用户id
|
|
|
|
+ PageNum int //页面
|
|
|
|
+ PageSize int //每页数量
|
|
|
|
+ SelectTime string //时间
|
|
|
|
+ Area string //区域
|
|
|
|
+ City string //城市
|
|
|
|
+ Buyerclass string //采购单位行业
|
|
|
|
+ Subtype string //信息类型 二级分类
|
|
|
|
+ Subscopeclass string //信息行业
|
|
|
|
+ Key string //订阅词
|
|
|
|
+ Export bool //导出
|
|
|
|
+ EntId string //企业id
|
|
|
|
+ Price string //价格
|
|
|
|
+ FileExists string //是否有附件;默认全部;1:有附件;-1:无附件
|
|
|
|
+ EntUserId string //商机管理用户id
|
|
|
|
+ DeptId string //商机管理用户部门id
|
|
|
|
+ BaseServiceMysql *mysql.Mysql
|
|
}
|
|
}
|
|
|
|
|
|
func (spqp *SubPushQueryParam) IsEmpty() bool {
|
|
func (spqp *SubPushQueryParam) IsEmpty() bool {
|
|
@@ -289,14 +299,14 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
|
|
|
|
|
|
//
|
|
//
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
|
|
- querys := []string{fmt.Sprintf("userid='%s'", common.If(s.ModuleFlag == "eType", spqp.EntUserId, spqp.UserId))}
|
|
|
|
|
|
+ querys := []string{fmt.Sprintf("a.userid='%s'", common.If(s.ModuleFlag == "eType", spqp.EntUserId, spqp.UserId))}
|
|
//时间
|
|
//时间
|
|
if starttime > 0 && endtime > 0 {
|
|
if starttime > 0 && endtime > 0 {
|
|
- querys = append(querys, fmt.Sprintf("date>=%d and date<=%d", starttime, endtime))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.date>=%d and date<=%d", starttime, endtime))
|
|
} else if starttime > 0 && endtime == 0 {
|
|
} else if starttime > 0 && endtime == 0 {
|
|
- querys = append(querys, fmt.Sprintf("date>=%d", starttime))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.date>=%d", starttime))
|
|
} else if starttime == 0 && endtime > 0 {
|
|
} else if starttime == 0 && endtime > 0 {
|
|
- querys = append(querys, fmt.Sprintf("date<=%d", endtime))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("a.date<=%d", endtime))
|
|
}
|
|
}
|
|
if spqp.Area != "" || spqp.City != "" {
|
|
if spqp.Area != "" || spqp.City != "" {
|
|
var sqlAreaCity = ""
|
|
var sqlAreaCity = ""
|
|
@@ -313,7 +323,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
city = append(city, "9999")
|
|
city = append(city, "9999")
|
|
}
|
|
}
|
|
if len(city) > 0 {
|
|
if len(city) > 0 {
|
|
- sqlAreaCity = fmt.Sprintf("city in (%s)", strings.Join(city, ","))
|
|
|
|
|
|
+ sqlAreaCity = fmt.Sprintf("p.city in (%s)", strings.Join(city, ","))
|
|
}
|
|
}
|
|
//区域
|
|
//区域
|
|
var sqlArea = ""
|
|
var sqlArea = ""
|
|
@@ -329,7 +339,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
area = append(area, "9999")
|
|
area = append(area, "9999")
|
|
}
|
|
}
|
|
if len(area) > 0 {
|
|
if len(area) > 0 {
|
|
- sqlArea = fmt.Sprintf("area in (%s)", strings.Join(area, ","))
|
|
|
|
|
|
+ sqlArea = fmt.Sprintf("p.area in (%s)", strings.Join(area, ","))
|
|
}
|
|
}
|
|
if sqlAreaCity != "" && sqlArea != "" {
|
|
if sqlAreaCity != "" && sqlArea != "" {
|
|
sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )"
|
|
sqlAreaCity = "( " + sqlAreaCity + " or " + sqlArea + " )"
|
|
@@ -350,7 +360,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
buyerclass = append(buyerclass, "9999")
|
|
buyerclass = append(buyerclass, "9999")
|
|
}
|
|
}
|
|
if len(buyerclass) > 0 {
|
|
if len(buyerclass) > 0 {
|
|
- querys = append(querys, fmt.Sprintf("buyerclass in (%s)", strings.Join(buyerclass, ",")))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("b.buyerclass in (%s)", strings.Join(buyerclass, ",")))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//信息类型
|
|
//信息类型
|
|
@@ -363,14 +373,14 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
subtype = append(subtype, "9999")
|
|
subtype = append(subtype, "9999")
|
|
}
|
|
}
|
|
if len(subtype) > 0 {
|
|
if len(subtype) > 0 {
|
|
- querys = append(querys, fmt.Sprintf("subtype in (%s)", strings.Join(subtype, ",")))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("b.subtype in (%s)", strings.Join(subtype, ",")))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//信息行业
|
|
//信息行业
|
|
if spqp.Subscopeclass != "" {
|
|
if spqp.Subscopeclass != "" {
|
|
find_in_set := []string{}
|
|
find_in_set := []string{}
|
|
for _, v := range strings.Split(spqp.Subscopeclass, ",") {
|
|
for _, v := range strings.Split(spqp.Subscopeclass, ",") {
|
|
- find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%d',subscopeclass)", IC.PushMapping.Subscopeclass[v]))
|
|
|
|
|
|
+ find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%d',b.subscopeclass)", IC.PushMapping.Subscopeclass[v]))
|
|
}
|
|
}
|
|
if len(find_in_set) == 1 {
|
|
if len(find_in_set) == 1 {
|
|
querys = append(querys, find_in_set[0])
|
|
querys = append(querys, find_in_set[0])
|
|
@@ -382,7 +392,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
if spqp.Key != "" {
|
|
if spqp.Key != "" {
|
|
find_in_set := []string{}
|
|
find_in_set := []string{}
|
|
for _, v := range strings.Split(spqp.Key, ",") {
|
|
for _, v := range strings.Split(spqp.Key, ",") {
|
|
- find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(matchkeys,'+',','),' ',','))", v))
|
|
|
|
|
|
+ find_in_set = append(find_in_set, fmt.Sprintf("find_in_set('%s',replace(replace(a.matchkeys,'+',','),' ',','))", v))
|
|
}
|
|
}
|
|
if len(find_in_set) == 1 {
|
|
if len(find_in_set) == 1 {
|
|
querys = append(querys, find_in_set[0])
|
|
querys = append(querys, find_in_set[0])
|
|
@@ -396,27 +406,28 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
|
|
minPrice := common.Int64All(common.Float64All(minPriceStr) * 10000) //换成元
|
|
maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
|
|
maxPrice := common.Int64All(common.Float64All(maxPriceStr) * 10000) //换成元
|
|
if minPriceStr != "" && maxPriceStr != "" {
|
|
if minPriceStr != "" && maxPriceStr != "" {
|
|
- querys = append(querys, fmt.Sprintf("((bidamount>=%d and bidamount<=%d) or (budget>=%d and budget<=%d and bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("((b.bidamount>=%d and b.bidamount<=%d) or (b.budget>=%d and b.budget<=%d and b.bidamount is null))", minPrice, maxPrice, minPrice, maxPrice))
|
|
} else if minPriceStr != "" {
|
|
} else if minPriceStr != "" {
|
|
- querys = append(querys, fmt.Sprintf("(bidamount>=%d or (budget>=%d and bidamount is null))", minPrice, minPrice))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("(b.bidamount>=%d or (b.budget>=%d and b.bidamount is null))", minPrice, minPrice))
|
|
} else if maxPriceStr != "" {
|
|
} else if maxPriceStr != "" {
|
|
- querys = append(querys, fmt.Sprintf("( bidamount<=%d or (budget<=%d and bidamount is null))", maxPrice, maxPrice))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("(b.bidamount<=%d or (b.budget<=%d and b.bidamount is null))", maxPrice, maxPrice))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//附件
|
|
//附件
|
|
if spqp.FileExists != "" {
|
|
if spqp.FileExists != "" {
|
|
if spqp.FileExists == "1" {
|
|
if spqp.FileExists == "1" {
|
|
- querys = append(querys, fmt.Sprintf("attachment_count is not null"))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("b.attachment_count is not null"))
|
|
} else if spqp.FileExists == "-1" {
|
|
} else if spqp.FileExists == "-1" {
|
|
- querys = append(querys, fmt.Sprintf("attachment_count is null"))
|
|
|
|
|
|
+ querys = append(querys, fmt.Sprintf("b.attachment_count is null"))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- searchSql := fmt.Sprintf(" from %s where %s order by id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, strings.Join(querys, " and "))
|
|
|
|
|
|
+ searchSql := fmt.Sprintf(" from %s a LEFT JOIN %s b ON a.bidid = b.id LEFT JOIN %s p on b.area=p.id or b.city=p.id where %s"+
|
|
|
|
+ " order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Pushbidding, Province, strings.Join(querys, " and "))
|
|
fmt.Println("searchSql", searchSql)
|
|
fmt.Println("searchSql", searchSql)
|
|
//查询总数
|
|
//查询总数
|
|
- count = spqp.PushMysql.CountBySql(fmt.Sprintf("select count(id)" + searchSql))
|
|
|
|
|
|
+ count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select count(a.id)" + searchSql))
|
|
logx.Info("count:", count, "---", s.ModuleFlag)
|
|
logx.Info("count:", count, "---", s.ModuleFlag)
|
|
- findSql := "select id,date,infoid,isvisit,matchkeys,type"
|
|
|
|
|
|
+ findSql := "select a.id,a.date,b.infoid,a.isvisit,a.matchkeys,a.type"
|
|
if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
|
|
if s.ModuleFlag != MemberFlag && s.ModuleFlag != EntnicheFlag {
|
|
findSql += ",isvip"
|
|
findSql += ",isvip"
|
|
}
|
|
}
|
|
@@ -427,7 +438,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
}
|
|
}
|
|
|
|
|
|
logx.Info(spqp.UserId, "subscribePush query sql:", findSql)
|
|
logx.Info(spqp.UserId, "subscribePush query sql:", findSql)
|
|
- list := spqp.PushMysql.SelectBySql(findSql)
|
|
|
|
|
|
+ list := spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
if list != nil && len(*list) > 0 {
|
|
if list != nil && len(*list) > 0 {
|
|
pushCas := s.GetJyPushs(*list)
|
|
pushCas := s.GetJyPushs(*list)
|
|
result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas)
|
|
result = s.GetInfoByIds(spqp.Mgo_bidding, spqp.Bidding, spqp.Bidding_back, pushCas)
|
|
@@ -757,10 +768,10 @@ func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool,
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-//
|
|
|
|
|
|
+//保存推送表
|
|
func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]interface{}, keyword []ViewKeyWord, ccount int) (resultList []*bxsubscribe.SubscribeInfo) {
|
|
func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]interface{}, keyword []ViewKeyWord, ccount int) (resultList []*bxsubscribe.SubscribeInfo) {
|
|
t2 := time.Now()
|
|
t2 := time.Now()
|
|
- now := time.Now()
|
|
|
|
|
|
+ now := date.NowFormat(date.Date_Full_Layout)
|
|
var (
|
|
var (
|
|
wg = &sync.WaitGroup{}
|
|
wg = &sync.WaitGroup{}
|
|
wc = make(chan bool, ccount)
|
|
wc = make(chan bool, ccount)
|
|
@@ -775,36 +786,49 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
}()
|
|
}()
|
|
redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
|
|
redisKey := fmt.Sprintf("pushinfo_%s_%s", spqp.UserId, common.ObjToString(v["_id"]))
|
|
title := strings.Replace(common.ObjToString(v["title"]), "\n", "", -1)
|
|
title := strings.Replace(common.ObjToString(v["title"]), "\n", "", -1)
|
|
- var myInsert = make(map[string]interface{})
|
|
|
|
- myInsert["userid"] = spqp.UserId
|
|
|
|
- myInsert["infoid"] = common.ObjToString(v["_id"])
|
|
|
|
- myInsert["date"] = now.Unix()
|
|
|
|
- matchkeys := getKeys(title, keyword)
|
|
|
|
- myInsert["matchkeys"] = strings.Join(matchkeys, " ")
|
|
|
|
|
|
+ var pushInsert = []interface{}{}
|
|
|
|
+ //招投标信息表
|
|
|
|
+ var buildingInsert = []interface{}{}
|
|
|
|
+ infoid := ""
|
|
|
|
+ area := ""
|
|
|
|
+ city := ""
|
|
|
|
+ subtype := ""
|
|
|
|
+ toptype := ""
|
|
|
|
+ buyerclass := ""
|
|
|
|
+ attachment_count := ""
|
|
|
|
+ bidamount := "0"
|
|
|
|
+ budget := "0"
|
|
|
|
+ subscopeClass := ""
|
|
|
|
+ infoid = common.InterfaceToStr(v["_id"])
|
|
if v["area"] != nil {
|
|
if v["area"] != nil {
|
|
- myInsert["area"] = common.If(common.ObjToString(v["area"]) == "A", 0, common.If(IC.PushMapping.Area[common.ObjToString(v["area"])] > 0, IC.PushMapping.Area[common.ObjToString(v["area"])], 0).(int)).(int)
|
|
|
|
|
|
+ area = common.InterfaceToStr(common.If(common.ObjToString(v["area"]) == "A", 0, common.If(IC.PushMapping.Area[common.ObjToString(v["area"])] > 0, IC.PushMapping.Area[common.ObjToString(v["area"])], 0)))
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ publishtime := ""
|
|
|
|
+ if v["publishtime"] != nil {
|
|
|
|
+ publishtime = time.Unix(common.Int64All(v["publishtime"]), 0).Format(date.Date_Full_Layout)
|
|
}
|
|
}
|
|
if v["city"] != nil {
|
|
if v["city"] != nil {
|
|
- myInsert["city"] = common.If(IC.PushMapping.City[common.ObjToString(v["city"])] > 0, IC.PushMapping.City[common.ObjToString(v["city"])], 0).(int)
|
|
|
|
|
|
+ city = common.InterfaceToStr(common.If(IC.PushMapping.City[common.ObjToString(v["city"])] > 0, IC.PushMapping.City[common.ObjToString(v["city"])], 0))
|
|
}
|
|
}
|
|
if v["subtype"] != nil {
|
|
if v["subtype"] != nil {
|
|
- myInsert["subtype"] = common.If(IC.PushMapping.Subtype[common.ObjToString(v["subtype"])] > 0, IC.PushMapping.Subtype[common.ObjToString(v["subtype"])], 0).(int)
|
|
|
|
|
|
+ subtype = common.InterfaceToStr(common.If(IC.PushMapping.Subtype[common.ObjToString(v["subtype"])] > 0, IC.PushMapping.Subtype[common.ObjToString(v["subtype"])], 0))
|
|
}
|
|
}
|
|
if v["toptype"] != nil {
|
|
if v["toptype"] != nil {
|
|
- myInsert["toptype"] = common.If(IC.PushMapping.Toptype[common.ObjToString(v["toptype"])] > 0, IC.PushMapping.Toptype[common.ObjToString(v["toptype"])], 0).(int)
|
|
|
|
|
|
+ toptype = common.InterfaceToStr(common.If(IC.PushMapping.Toptype[common.ObjToString(v["toptype"])] > 0, IC.PushMapping.Toptype[common.ObjToString(v["toptype"])], 0))
|
|
}
|
|
}
|
|
if v["buyerclass"] != nil {
|
|
if v["buyerclass"] != nil {
|
|
- myInsert["buyerclass"] = common.If(IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])] > 0, IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])], 0).(int)
|
|
|
|
|
|
+ buyerclass = common.InterfaceToStr(common.If(IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])] > 0, IC.PushMapping.Buyerclass[common.ObjToString(v["buyerclass"])], 0))
|
|
}
|
|
}
|
|
if v["isValidFile"] != nil {
|
|
if v["isValidFile"] != nil {
|
|
isValidFile, _ := v["isValidFile"].(bool)
|
|
isValidFile, _ := v["isValidFile"].(bool)
|
|
- myInsert["attachment_count"] = common.If(isValidFile, 1, 0).(int) //附件 :检索库 只有附件字段,无法识别附件数量 暂定为1;为识别有附件
|
|
|
|
|
|
+ attachment_count = common.InterfaceToStr(common.If(isValidFile, 1, 0)) //附件 :检索库 只有附件字段,无法识别附件数量 暂定为1;为识别有附件
|
|
}
|
|
}
|
|
if v["bidamount"] != nil {
|
|
if v["bidamount"] != nil {
|
|
- myInsert["bidamount"] = common.Int64All(v["bidamount"])
|
|
|
|
|
|
+ bidamount = common.InterfaceToStr(v["bidamount"])
|
|
}
|
|
}
|
|
if v["budget"] != nil {
|
|
if v["budget"] != nil {
|
|
- myInsert["budget"] = common.Int64All(v["budget"])
|
|
|
|
|
|
+ budget = common.InterfaceToStr(v["budget"])
|
|
}
|
|
}
|
|
if s_subscopeclass := common.ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
|
|
if s_subscopeclass := common.ObjToString(v["s_subscopeclass"]); s_subscopeclass != "" {
|
|
subscopeclass := []string{}
|
|
subscopeclass := []string{}
|
|
@@ -814,27 +838,57 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if len(subscopeclass) > 0 {
|
|
if len(subscopeclass) > 0 {
|
|
- myInsert["subscopeclass"] = strings.Join(subscopeclass, ",")
|
|
|
|
|
|
+ subscopeClass = strings.Join(subscopeclass, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- //商机管理用户
|
|
|
|
- if s.ModuleFlag == "s" {
|
|
|
|
- myInsert["userid"] = spqp.EntUserId
|
|
|
|
- myInsert["entid"] = spqp.EntId
|
|
|
|
- myInsert["deptid"] = spqp.DeptId
|
|
|
|
- }
|
|
|
|
- //保存推送表
|
|
|
|
- id := spqp.PushMysql.Insert(aboutDbMsg[s.ModuleFlag].MysqlTable, myInsert)
|
|
|
|
- if id > 0 {
|
|
|
|
- redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
|
|
- resultList = append(resultList, s.InfoFormat(&PushCa{
|
|
|
|
- InfoId: common.ObjToString(v["_id"]),
|
|
|
|
- Date: now.Unix(),
|
|
|
|
- Index: id,
|
|
|
|
- Keys: matchkeys,
|
|
|
|
- FileExists: v["filetext"] != nil,
|
|
|
|
- }, &v))
|
|
|
|
- }
|
|
|
|
|
|
+ buildingInsert = append(buildingInsert, infoid, area, city, buyerclass, toptype, subtype, subscopeClass, budget, bidamount, attachment_count, publishtime)
|
|
|
|
+ spqp.BaseServiceMysql.ExecTx("推送记录保存", func(tx *sql.Tx) bool {
|
|
|
|
+ id1, id2 := spqp.BaseServiceMysql.InsertIgnoreBatchByTx(tx, Pushbidding, buildingInsertCollKey, buildingInsert)
|
|
|
|
+ log.Println(id1, id2)
|
|
|
|
+ if id1 == 0 {
|
|
|
|
+ //有历史记录,需要查询信息id
|
|
|
|
+ data := spqp.BaseServiceMysql.FindOne(Pushbidding, map[string]interface{}{
|
|
|
|
+ "infoid": infoid,
|
|
|
|
+ }, "id", "")
|
|
|
|
+ if data != nil {
|
|
|
|
+ id2 = common.Int64All((*data)["id"])
|
|
|
|
+ } else {
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ //推送记录
|
|
|
|
+ userid := spqp.UserId
|
|
|
|
+ matchkeys := getKeys(title, keyword)
|
|
|
|
+ matchkey := strings.Join(matchkeys, " ")
|
|
|
|
+ entid := spqp.EntId
|
|
|
|
+ entUserId := spqp.EntUserId
|
|
|
|
+ deptid := spqp.DeptId
|
|
|
|
+ id := int64(0)
|
|
|
|
+ switch s.ModuleFlag {
|
|
|
|
+ case "eType":
|
|
|
|
+ pushInsert = append(pushInsert, entid, deptid, entUserId, common.InterfaceToStr(id2), matchkey, now)
|
|
|
|
+ id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, ennicheInsertCollKey, pushInsert)
|
|
|
|
+ case "mType":
|
|
|
|
+ pushInsert = append(pushInsert, userid, common.InterfaceToStr(id2), matchkey, now)
|
|
|
|
+ id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, memberInsertCollKey, pushInsert)
|
|
|
|
+ default:
|
|
|
|
+ pushInsert = append(pushInsert, userid, common.InterfaceToStr(id2), matchkey, now)
|
|
|
|
+ id, _ = spqp.BaseServiceMysql.InsertIgnoreBatch(aboutDbMsg[s.ModuleFlag].MysqlTable, subscribeInsertCollKey, pushInsert)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if id > 0 {
|
|
|
|
+ return true
|
|
|
|
+ redis.Put("pushcache_2_a", redisKey, 1, 86400)
|
|
|
|
+ resultList = append(resultList, s.InfoFormat(&PushCa{
|
|
|
|
+ InfoId: common.ObjToString(v["_id"]),
|
|
|
|
+ Date: time.Now().Unix(),
|
|
|
|
+ Index: id,
|
|
|
|
+ Keys: matchkeys,
|
|
|
|
+ FileExists: v["filetext"] != nil,
|
|
|
|
+ }, &v))
|
|
|
|
+ }
|
|
|
|
+ return false
|
|
|
|
+ })
|
|
}(v)
|
|
}(v)
|
|
}
|
|
}
|
|
wg.Wait()
|
|
wg.Wait()
|
|
@@ -874,7 +928,7 @@ func (s *subscribePush) getDefaultDatasSQL(bsp *ViewCondition) (str string) {
|
|
bools := []string{}
|
|
bools := []string{}
|
|
musts := []string{}
|
|
musts := []string{}
|
|
//发布时间最新7天
|
|
//发布时间最新7天
|
|
- musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -7).Unix()))
|
|
|
|
|
|
+ musts = append(musts, fmt.Sprintf(bidTime, time.Now().AddDate(0, 0, -365).Unix()))
|
|
//省份
|
|
//省份
|
|
areaCity := []string{}
|
|
areaCity := []string{}
|
|
if len(bsp.Area) > 0 {
|
|
if len(bsp.Area) > 0 {
|
|
@@ -1083,6 +1137,8 @@ func (s *subscribePush) getUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
|
|
vc.Size = IC.C.DefaulCount.Free
|
|
vc.Size = IC.C.DefaulCount.Free
|
|
vc.Keyword = getKeyWordArrFromDbResultByFree(tmpInfo.Items, "", -1)
|
|
vc.Keyword = getKeyWordArrFromDbResultByFree(tmpInfo.Items, "", -1)
|
|
}
|
|
}
|
|
|
|
+ vc.Size = 10
|
|
|
|
+
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|