Esempio n. 1
0
File: other.go Progetto: qgweb/new
func (this *UserTrack) otherData(out chan interface{}, in chan int8) {
	var (
		eghour = timestamp.GetHourTimestamp(-1)
		bghour = timestamp.GetHourTimestamp(-25)
	)
	conf := mongodb.MongodbQueryConf{}
	conf.Db = "data_source"
	conf.Table = "useraction"
	conf.Query = mongodb.MM{"timestamp": mongodb.MM{"$gte": bghour, "$lte": eghour}, "domainId": "0"}
	this.mg_big.Query(conf, func(info map[string]interface{}) {
		ua := "ua"
		ad := convert.ToString(info["AD"])
		if u, ok := info["UA"]; ok {
			ua = convert.ToString(u)
		}
		cids := make([]string, 0, len(info["tag"].([]interface{})))
		for _, v := range info["tag"].([]interface{}) {
			if tags, ok := v.(map[string]interface{}); ok {
				if strings.TrimSpace(convert.ToString(tags["tagId"])) != "" {
					cids = append(cids, convert.ToString(tags["tagId"]))
				}
			}
		}
		out <- fmt.Sprintf("%s\t%s\t%s", ad, ua, strings.Join(cids, ","))
	})
	in <- 1
}
Esempio n. 2
0
File: other.go Progetto: qgweb/new
func (this *UserTrack) getBigCat() {
	conf := mongodb.MongodbQueryConf{}
	conf.Db = "data_source"
	conf.Table = "taocat"
	conf.Query = mongodb.MM{"type": "0"}
	conf.Select = mongodb.MM{"bid": 1, "cid": 1}
	this.mg.Query(conf, func(info map[string]interface{}) {
		this.bigCategoryMap[convert.ToString(info["cid"])] = convert.ToString(info["bid"])
	})
}