Просмотр исходного кода

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

renzheng 9 лет назад
Родитель
Сommit
de6a16a3ed

+ 7 - 4
common/src/qfw/util/credit/credit.go

@@ -30,8 +30,8 @@ const (
 	A_FXFWXQ = "a13" //分享服务
 	A_WCJY   = "a14" //完成交易
 	A_WCJYPJ = "a15" //完成交易评价
-	A_JYSCTS = "a63" //剑鱼首次推送
-	A_ALL    = "a64" //一次性积分任务完成
+	A_JYSCTS = "a61" //剑鱼首次推送
+	A_ALL    = "a62" //一次性积分任务完成
 
 	B_QD       = "b1" //签到
 	B_QD_T     = 7    //最高连续签到次数
@@ -59,7 +59,7 @@ func init() {
 	util.ReadConfig(&SysConfig)
 	CreditA = make(map[string]uint64)
 	//初始化一次性任务
-	for i := 1; i <= 64; i++ {
+	for i := 1; i <= 62; i++ {
 		CreditA["a"+fmt.Sprint(i)] = uint64(i)
 	}
 	Rc = rpc.RpcCall{Addr: SysConfig["creditRpc"].(string)}
@@ -121,7 +121,8 @@ 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":{"credit_a":`+fmt.Sprint(int(n_credit_a))+`}}`, true, false)
+	b := mogo.Update("user", `{"_id":"`+userId+`"}`, "{'$set':{'ss':'test','age':int64(n_credit_a)}}", true, false)
+	log.Println("gengxin", b)
 	return b, int(n_credit_a)
 }
 
@@ -131,10 +132,12 @@ func AIsHasDo(code string, num int) bool {
 	var ret uint64
 	if tmp, ok := CreditA[code]; ok {
 		ret = 1 << (tmp - 1)
+		log.Println(tmp, ret)
 	}
 	if uint64(num)&ret > 0 {
 		b = true
 	}
+	log.Println(code, num, ret, b)
 	return b
 }
 

+ 2 - 0
core/src/qfw/member/credit/creditdetail.go

@@ -7,6 +7,7 @@ import (
 	"github.com/dchest/captcha"
 	"github.com/go-xweb/xweb"
 	. "gopkg.in/mgo.v2/bson"
+	"log"
 	cu "qfw/coreutil"
 	"qfw/util"
 	cd "qfw/util/credit"
@@ -35,6 +36,7 @@ func (c *credit) MyCredit() error {
 		c.T["user"] = user
 		credit_a := util.IntAll(user["credit_a"])
 		b := cd.AAllIsHasDo(credit_a)
+		log.Println(b, credit_a)
 		u := c.Header("User-Agent")
 		if strings.Index(u, "Mobile") > -1 {
 			return c.Render("/member/credit/mcreditindex.html", &c.T)

+ 4 - 8
core/src/qfw/member/membermanager.go

@@ -1080,18 +1080,14 @@ func returnFront(m *Member, key string) error {
 }
 
 //更新cookie sessoin
-func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, m map[string]interface{}) {
-	r := make(map[string]interface{})
-	if d, err := json.Marshal(m); err != nil || json.Unmarshal(d, &r) != nil {
-		return
-	}
+func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, r map[string]interface{}) {
 	freeze := IntAll(r["i_freeze"])
 	action.Session().Set("i_freeze", freeze)
 	if r["s_nickname"] == nil || r["s_nickname"].(string) == "" {
 		bindweixin := "qmx-" + fmt.Sprintf("%d%d", time.Now().Local().Unix(), rand.Intn(99))
 		action.SetSession("nickName", bindweixin)
 		go func() {
-			Update("user", `{"_id":"`+r["_id"].(string)+`"}`, `{"$set":{"s_nickname":"`+bindweixin+`"}}`, false, false)
+			Update("user", `{"_id":"`+BsonIdToSId(r["_id"])+`"}`, `{"$set":{"s_nickname":"`+bindweixin+`"}}`, false, false)
 		}()
 	} else {
 		action.SetSession("nickName", r["s_nickname"])
@@ -1103,14 +1099,14 @@ func UpdateCookieSession(action *xweb.Action, loginType string, flag bool, m map
 	}
 	action.App.SessionManager.SetMaxAge(30 * time.Minute)
 	action.Session().SetMaxAge(30 * time.Minute)
-	action.Session().Set("id", r["_id"])
+	action.Session().Set("id", BsonIdToSId(r["_id"]))
 	action.Session().Set("identWay", IntAll(r["i_identificationway"]))
 	action.SetSession("loginName", r[loginType])
 	action.SetSession("loginType", loginType)
 	UpdateSession(action, r)
 	_, err := action.GetCookie("USER_INFO")
 	if flag || err == nil {
-		userInfo, _ := json.Marshal(map[string]interface{}{"loginId": r["_id"], "loginType": loginType})
+		userInfo, _ := json.Marshal(map[string]interface{}{"loginId": BsonIdToSId(r["_id"]), "loginType": loginType})
 		cookie_userName := &http.Cookie{Name: "USER_INFO", Value: base64.StdEncoding.EncodeToString(userInfo), Path: "/", Expires: time.Now().AddDate(0, 0, 7)}
 		action.SetCookie(cookie_userName)
 	}

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

@@ -158,6 +158,7 @@ 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 {

+ 5 - 1
core/src/timetask.json

@@ -1 +1,5 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-21 10:15:34"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-21 10:15:34"}},"marketisstart":true,"marketrate":300}
+<<<<<<< HEAD
+{"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 10:15:34"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-21 10:15:34"}},"marketisstart":true,"marketrate":300}
+>>>>>>> ffa6a97477331850e613c77ac970dbd80d2448d5

+ 1 - 1
core/src/web/templates/member/credit/mycredit.html

@@ -363,7 +363,7 @@ $(function(){
 		checkContent("list_"+_v)
 	})
 	var AAll="{{.T.AAll}}"//一次性任务完成,位置切换
-	if (AAll==true){
+	if (AAll=="true"){
 		rcrw=$("#rcrw").html();
 		csrw=$("#csrw").html();
 		$("#rcrw").html(csrw);

+ 3 - 3
credit/src/config.json

@@ -24,7 +24,7 @@
         "a13": 50,
         "a14": 100,
         "a15": 80,
-        "a64": 1001,
+        "a62": 1001,
         "b1": 10,
         "b1_1": 10,
         "b1_n": 7,
@@ -67,8 +67,8 @@
         "txt_a13": "分享服务",
         "txt_a14": "完成交易",
         "txt_a15": "完成交易评价",
-		"txt_a63": "剑鱼首次推送",
-        "txt_a64": "完成一次性所有任务",
+		"txt_a61": "剑鱼首次推送",
+        "txt_a62": "完成一次性所有任务",
         "txt_b1": "签到",
         "txt_b2": "企业查询",
         "txt_b3": "发服务",

+ 13 - 14
credit/src/qfw/creditrpc/creditrpc_test.go

@@ -2,22 +2,21 @@ package creditrpc
 
 import (
 	"log"
-	"net/rpc"
-	r "qfw/util/rpc"
+
 	"testing"
 )
 
-func Test_rpc(t *testing.T) {
-	log.Println("----------")
-	dd := r.CreditData{
-		Code: "ddddd",
+func Test(t *testing.T) {
+	tmp := uint64(1)
+	var ret uint64
+	for k := 2; k < 62; k++ {
+		if k == 9 {
+			continue
+		}
+		ret = 1 << (uint64(k) - 1)
+		tmp += ret
+		log.Println(k, int(tmp), int(ret))
 	}
-	var repl int
-	clent, _ := rpc.DialHTTP("tcp", "127.0.0.1:8765")
-	clent.Call("CreditRpc.InCreadit", &dd, &repl)
-
-	log.Println(repl)
-	clent.Close()
-	c := make(chan bool, 1)
-	<-c
+	log.Println(tmp)
+	log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
 }