// 域名找回信息获取 func (this *ZjPut) VisitorData(out chan interface{}, in chan int8) { var datacount = 0 defer func() { // 统计数据 zhejiang_put , other_1461016800, 11111 lib.StatisticsData("dsource_stats", "zj_"+this.Timestamp+"_visitor", convert.ToString(datacount), "") }() m, err := lib.GetMongoObj() if err != nil { log.Error(err) in <- 1 return } defer m.Close() qconf := mongodb.MongodbQueryConf{} qconf.Db = "data_source" qconf.Table = "zhejiang_visitor" qconf.Query = mongodb.MM{} m.Query(qconf, func(info map[string]interface{}) { ad := convert.ToString(info["ad"]) ua := encrypt.DefaultMd5.Encode(encrypt.DefaultBase64.Decode(convert.ToString(info["ua"]))) aids := convert.ToString(info["aids"]) datacount++ out <- fmt.Sprintf("%s\t%s\t%s", ad, ua, aids) }) log.Info("访客ok") in <- 1 }
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 }
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"]) }) }
func (this *TaobaoESStore) initCategory() { q := mongodb.MongodbQueryConf{} q.Db = "xu_precise" q.Table = "taocat" q.Select = mongodb.MM{"name": 1, "cid": 1, "_id": 0} q.Query = mongodb.MM{"type": "0"} this.catMap = make(map[string]string) this.store.Query(q, func(info map[string]interface{}) { this.catMap[info["cid"].(string)] = info["name"].(string) }) }
func getGeop(w http.ResponseWriter, r *http.Request) { ad := strings.TrimSpace(r.URL.Query().Get("ad")) mlink, err := db.Get() lon := "" lat := "" if err != nil { log.Error(err) w.Write([]byte("")) return } defer mlink.Close() if ad == "" { w.WriteHeader(404) w.Write([]byte("")) return } qconf := mongodb.MongodbQueryConf{} qconf.Db = "lonlat_data" qconf.Table = "tbl_map" qconf.Select = mongodb.MM{"lon": 1, "lat": 1} qconf.Query = mongodb.MM{"ad": ad} info, err := mlink.One(qconf) if err != nil { log.Error(err) w.Write([]byte("")) return } if v, ok := info["lon"]; ok { lon = convert.ToString(v) } if v, ok := info["lat"]; ok { lat = convert.ToString(v) } w.Write([]byte(fmt.Sprintf("%s,%s", lon, lat))) }