Esempio n. 1
0
func (th *TailHandler) Click(info []string) {
	var exstr = th.Script([]byte(strings.Join(info, "\t")))
	var exmap map[string]string
	if err := json.Unmarshal(exstr, &exmap); err != nil {
		return
	}
	if len(exmap) == 0 {
		return
	}
	log.Info(exmap)
	var ml MLog
	p, c := th.getIp(info)
	ml.Province = p
	ml.City = c
	ml.AdwId = convert.ToInt(th.getmap(exmap, "pd"))
	ml.AdId = convert.ToInt(th.getmap(exmap, "hd"))
	ml.UA = th.getmap(exmap, "ua")
	ml.AD = th.getmap(exmap, "ad")
	ml.Click = 1
	ml.Clock = convert.ToInt(time.Now().Format("15"))
	ml.Date = convert.ToInt(timestamp.GetDayTimestamp(0))
	ml.Url = strings.TrimSpace(th.get_url(th.getmap(exmap, "ltu"), th.getmap(exmap, "lftu")))
	ml.Domain = th.get_domain(ml.Url)
	ml.Cookie = th.get_cookie(info[9])
	ml.CusId = encrypt.DefaultMd5.Encode(ml.AD + ml.UA + ml.Cookie)
	ml.CusId2 = ml.CusId
	ml.Money, ml.Fmoney = th.click_money(ml.AdwId, ml.AdId)
	if _, ok := th.SouceMap[th.getmap(exmap, "pd")]; ok {
		ml.Source = 1
	}
	th.SaveData(ml)
}
Esempio n. 2
0
func (th *TailHandler) Pv(info []string) {
	var ml MLog
	ud, err := th.pv_param(info[3])
	//log.Info(ud["lftu"])
	if err != nil {
		return
	}
	if !th.PvParamCheck(ud) {
		return
	}
	p, c := th.getIp(info)
	ml.Province = p
	ml.City = c
	ml.AdwId = convert.ToInt(ud["pd"][0])
	ml.AdId = convert.ToInt(ud["hd"][0])
	ml.UA = info[7]
	ml.AD = th.get_ad(ud["ltu"][0])
	ml.Click = 0
	ml.Clock = convert.ToInt(time.Now().Format("15"))
	ml.Date = convert.ToInt(timestamp.GetDayTimestamp(0))
	ml.Url = strings.TrimSpace(th.get_url(ud["ltu"][0], ud["lftu"][0]))
	if strings.Contains(ml.Url, "cpro.9xu.com") {
		log.Error(ud)
	}
	ml.Domain = th.get_domain(ml.Url)
	ml.Cookie = th.get_cookie(info[9])
	ml.CusId = encrypt.DefaultMd5.Encode(ml.AD + ml.UA + ml.Cookie)
	ml.CusId2 = ml.CusId
	ml.Fmoney = 0
	ml.Money = 0
	ml.PV = 1
	if _, ok := th.SouceMap[ud["pd"][0]]; ok {
		ml.Source = 1
	}
	//fmt.Println(ml)
	th.SaveData(ml)
}
Esempio n. 3
0
File: zj.go Progetto: qgweb/new
// 获取投放店铺信息
func (this *ZjPut) GetPutShopInfo() (list map[string]ShopInfo) {
	rdb, err := lib.GetRedisObj()
	if err != nil {
		log.Error(err)
		return nil
	}
	defer rdb.Close()

	shopkeys := rdb.Keys("SHOP_*")
	list = make(map[string]ShopInfo)
	for _, key := range shopkeys {
		var sinfo ShopInfo
		shopkeys := strings.Split(key, "_")
		sk := ""
		if len(shopkeys) < 3 {
			continue
		}
		sk = shopkeys[2]
		sinfo.ShopId = sk
		oaids := rdb.SMembers(key)
		aids := make([]string, 0, len(oaids))
		for _, v := range oaids {
			if _, ok := this.putAdverts[v]; ok {
				aids = append(aids, v)
			}
		}
		sinfo.ShopAdverts = make([]ShopAdvert, 0, len(aids))
		for _, aid := range aids {
			aaids := strings.Split(aid, "_")
			if len(aaids) == 2 {
				sinfo.ShopAdverts = append(sinfo.ShopAdverts, ShopAdvert{
					AdvertId: aaids[0],
					Date:     convert.ToInt(aaids[1]),
				})
			}
		}
		list[sk] = sinfo
	}
	return

}