renzheng 9 years ago
parent
commit
db147e21d5

+ 4 - 1
core/src/qfw/mobile/wxmenu.go

@@ -14,6 +14,7 @@ import (
 	"qfw/util/redis"
 	qrpc "qfw/util/rpc"
 	"runtime"
+	"strings"
 	"time"
 )
 
@@ -152,6 +153,7 @@ func (m *Mobile) SwordfishPay() error {
 					if i_credit > 0 {
 						isPay := map[string]interface{}{}
 						mapPush := map[string]string{}
+						mapCode := []string{}
 						for _, v := range types {
 							util.Try(func() {
 								b_newopen := false
@@ -180,6 +182,7 @@ func (m *Mobile) SwordfishPay() error {
 								if b_newopen { //进行扣费操作
 									isPay[v] = v
 									mapPush[v] = util.If(v == "bid", "中标", "招标").(string)
+									mapCode = append(mapCode, util.If(v == "bid", "A2", "A1").(string))
 								}
 							}, func(e interface{}) {
 								log.Println(e)
@@ -189,7 +192,7 @@ func (m *Mobile) SwordfishPay() error {
 						if i_credit >= 0 {
 							credit_a := util.IntAll(m.GetSession("credit_a"))
 							b := false
-							if b, _ = credit.OutCreditB(userId.(string), credit.V_JY, util.ObjToString(m.GetSession("s_m_openid")), 0, isPay, m.Action); b {
+							if b, _ = credit.OutCreditB(userId.(string), strings.Join(mapCode, ","), util.ObjToString(m.GetSession("s_m_openid")), 0, isPay, m.Action); b {
 								//先扣分,然后更新,然后返回结果
 								res["credit"] = i_credit
 								res["oprstatus"] = true

+ 1 - 1
core/src/timetask.json

@@ -1 +1 @@
-{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-24 18:07:19"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-24 18:07:19"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-02-26 14:36:30"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-02-26 14:36:30"}},"marketisstart":true,"marketrate":300}

+ 2 - 1
credit/src/config.json

@@ -96,5 +96,6 @@
     "saveLogDuration": 1,
     "checkGiveDuration": 30,
     "swordfish_tipBeforeDays": "3,1",
-    "swordfish_subHour": 10
+	"timerHM":"0,m,29",
+    "swordfish_subHour": 14
 }

+ 6 - 1
credit/src/main.go

@@ -287,7 +287,12 @@ func doSubCreditByUser(userId, umid, typeName, code string, next *time.Time, use
 			}
 		} else { //暂停操作
 			//更新操作
-			if mongodb.Update("user", `{"_id":"`+userId+`"}`, `{"$set":{"o_msgset.`+typeName+`.i_status":0}}`, false, false) {
+			//`{"$set":{"o_msgset.`+typeName+`.i_status":0}}`
+			if mongodb.Update("user", `{"_id":"`+userId+`"}`, &map[string]interface{}{
+				"$set": map[string]interface{}{
+					"o_msgset." + typeName + ".i_status": 0,
+				},
+			}, false, false) {
 				//暂停通知,因积分不够
 				creditrpc.SendMsgWebAndWx(swordfish_closeTitle+"["+creditrpc.Message["txt_"+code]+"]", swordfish_close, userId, umid)
 			}

+ 2 - 1
credit/src/qfw/creditlog/creditlog.go

@@ -41,7 +41,8 @@ func Save(doc map[string]interface{}) bool {
 		Failed("保存到日志记录失败," + string(v))
 	} else {
 		//更新积分 i_credit到人
-		if doc["s_code"].(string) == "A1" || doc["s_code"].(string) == "A2" {
+		scode := doc["s_code"].(string)[:1]
+		if scode == "A" {
 			b = mongodb.Update("user", `{"_id":"`+doc["s_uid"].(string)+`"}`, &map[string]interface{}{
 				"$inc": map[string]int{
 					"i_credit": doc["i_score"].(int),

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

@@ -237,6 +237,15 @@ func (c *CreditRpc) InCreadit(param *qrpc.CreditData, replay *int) error {
 	return nil
 }
 
+func getTxt(code string) string {
+	codes := strings.Split(code, ",")
+	res := []string{}
+	for _, v := range codes {
+		res = append(res, Message["txt_"+v])
+	}
+	return strings.Join(res, ",")
+}
+
 //消费积分,增加扣费方式、手动还是自动
 func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 	defer func() {
@@ -253,15 +262,18 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 	*replay = 0
 	lock := GetMutex(param.Uid)
 	lock.Lock()
-	if len(param.Code) > 1 && Message[("txt_"+param.Code)] != "" {
+	if len(param.Code) > 1 {
 		i_scorenow := getCreditById(param.Uid)
 		first := param.Code[:1]
 		now := time.Now()
+
+		txt := getTxt(param.Code)
+
 		creditDoc := map[string]interface{}{
 			"s_uid":       param.Uid,
 			"s_umid":      param.Umid,
 			"s_code":      param.Code,
-			"s_operation": Message["txt_"+param.Code],
+			"s_operation": txt,
 			"i_type":      0,
 			"l_date":      now.Unix(),
 			"l_datenm":    time.Now().UnixNano() / 1000000,
@@ -293,7 +305,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 			*replay = creditDoc["i_score"].(int)
 			//发送微信通知扣积分成功
 			if first == "A" {
-				go SendMsgWebAndWx(Message["swordfish_payTitle"], fmt.Sprintf(Message["swordfish_pay"], creditDoc["i_score"], creditDoc["i_scorenow"], util.FormatDate(&newDate, util.Date_Full_Layout)), param.Uid, param.Umid)
+				go SendMsgWebAndWx(Message["swordfish_payTitle"]+"["+txt+"]", fmt.Sprintf(Message["swordfish_pay"], creditDoc["i_score"], creditDoc["i_scorenow"], util.FormatDate(&newDate, util.Date_Full_Layout)), param.Uid, param.Umid)
 			}
 		}
 	}

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

@@ -2,7 +2,7 @@ package creditrpc
 
 import (
 	"log"
-
+	"qfw/util"
 	"testing"
 )
 
@@ -16,5 +16,17 @@ func Test(t *testing.T) {
 		log.Println(k, int(tmp), int(ret))
 	}
 	log.Println(tmp)
+	ssss := "A234"
+	log.Println(ssss[1:5])
 	//log.Println(uint64(int(tmp))&(1<<8), (1 << 8))
 }
+
+func Test_txt(t *testing.T) {
+	var SysConfig map[string]interface{}
+	util.ReadConfig("../../config.json", &SysConfig)
+	Message = map[string]string{}
+	for k, v := range SysConfig["message"].(map[string]interface{}) {
+		Message[k] = v.(string)
+	}
+	log.Println(getTxt("A2"))
+}

+ 6 - 6
weixin/src/config.json

@@ -1,6 +1,6 @@
 {
 	"port":"82",
-	"domain":"www.qimingxing.info",
+	"domain":"127.0.0.1",
 	"imgpath":"/opt/qfw_dev/web/staticres",
 	"mongodbServers": "10.116.86.154:27080",
 	"elasticsearch":"http://10.116.86.154:9800",
@@ -10,9 +10,9 @@
 	"rpcport":"83",
 	"serviceTip":"服务指南",
 	"appcontext":"weixin",
-	"appid":"wx9fbe26c14a196021",
+	"appid":"wx9852f95aa927e646",
 	"token":"topnet2015",
-	"appsecret":"3243545279b584dd574a595071395be4",
+	"appsecret":"d4624c36b6795d1d99dcf0547af5443d",
         "aboutmeurl":"http://www.qimingxing.info/article/aboutme",
         "conactusurl":"http://www.qimingxing.info/article/contactus",
 	"wsqurl": "http://s.p.qq.com/pub/jump?d=AAAXeGLZ",
@@ -24,10 +24,10 @@
 	"loginTip":"您已经成功登录企明星。",
 	"freezeTip":"您的帐号已经冻结,请联系管理员。",
 	"messagetpl":{
-		"identifytplid":"oGxkPyaV42z3KWykt58Tow9mBe_ImJvi8R3ajorVWOY",
+		"identifytplid":"sKn4r0or615ETYC-aI5OACPO_Q4-B8GYmgWoqcDghN4",
 		"offLinemsgtplid":"ExIeyFfoDNVJXhRDq09JbsjH_zbEJCB6gw6rxcV7atw",
-		"msgnotifytplid":"b7iuAMiTCIolnPhTdueKBVYThEMf2D-Bh2M_9v3J-68",
-		"managernotifytplid":"dplgu5Q644vzPdqcPXY7RqgItS3eXACmU1XDl27CvTA"
+		"msgnotifytplid":"fcke7PqteAtclzHV3ScdiePH48vxaH6M5aJF0O_7by8",
+		"managernotifytplid":"DIwMrPQToOhGfa6ZAQCCrqquzbLKajiXsKY0K_lQtWQ"
 	},
 	"activity":{
 		"activitycode":"topcj",