renzheng 9 жил өмнө
parent
commit
04874cb492

+ 8 - 0
common/src/qfw/util/common.go

@@ -367,3 +367,11 @@ func BsonIdToSId(uid interface{}) string {
 		return fmt.Sprintf("%x", string(uid.(bson.ObjectId)))
 	}
 }
+
+func GetSubDay(t1 int64) int {
+	tt1 := time.Unix(t1, 0)
+	tt2 := time.Now()
+	nt1 := time.Date(tt1.Year(), tt1.Month(), tt1.Day(), 0, 0, 0, 0, time.Local)
+	nt2 := time.Date(tt2.Year(), tt2.Month(), tt2.Day(), 0, 0, 0, 0, time.Local)
+	return int((nt1.Unix() - nt2.Unix()) / 86400)
+}

+ 12 - 2
common/src/qfw/util/elastic/elasticutil_test.go

@@ -7,6 +7,7 @@ import (
 	"log"
 	"qfw/util/mongodb"
 	"testing"
+	"time"
 )
 
 func Test_Find1(t *testing.T) {
@@ -181,8 +182,17 @@ func Test_date(t *testing.T) {
 	//"1448267541"
 	//s := time.Now().UnixNano()
 	//log.Println(s, time.Now().Unix(), fmt.Sprintf("%d", s)[4:12], 999999/60/60)
-	var n uint64 = 1
-	log.Println(n<<62, int(n<<62))
+	t1 := time.Now().Unix()
+	t2 := t1 + 10000
+
+	tt1 := time.Unix(t1, 0)
+	tt2 := time.Unix(t2, 0)
+
+	nt1 := time.Date(tt1.Year(), tt1.Month(), tt1.Day(), 0, 0, 0, 0, time.Local)
+	nt2 := time.Date(tt2.Year(), tt2.Month(), tt2.Day(), 0, 0, 0, 0, time.Local)
+
+	log.Println((nt2.Unix() - nt1.Unix()) / 86400)
+
 }
 
 func Test_Getpage(t *testing.T) {

+ 3 - 6
core/src/qfw/mobile/wxmenu.go

@@ -64,15 +64,12 @@ func (m *Mobile) Wxrssset() error {
 					if vobj, ok := v.(map[string]interface{}); ok {
 						if vobj["l_enddate"] != nil && vobj["i_status"] != nil {
 							if util.IntAll(vobj["i_status"]) == 1 {
-								sub := vobj["l_enddate"].(int64) - time.Now().Unix()
+								sub := util.GetSubDay(vobj["l_enddate"].(int64))
 								if sub >= 0 {
-									if sub%86400 == 0 {
-										vobj["days"] = sub / 86400
-									} else {
-										vobj["days"] = sub/86400 + 1
-									}
+									vobj["days"] = sub
 								} else {
 									vobj["days"] = 0
+									//是否要扣
 								}
 							}
 						}

+ 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-01-22 13:40:43"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 13:40:43"}},"marketisstart":true,"marketrate":300}
+{"comment":{"c_rate":720,"commentrate":900},"market":{"demand":{"attr":["i_hits","i_bids","i_status"],"timepoint":"2016-01-22 15:44:25"},"service":{"attr":["i_hits","i_sales","i_comments","i_score","i_appcounts"],"timepoint":"2016-01-22 15:44:25"}},"marketisstart":true,"marketrate":300}

+ 1 - 1
core/src/web/staticres/wxswordfish/main.js

@@ -251,7 +251,7 @@ function showSnopshot(module,type,on){
 		//显示天数
 		try{
 			var days=eval("msgset."+module+".days")	
-			if(days){
+			if(typeof days=="number"){
 				var tiptxt="本栏目推送服务期还剩<d style='color:red'>"+days+"</d>天"
 				if(winWidth<341){
 					tiptxt="服务期还剩<d style='color:red'>"+days+"</d>天"

+ 1 - 1
credit/src/config.json

@@ -48,7 +48,7 @@
         "swordfish_closeTitle": "剑鱼服务暂停提醒",
         "swordfish_close": "您的剑鱼服务已经到期,已经暂停,请及时续费。",
         "swordfish_payTitle": "剑鱼服务订单提醒",
-        "swordfish_pay": "您已成功续订剑鱼,扣除%d,剩余积分%d,剑鱼时长延期到%s",
+        "swordfish_pay": "您已成功续订剑鱼,扣除%d积分,剩余%d积分,剑鱼服务时长到:%s",
         "give": "转赠提醒",
         "give_pay": "转赠扣除提醒",
         "recharge": "充值成功提醒",

+ 5 - 4
credit/src/main.go

@@ -202,8 +202,8 @@ func TimerSwordFishFromUser() {
 					} {
 						query := coll.Find(&map[string]interface{}{
 							"o_msgset." + typeName + ".l_enddate": map[string]interface{}{
-								"$gte": next64 - 60000,
-								"$lte": next64 + int64(swordfish_tipBeforeDays[0]*24*3600) + 60000,
+								"$gte": next64 - 80000,
+								"$lte": next64 + int64(swordfish_tipBeforeDays[0]*24*3600) + 80000,
 							},
 							"o_msgset." + typeName + ".i_status":       1,
 							"o_msgset." + typeName + ".i_switchstatus": 1,
@@ -214,14 +214,15 @@ func TimerSwordFishFromUser() {
 							util.Try(func() {
 								tmpCode := tmp["o_msgset"].(map[string]interface{})[typeName].(map[string]interface{})
 								endDate := tmpCode["l_enddate"].(int64)
-								sub64 := (endDate - next64) / 86400
+								sub64 := util.GetSubDay(endDate) //(endDate - next64) / 86400
+								log.Println("======---====", sub64)
 								if sub64 <= 0 {
 									//自动扣费
 									doSubCreditByUser(util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string), typeName, code, &next, tmp)
 								} else {
 									//提示
 									for _, v := range swordfish_tipBeforeDays {
-										if int64(v) == sub64 {
+										if v == sub64 {
 											creditrpc.SendMsgWebAndWx(swordfish_dueTitle, fmt.Sprintf(swordfish_due, v), util.BsonIdToSId(tmp["_id"]), tmp["s_m_openid"].(string))
 										}
 									}

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

@@ -310,7 +310,7 @@ func SendMsgWebAndWx(title, content, userId, umid string) {
 		ReceiveId: userId,
 	}
 	go m.SaveMsg()
-	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "管理员", Remark: content})
+	go SendManagerNotifyMsg(&qrpc.NotifyMsg{Openid: umid, Title: title, Detail: "剑鱼君", Remark: content})
 
 }
 

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

@@ -208,7 +208,7 @@ func SendWeixin(k *push.MemberInterest, TITLE, ShortTitle, str, stype string, no
 		wxDate = time.Now().Local().Add(time.Duration(-n2) * time.Second).Add(time.Duration(-n1*24) * time.Hour).Format(util.Date_Full_Layout)
 	}
 
-	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“会员服务—剑鱼”进行修改。"
+	wxstr := "\n点击下方“详情”查看详细信息。\n以上" + ShortTitle + "信息,是剑鱼根据关键字“" + strings.Join(k.Interest, ";") + "”奋力查找并推送,如不合您心意,请猛戳企明星菜单“剑鱼”进行修改。"
 	push.SendWinXin(&qrpc.NotifyMsg{
 		Openid:  k.Openid,
 		Title:   push.PushConfig[stype+"Title"].(string),