فهرست منبع

Merge branch 'develop' of 192.168.3.17:zhanghongbo/qfw into develop

wangchuanjin 9 سال پیش
والد
کامیت
243b9052b9

+ 1 - 2
common/src/qfw/util/credit/credit.go

@@ -121,8 +121,7 @@ func UpuserCreditA(code, userId string, credit_a int) (bool, int) {
 		ret = 1 << (tmp - 1)
 	}
 	n_credit_a := uint64(credit_a) + ret
-	b := mogo.Update("user", `{"_id":"`+userId+`"}`, "{'$set':{'ss':'test','age':int64(n_credit_a)}}", true, false)
-	log.Println("gengxin", b)
+	b := mogo.Update("user", `{"_id":"`+userId+`"}`, &map[string]interface{}{"$set": &map[string]interface{}{"credit_a": int64(n_credit_a)}}, true, false)
 	return b, int(n_credit_a)
 }
 

+ 9 - 14
common/src/qfw/util/mongodb/mongodbutil_test.go

@@ -17,16 +17,16 @@ func Test_orAnd(t *testing.T) {
 	}
 }
 func Test_FindByQuery(t *testing.T) {
-	InitMongodbPool(1, "192.168.56.101", "test")
+	InitMongodbPool(1, "192.168.3.18:27080", "spider")
 	//查找单个
 	//var ss = FindOne("test1", "{'_id':'553306bce30454598ff1bc14'}")
-	log.Println(FindOne("test1", M{"name": "32432423zzzz"}))
-	log.Println("count", Count("test1", M{"name": "zzzz"}))
+	//log.Println(FindOne("test1", M{"name": "32432423zzzz"}))
+	//log.Println("count", Count("test1", M{"name": "zzzz"}))
 	//obj := map[string]interface{}{"name": "ggg555g32423zzzz"}
 	//log.Println(Save("test1", &obj))
-	log.Println((*(FindById("test1", "55330b77e30454598ff1bd6d", "{'_id':0}"))))
+	//log.Println((*(FindById("test1", "55330b77e30454598ff1bd6d", "{'_id':0}"))))
 	//查询多个
-	log.Println(Find("test1", "{'_id':'55330b77e30454598ff1bd6d'}", nil, "{'_id':0,'name':'1'}", true, -1, -1))
+	//log.Println(Find("test1", "{'_id':'55330b77e30454598ff1bd6d'}", nil, "{'_id':0,'name':'1'}", true, -1, -1))
 	//log.Println(Find("test1", "{'name':{'$regex':'1ss$'}}", nil, "{'_id':0,'name':'1'}", false, 1, 2))
 	//统计
 	//log.Println(Count("test1", "{'name':{'$regex':'^1ss'}}"))
@@ -35,15 +35,10 @@ func Test_FindByQuery(t *testing.T) {
 	//删除
 	//log.Println(Del("test1", "{'name':'AAA'}"))
 	//更新
-	//log.Println(Update("test1", "{'name':'1ss'}", "{'$set':{'ss':'test','age':100}}", false, false))
-	b := make([]M, 2)
-	b[0] = M{
-		"name": "zzzz",
-	}
-	b[1] = M{
-		"name": "bbbb",
-	}
-	_ = b
+
+	b := Update("test1", "{'_id':'56a0917ee49c13d5314daa0f'}", &map[string]interface{}{"$set": &map[string]interface{}{"credit_a": int64(2305843009213693695)}}, true, false)
+	//b := Update("test1", "{'_id':'56a0917ee49c13d5314daa0f'}", &map[string]interface{}{"age": "1"}, true, false)
+	log.Println("ssssssss", b)
 	//批量插入
 	//log.Println(SaveBulk("test1", b...))
 }

+ 3 - 2
core/src/qfw/member/membermanager.go

@@ -1081,6 +1081,7 @@ func returnFront(m *Member, key string) error {
 
 //更新cookie sessoin
 func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, r map[string]interface{}) {
+	log.Println(r)
 	freeze := IntAll(r["i_freeze"])
 	action.Session().Set("i_freeze", freeze)
 	if r["s_nickname"] == nil || r["s_nickname"].(string) == "" {
@@ -1119,7 +1120,7 @@ func UpdateSession(action *xweb.Action, r map[string]interface{}) {
 		if r["s_nickname"] != nil && r["s_nickname"].(string) != "" {
 			setSessMap["nickName"] = r["s_nickname"]
 		}
-		setSessMap["userId"] = r["_id"]
+		setSessMap["userId"] = BsonIdToSId(r["_id"])
 		setSessMap["s_m_openid"] = r["s_m_openid"]
 		setSessMap["userType"] = IntAllDef(r["i_type"], 2)
 		setSessMap["userInfo"] = &r
@@ -1159,7 +1160,7 @@ func UpdateSession(action *xweb.Action, r map[string]interface{}) {
 		action.SetSession("identWay", IntAll(r["i_identificationway"]))   //认证状态
 		action.SetSession("opLocDistrict", r["opLocDistrict"])            //行政区划代码
 		**/
-		action.Session().UpdateByCustomField("id", r["_id"], "", &setSessMap)
+		action.Session().UpdateByCustomField("id", BsonIdToSId(r["_id"]), "", &setSessMap)
 	}, func(e interface{}) {
 		log.Println("登录报错", e)
 	})

+ 12 - 1
core/src/qfw/search/searchService.go

@@ -158,7 +158,6 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
 			userId := ObjToString(n.GetSession("userId"))
 			if len(userId) > 0 {
 				credit_a := IntAll(n.GetSession("credit_a"))
-				log.Println(credit.AIsHasDo(credit.A_QYCX, credit_a))
 				if credit.AIsHasDo(credit.A_QYCX, credit_a) {
 					credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
 				} else {
@@ -188,6 +187,18 @@ func (n *Search) GetEnterpriseList(reqType, param /*参数*/ string) error {
 //即时搜索
 func (n *Search) Sim() error {
 	keyword := n.GetString("words")
+	//查询送积分
+	userId := ObjToString(n.GetSession("userId"))
+	if len(userId) > 0 && len(keyword) > 0 {
+		credit_a := IntAll(n.GetSession("credit_a"))
+		if credit.AIsHasDo(credit.A_QYCX, credit_a) {
+			credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
+		} else {
+			credit.UpuserCreditSession(userId, credit.A_QYCX, "A", nil, n.Action)
+			credit.UpuserCreditSession(userId, credit.B_QYCX, "B", nil, n.Action)
+		}
+	}
+
 	str := `{
 	          "match": {
 	            "enterprise.EntName": {

+ 29 - 1
core/src/timetask.json

@@ -1 +1,29 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-21 14:42:23"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-21 14:42:23"}},"marketisstart":true,"marketrate":300}
+{
+    "comment": {
+        "c_rate": 720,
+        "commentrate": 900
+    },
+    "market": {
+        "demand": {
+            "attr": [
+                "i_hits",
+                "i_bids",
+                "i_status"
+            ],
+            "timepoint": "2016-01-21 14:42:23"
+        },
+        "service": {
+            "attr": [
+                "i_hits",
+                "i_sales",
+                "i_comments",
+                "i_score",
+                "i_appcounts"
+            ],
+            "timepoint": "2016-01-21 14:42:23"
+        }
+    },
+    "marketisstart": true,
+    "marketrate": 300
+}
+