|
@@ -1,6 +1,7 @@
|
|
|
package dataexport
|
|
|
|
|
|
import (
|
|
|
+ "app.yhyue.com/moapp/jybase/mysql"
|
|
|
//"config"
|
|
|
"encoding/json"
|
|
|
"errors"
|
|
@@ -1003,6 +1004,26 @@ func GetDataExportSearchResult(bid mg.MongodbSim, bidMgoDBName, elasticAddress s
|
|
|
return &res, nil
|
|
|
}
|
|
|
|
|
|
+// 数据导出内容标签
|
|
|
+func GetDataExportMatchKeyTag(mysqlSess *mysql.Mysql, res []map[string]interface{}, userId string, limit int) {
|
|
|
+ userBidTagMap := make(map[string]string)
|
|
|
+ userBidTag := mysqlSess.SelectBySql(fmt.Sprintf(`select a.bid,b.labelname from bdcollection a LEFT JOIN bdlabel b on a.labelid = b.id WHERE a.userid = '%s' order by a.createdate desc limit %d`, userId, limit))
|
|
|
+ if userBidTag != nil && len(*userBidTag) > 0 {
|
|
|
+ for _, s2 := range *userBidTag {
|
|
|
+ userBidTagMap[qutil.InterfaceToStr(s2["bid"])] = qutil.InterfaceToStr(s2["labelname"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for _, re := range res {
|
|
|
+ var tName string
|
|
|
+ if tagName := userBidTagMap[qutil.InterfaceToStr(re["_id"])]; tagName != "" {
|
|
|
+ tName = tagName
|
|
|
+ } else {
|
|
|
+ tName = "默认收藏"
|
|
|
+ }
|
|
|
+ re["tagName"] = tName
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func doSearchByBatch(query, dataType string, searchCount int, flag string) (res []map[string]interface{}) {
|
|
|
if searchCount > onceSearchCount { //分批次查询
|
|
|
batchNum := qutil.IntAll(math.Ceil(float64(searchCount) / float64(onceSearchCount)))
|