浏览代码

修改接口

renzheng 7 年之前
父节点
当前提交
688a9e3e77

二进制
api文档/剑鱼企业级数据服务接口_v1.4.doc


二进制
api文档/剑鱼企业级数据服务接口_v1.4.pdf


+ 4 - 2
jyservice/src/config.json

@@ -18,7 +18,8 @@
             "href": 1,
 			"id":1,
 			"department":1,
-			"matchscore":1
+			"matchscore":1,
+			"remark":1
         },
         "B": {
             "title": 1,
@@ -36,7 +37,8 @@
 			"city":1,
 			"id":1,
 			"department":1,
-			"matchscore":1
+			"matchscore":1,
+			"remark":1
         }
     }
 }

+ 28 - 5
jyservice/src/usermanager/getdata.go

@@ -211,6 +211,8 @@ func getDataByAppid(appid string, i_day, next, i_all int, limittodaykey string,
 
 	log.Debug("query:", query)
 	i_next = next
+	//是否获取过,默认无值
+	fields["bget"] = 1
 	data, bdata := Mgo.Find("usermail", query, `{"_id":1}`, fields, false, i_next, QUERY_LIMIT)
 	if bdata && data != nil && *data != nil && len(*data) > 0 {
 		infos = *data
@@ -220,20 +222,41 @@ func getDataByAppid(appid string, i_day, next, i_all int, limittodaykey string,
 				redis.Put(REDISDB, "lastid_"+appid, lastid, DesZero())
 			}
 		}
+		newGetLen := 0
+		updateMap := [][]map[string]interface{}{}
 		for _, v := range infos {
+			if util.IntAll(v["bget"]) == 0 {
+				newGetLen++
+				updateMap = append(updateMap, []map[string]interface{}{
+					map[string]interface{}{
+						"_id": v["_id"],
+					},
+					map[string]interface{}{
+						"$set": map[string]interface{}{
+							"bget": 1,
+						},
+					},
+				})
+			}
 			delete(v, "_id")
+			delete(v, "bget")
 		}
 		if len(*data) == QUERY_LIMIT && !blastid {
 			i_next = i_next + QUERY_LIMIT
 		} else {
 			i_next = -1
 		}
-		//处理总条数
-		redis.Decrby(REDISDB, "limitnum_"+appid, len(*data))
+		//处理总条数,有重复获取的信息条不计数,*******************
+		thisLen := len(*data)
+		if newGetLen > 0 {
+			redis.Decrby(REDISDB, "limitnum_"+appid, newGetLen)
+			go Mgo.UpdateBulk("usermail", updateMap...)
+		}
 		go Mgo.Save("userdatalog", map[string]interface{}{
-			"appid":   appid,
-			"datalen": len(*data),
-			"date":    time.Now().Unix(),
+			"appid":     appid,
+			"datalen":   thisLen,
+			"newgetlen": newGetLen,
+			"date":      time.Now().Unix(),
 		})
 	} else { //没有数据
 		i_next = 0