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

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

wangshan 9 лет назад
Родитель
Сommit
5a8dcdd291

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

@@ -131,12 +131,10 @@ 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
 }
 
@@ -183,6 +181,7 @@ func OutCreditB(userId, code, umid string, score int, param map[string]interface
 
 //更新积分和session
 func UpuserCreditSession(userId, code, dtype string, param map[string]interface{}, xb *xweb.Action) bool {
+	log.Println("更新积分和session", userId, code, dtype, param)
 	b := false
 	score := 0
 	util.Try(func() {

+ 10 - 0
core/src/qfw/member/bidmanage.go

@@ -207,12 +207,22 @@ func (d *BidManage) ChangeStatus() error {
 				param := make(map[string]interface{})
 				param["objid"] = wtb["s_userid"].(string)
 				credit_a := util.IntAll(d.GetSession("credit_a"))
+				//log.Println("选标", credit.AIsHasDo(credit.A_WCJY, credit_a), userId, param["objid"])
 				if credit.AIsHasDo(credit.A_WCJY, credit_a) {
 					credit.UpuserCreditSession(userId, credit.C_JY, "B", param, d.Action)
 				} else {
 					credit.UpuserCreditSession(userId, credit.A_WCJY, "A", nil, d.Action)
 					credit.UpuserCreditSession(userId, credit.C_JY, "B", param, d.Action)
 				}
+				//判断对方是否完成一次性任务
+				rr := *FindById("user", param["objid"].(string), nil)
+				if !credit.AIsHasDo(credit.A_WCJY, util.IntAll(rr["credit_a"])) {
+					b, credit_a, score, _ := credit.InCreditA(param["objid"].(string), credit.A_WCJY, util.IntAll(rr["credit_a"]))
+					if b {
+						d.Session().UpdateByCustomField("id", param["objid"].(string), "credit_a", credit_a)
+						d.Session().UpdateByCustomField("id", param["objid"].(string), "i_credit", util.IntAll(rr["i_credit"])+score)
+					}
+				}
 			}
 		}
 	}

+ 1 - 3
core/src/qfw/member/credit/creditdetail.go

@@ -7,7 +7,6 @@ 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"
@@ -36,7 +35,6 @@ 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)
@@ -173,7 +171,7 @@ func (c *credit) CreditList() error {
 		if currentPage == 1 {
 			count = mongodb.Count("creditlog", query)
 		}
-		r = *mongodb.Find("creditlog", query, `{"l_date":-1}`, nil, false, start, limit)
+		r = *mongodb.Find("creditlog", query, `{"l_datenm":-1}`, nil, false, start, limit)
 		for i := 0; i < len(r); i++ {
 			r[i]["index"] = (i + 1) + (currentPage-1)*limit
 			d := r[i]["l_date"]

+ 10 - 0
core/src/qfw/member/ordermanage.go

@@ -78,12 +78,22 @@ func (o *OrderManage) ChangeStatus() error {
 			param["objid"] = (*r)["s_editorid"]
 			credit_a := util.IntAll(o.GetSession("credit_a"))
 			userId := util.ObjToString(o.GetSession("userId"))
+			//log.Println("预约", credit.AIsHasDo(credit.A_WCJY, credit_a), userId, param["objid"])
 			if credit.AIsHasDo(credit.A_WCJY, credit_a) {
 				credit.UpuserCreditSession(userId, credit.C_JY, "B", param, o.Action)
 			} else {
 				credit.UpuserCreditSession(userId, credit.A_WCJY, "A", nil, o.Action)
 				credit.UpuserCreditSession(userId, credit.C_JY, "B", param, o.Action)
 			}
+			//判断对方是否完成一次性任务
+			rr := *FindById("user", param["objid"].(string), nil)
+			if !credit.AIsHasDo(credit.A_WCJY, util.IntAll(rr["credit_a"])) {
+				b, credit_a, score, _ := credit.InCreditA(param["objid"].(string), credit.A_WCJY, util.IntAll(rr["credit_a"]))
+				if b {
+					o.Session().UpdateByCustomField("id", param["objid"].(string), "credit_a", credit_a)
+					o.Session().UpdateByCustomField("id", param["objid"].(string), "i_credit", util.IntAll(rr["i_credit"])+score)
+				}
+			}
 		}
 
 	}

+ 1 - 1
core/src/web/templates/common/memberleft.html

@@ -99,7 +99,7 @@
 	</a>
 	<a class="list-group-item" style="padding:10px 2px">
 	<div style="width:198px;height:40px;text-align:center;">
-		<div style="float:left;width:90px;border-right:1px">
+		<div onclick="creditModel(1)" style="float:left;width:90px;border-right:1px">
 			<div>积分</div>
 			<div><i class="glyphicon jinbi" style="width:25px;color:red;font-size:18px"></i><span style="font-weight:normal;">{{session "i_credit"}}</span></div>
 		</div>

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

@@ -240,7 +240,7 @@
 								{{end}}
 							</tr>
 							<tr class="rowtwo">
-								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积</td>
+								<td width="60%" style="text-indent: 7em;">完成5次企业查询,得50积</td>
 								{{if .T.B_QYCX.A }}
 								<td width="10%" align="center"><span class="ok-sign bootstrap-glyphicon glyphicon-ok-sign"></span><span style="padding:0 13px">{{.T.B_QYCX.B}}/{{.T.B_QYCX.C}}</span></td>
 								<td width="30%" style="padding:110px"></td>

+ 7 - 7
credit/src/config.json

@@ -9,7 +9,7 @@
     "rpcPort": "8765",
     "weixinrpc": "127.0.0.1:82",
     "num": {
-        "a1": 50,
+        "a1": 2000,
         "a2": 100,
         "a3": 50,
         "a4": 50,
@@ -60,13 +60,13 @@
         "txt_a6": "收藏名片",
         "txt_a7": "收藏服务",
         "txt_a8": "使用剑鱼",
-        "txt_a9": "使用企业查询",
-        "txt_a10": "发服务",
-        "txt_a11": "发需求",
+        "txt_a9": "首次使用企业查询",
+        "txt_a10": "首次发服务",
+        "txt_a11": "首次发需求",
         "txt_a12": "查看关系网",
-        "txt_a13": "分享服务",
-        "txt_a14": "完成交易",
-        "txt_a15": "完成交易评价",
+        "txt_a13": "首次分享服务",
+        "txt_a14": "完成首次交易",
+        "txt_a15": "完成首次交易评价",
 		"txt_a61": "剑鱼首次推送",
         "txt_a62": "完成一次性所有任务",
         "txt_b1": "签到",

+ 3 - 0
credit/src/qfw/creditrpc/creditrpc.go

@@ -75,6 +75,7 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 			"s_operation": Message["txt_"+param.Code],
 			"i_type":      1,
 			"l_date":      time.Now().Unix(),
+			"l_datenm":    time.Now().UnixNano() / 1000000,
 		}
 		i_scorenow := getCreditById(param.Uid)
 		switch first {
@@ -186,6 +187,7 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 							"i_type":      1,
 							"s_sourceid":  param.Uid,
 							"l_date":      time.Now().Unix(),
+							"l_datenm":    time.Now().UnixNano() / 1000000,
 							"i_score":     Score[param.Code],
 							"i_scorenow":  i_scorenow + Score[param.Code],
 						}
@@ -262,6 +264,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 			"s_operation": Message["txt_"+param.Code],
 			"i_type":      0,
 			"l_date":      now.Unix(),
+			"l_datenm":    time.Now().UnixNano() / 1000000,
 		}
 		if param.OtherParam != nil && param.OtherParam["i_way"] != nil {
 			creditDoc["i_way"] = param.OtherParam["i_way"]

+ 3 - 5
credit/src/qfw/creditrpc/creditrpc_test.go

@@ -9,14 +9,12 @@ import (
 func Test(t *testing.T) {
 	tmp := uint64(1)
 	var ret uint64
-	for k := 2; k < 62; k++ {
-		if k == 9 {
-			continue
-		}
+	for k := 2; k < 13; k++ {
+
 		ret = 1 << (uint64(k) - 1)
 		tmp += ret
 		log.Println(k, int(tmp), int(ret))
 	}
 	log.Println(tmp)
-	log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
+	//log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
 }