wangchuanjin 4 年之前
父节点
当前提交
2a97623511
共有 2 个文件被更改,包括 7 次插入9 次删除
  1. 二进制
      message.exe
  2. 7 9
      points/points.go

二进制
message.exe


+ 7 - 9
points/points.go

@@ -1,12 +1,11 @@
 package points
 
 import (
+	"context"
 	"encoding/json"
 	"fmt"
 	"time"
 
-	"context"
-
 	"app.yhyue.com/moapp/jyPoints/rpc/integral"
 	"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
 	"app.yhyue.com/moapp/jybase/common"
@@ -22,7 +21,6 @@ import (
 
 const (
 	Redis_Main = "main"
-	OneDay     = 86400
 )
 
 type Points struct {
@@ -92,20 +90,20 @@ func jywx_subscribe_invited(msg *model.Message) {
 
 //打开文库文章页
 func jydocs_doc_open(msg *model.Message) {
-	key := fmt.Sprintf("jypoints_share_jydocs_doc_open_%s_%s", date.NowFormat(date.Date_yyyyMMdd), msg.E_userId)
-	jy_open(msg, key, Config.DocPoints.Open.Jydocs_doc_open)
+	jy_open(msg, Config.DocPoints.Open.Jydocs_doc_open)
 }
 
 //打开招投标信息文章页
 func jyweb_article_open(msg *model.Message) {
-	key := fmt.Sprintf("jypoints_share_jyweb_article_open_%s_%s", date.NowFormat(date.Date_yyyyMMdd), msg.E_userId)
-	jy_open(msg, key, Config.DocPoints.Open.Jyweb_article_open)
+	jy_open(msg, Config.DocPoints.Open.Jyweb_article_open)
 }
 
 //
-func jy_open(msg *model.Message, key string, point int64) {
+func jy_open(msg *model.Message, point int64) {
+	key := fmt.Sprintf("jypoints_share_article_open_%s_%s", date.NowFormat(date.Date_yyyyMMdd), msg.E_userId)
 	if redis.Incr(Redis_Main, key) <= Config.DocPoints.Open.Max {
-		redis.SetExpire(Redis_Main, key, OneDay)
+		now := time.Now()
+		redis.SetExpire(Redis_Main, key, int(time.Date(now.Year(), now.Month(), now.Day()+1, 0, 0, 0, 0, time.Local).Unix()-now.Unix()))
 		integralHarvest(msg, point, 1005)
 	} else {
 		logger.Info(fmt.Sprintf("%+v", msg), "超过一天最大次数", Config.DocPoints.Open.Max, "限制,不再增加积分")