wangchuanjin 5 ヶ月 前
コミット
4817d2821c
1 ファイル変更13 行追加5 行削除
  1. 13 5
      recommend/recommend.go

+ 13 - 5
recommend/recommend.go

@@ -128,12 +128,20 @@ func (r *Recommend) getList(tidb *Mysql, userId string, limit int) (*[]map[strin
 }
 
 //
-func (r *Recommend) SaveLog(mgo *MongodbSim, userId string, autoId int64, hasPhone, isNewestBid int) string {
-	return mgo.Save("subrecommend_log", map[string]interface{}{
+func (r *Recommend) SaveLog(mgo *MongodbSim, userId string, autoId int64, t string, hasPhone, isNewestBid bool) string {
+	m := map[string]interface{}{
 		"userid":      userId,
 		"autoid":      autoId,
-		"hasphone":    hasPhone,
-		"isnewestbid": isNewestBid,
+		"type":        t,
+		"hasphone":    0,
+		"isnewestbid": 0,
 		"create_time": time.Now().Unix(),
-	})
+	}
+	if hasPhone {
+		m["hasphone"] = 1
+	}
+	if isNewestBid {
+		m["isnewestbid"] = 1
+	}
+	return mgo.Save("subrecommend_log", m)
 }