Browse Source

修改积分、推送

renzheng 9 years ago
parent
commit
7939db0d29

+ 19 - 4
common/src/qfw/util/encrypt_test.go

@@ -20,11 +20,26 @@ func Test_sim(t *testing.T) {
 	//s := "obEpLuMMDUYUM-zlzCbQ0MbuQOzc,eqweqwewqeqwe,349483204"
 	//s2 := "GyUlIhEDDjcfWCAyIl4xBkgsERYiLAwZLCg9VkkbLj4zMRYDPRs5ATVZOxccPAkzFxw7CCpEFj41QlRAQFdFXlRMQVZcHRIbBgsWBxYcFQwEBwoa"
 
-	s3 := "RFYoal5bCFdXWQoQB0JuWwlXAQFZCUVfFj4JMFtT"
-	s4 := "3333_55a8597fa442ceca9e20bfc2_444"
-	se := SimpleEncrypt{Key: "qfw_hongbao"}
+	//s3 := "RFYoal5bCFdXWQoQB0JuWwlXAQFZCUVfFj4JMFtT"
+	s4 := "oJULtwzXo6EFV1Ah-XeyRBimXGM8,uid,123456,wxpushlist"
+	se := SimpleEncrypt{Key: "topnet"}
 	log.Println(se.EncodeString(s4))
-	log.Println(se.DecodeString(s3))
+	log.Println(se.DecodeString("GyUlIhEDDjcfWCAyIl4xBkgsERYiLAwZLCg9VkkSEkMWCEkHAwACCgMdBwcRDREdGwE=566666666666666"))
+	now := time.Now()
+	tom := time.Date(now.Year(), now.Month(), now.Day(), 18, 0, 0, 0, time.Local)
+	log.Println(now.Unix(), tom.Unix(), 1453686600-1453716000)
+
+	log.Println(GetSubDay(time.Now().AddDate(0, 1, 0).Unix()))
+
+	strs := []string{"1", "2"}
+	log.Println(func(tmps []string) []interface{} {
+		res := make([]interface{}, len(tmps))
+		for k, v := range tmps {
+			res[k] = v
+		}
+		log.Println("--------", res)
+		return res
+	}(strs[1:]))
 
 }
 

+ 1 - 0
core/src/message.json

@@ -5,6 +5,7 @@
 	"entsearchaction":"/search/enterprise/ent.html",
 	"lawsearchaction":"/law/qfw/index",
 	"msiteaction":"/ent/wsite/edit",
+	"wxpushlist":"/wxpush/bid/%s/%s/%s",
 	"indentify":{
 		"success":{
 			"result":"企业认证",

+ 14 - 1
core/src/qfw/member/memberindex.go

@@ -38,8 +38,10 @@ func init() {
 }
 
 func (m *MemberIndex) Sess(str string) error {
+
 	util.Try(func() {
-		str := strings.Split(sewx.DecodeString(str), ",")
+		strs := strings.Split(str, "/")
+		str := strings.Split(sewx.DecodeString(strs[0]), ",")
 		if len(str) == 4 {
 			openid := str[0]
 			//openid unionid time action
@@ -58,6 +60,17 @@ func (m *MemberIndex) Sess(str string) error {
 					UpdateCookieSession(m.Action, "s_nickname", false, person)
 					actionurl := util.ObjToString(coreconfig.MessageConfig[str[3]])
 					if actionurl != "" {
+						log.Println("len(strs)", len(strs))
+						if len(strs) > 1 {
+							actionurl = fmt.Sprintf(actionurl, func(tmps []string) []interface{} {
+								res := make([]interface{}, len(tmps))
+								for k, v := range tmps {
+									res[k] = v
+								}
+								log.Println("--------", res)
+								return res
+							}(strs[1:])...)
+						}
 						m.Redirect(actionurl)
 					} else {
 						m.Render("_error.html")

+ 2 - 2
credit/src/main.go

@@ -258,13 +258,13 @@ func doSubCreditByUser(userId, umid, typeName, code string, next *time.Time, use
 			bsub = true
 		}
 		if bsub { //扣分操作
-			newDate := next.AddDate(0, 1, 0)
+			newDate := time.Now().AddDate(0, 1, 0)
 			creditDoc := map[string]interface{}{
 				"s_uid":     userId,
 				"s_umid":    umid,
 				"s_code":    code,
 				"i_type":    0, //是扣
-				"l_date":    next.Unix(),
+				"l_date":    time.Now().Unix(),
 				"l_enddate": newDate.Unix(),
 				"i_score":   codeNum,
 				"s_type":    typeName,

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

@@ -272,7 +272,7 @@ func (c *CreditRpc) OutCreadit(param *qrpc.CreditData, replay *int) error {
 		var newDate time.Time
 		switch first {
 		case "A":
-			newDate = GetTimeByNow(now, Hour).AddDate(0, 1, 0)
+			newDate = time.Now().AddDate(0, 1, 0)
 			creditDoc["l_enddate"] = newDate.Unix()
 			creditDoc["i_valid"] = 1
 			if param.OtherParam != nil {

+ 8 - 1
push/src/qfw/push/dopush/dopush.go

@@ -16,6 +16,12 @@ import (
 	"time"
 )
 
+var se util.SimpleEncrypt
+
+func init() {
+	se = util.SimpleEncrypt{Key: "topnet"}
+}
+
 type Pjob struct {
 	Dfa         *dfa.DFA
 	Cache       *map[string]*[]*push.MemberInterest
@@ -221,6 +227,7 @@ func SendWeixin(k *push.MemberInterest, TITLE, ShortTitle, str, stype string, no
 		Detail:  WXTitle,
 		Date:    wxDate,
 		Service: "剑鱼君",
-		Url:     push.PushConfig["bidViewDomain"].(string) + "/wxpush/bid/" + k.Openid + "/" + wid + "/aa"})
+		//Url:     push.PushConfig["bidViewDomain"].(string) + "/wxpush/bid/" + k.Openid + "/" + wid + "/aa"})
+		Url: push.PushConfig["bidViewDomain"].(string) + "/mobile/sess/" + se.EncodeString(k.Openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",wxpushlist") + "/" + k.Openid + "/" + wid + "/aa"})
 
 }