|
@@ -323,6 +323,7 @@ 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) {
|
|
|
+ start := time.Now().Unix()
|
|
|
querys := []string{}
|
|
|
userStr := " "
|
|
|
leftJoinStr := " "
|
|
@@ -335,6 +336,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
return result, count
|
|
|
}
|
|
|
querys = append(querys, " 1=1 ")
|
|
|
+ start2 := int64(0)
|
|
|
if spqp.SelectInfoIds != nil && len(spqp.SelectInfoIds) > 0 {
|
|
|
searchSql = fmt.Sprintf(" from %s a LEFT JOIN %s b ON a.infoid = b.infoid where %s order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, fmt.Sprintf("a.id in ('%s')", strings.Join(spqp.SelectInfoIds, "','")))
|
|
|
logx.Info("searchSql", searchSql)
|
|
@@ -487,9 +489,11 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
" order by a.id desc", aboutDbMsg[s.ModuleFlag].MysqlTable, Baseinfo, userStr, leftJoinStr, strings.Join(querys, " and "))
|
|
|
logx.Info("searchSql", searchSql)
|
|
|
//查询总数
|
|
|
- logx.Info(fmt.Sprintf("select count(a.id) " + searchSql))
|
|
|
+ logx.Info(fmt.Sprintf("select /*+ HASH_JOIN(a,b)*/ count(a.id) " + searchSql))
|
|
|
count = spqp.BaseServiceMysql.CountBySql(fmt.Sprintf("select /*+ HASH_JOIN(a,b)*/ count(a.id) " + searchSql))
|
|
|
+ start2 = time.Now().Unix()
|
|
|
logx.Info("count:", count, "---", s.ModuleFlag)
|
|
|
+ log.Println("查询数据总数用时", start2-start)
|
|
|
findSql = "SELECT aa.*, bb.labelvalues as industry FROM (select a.id,a.date,a.infoid,a.isvisit,a.matchkeys,a.type,b.isvalidfile as attachment_count,b.site," +
|
|
|
"b.title,b.area_code,b.buyerclass_code,b.subtype_code,b.publishtime,b.budget,b.bidamount,b.projectname,b.buyer,b.bidopentime "
|
|
|
if s.ModuleFlag == "eType" {
|
|
@@ -506,8 +510,12 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
|
|
|
findSql += fmt.Sprintf(") aa LEFT JOIN %s bb ON ( aa.infoid = bb.infoid ) AND bb.labelcode = 2 ", BidTags)
|
|
|
logx.Info(spqp.NewUserId, "subscribePush query sql:", findSql)
|
|
|
list := spqp.BaseServiceMysql.SelectBySql(findSql)
|
|
|
+ start3 := time.Now().Unix()
|
|
|
+ log.Println("查询数据用时", start3-start2)
|
|
|
if list != nil && len(*list) > 0 {
|
|
|
pushCas, subscribeInfo := s.GetJyPushs(*list, codeMap)
|
|
|
+ start4 := time.Now().Unix()
|
|
|
+ log.Println("清洗数据耗时", start4-start3)
|
|
|
if !spqp.Export {
|
|
|
result = subscribeInfo
|
|
|
} else {
|
|
@@ -675,6 +683,7 @@ func (s *subscribePush) GetJyPushs(datas []map[string]interface{}, codeMap *code
|
|
|
if len(iss) > 0 {
|
|
|
industry = iss[0]
|
|
|
}
|
|
|
+ //PublishTime:=common.InterfaceToStr(v["publishtime"])
|
|
|
subscribeInfo = append(subscribeInfo, &bxsubscribe.SubscribeInfo{
|
|
|
XId: encrypt.EncodeArticleId2ByCheck(common.ObjToString(v["infoid"])),
|
|
|
Title: common.InterfaceToStr(v["title"]),
|
|
@@ -685,7 +694,7 @@ func (s *subscribePush) GetJyPushs(datas []map[string]interface{}, codeMap *code
|
|
|
PublishTime: common.Int64All(v["publishtime"]),
|
|
|
CaIndex: common.Int64All(v["id"]),
|
|
|
CaDate: common.Int64All(v["date"]),
|
|
|
- CaIsvisit: common.Int64All(v["publishtime"]),
|
|
|
+ CaIsvisit: common.Int64All(v["isvisit"]),
|
|
|
CaType: common.Int64All(v["type"]),
|
|
|
MatchKeys: keys,
|
|
|
Budget: common.InterfaceToStr(v["budget"]),
|