Пример #1
0
Файл: other.go Проект: qgweb/new
func (this *UserTrack) saveData(info []string) {
	if len(info) < 3 {
		return
	}

	ad := info[0]
	ua := info[1]
	adua := encrypt.DefaultMd5.Encode(ad + ua)
	cids := make([]mongodb.MM, 0)
	cids_put := make([]mongodb.MM, 0)
	for _, v := range strings.Split(info[2], ",") {
		im := 0
		if mongodb.IsObjectId(v) {
			im = 1
		}
		cids = append(cids, mongodb.MM{"tagId": v, "tagmongo": im})

		if bt, ok := this.bigCategoryMap[v]; ok {
			v = bt
		}
		cids_put = append(cids, mongodb.MM{"tagId": v, "tagmongo": im})
	}
	this.mgb.Write(mongodb.MM{
		"AD":   ad,
		"UA":   ua,
		"adua": adua,
		"tag":  cids,
	}, 10000)
	this.mgb_big.Write(mongodb.MM{
		"AD":   ad,
		"UA":   ua,
		"adua": adua,
		"tag":  cids_put,
	}, 10000)
}
Пример #2
0
Файл: fun.go Проект: qgweb/new
// 是否是mongoid
func IsMongo(val string) bool {
	return mongodb.IsObjectId(val)
}