zhangxinlei1996 4 年之前
父节点
当前提交
8c1ba21c3f
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/jfw/modules/app/src/app/front/shorturl.go

+ 15 - 2
src/jfw/modules/app/src/app/front/shorturl.go

@@ -13,6 +13,7 @@ import (
 	"jfw/public"
 	"log"
 	"qfw/util"
+	"qfw/util/jy"
 	"qfw/util/redis"
 	"regexp"
 
@@ -46,6 +47,7 @@ func (s *Short) Article(stype, id string) error {
 		return s.Redirect("/jyapp/free/swordfish/about", 302)
 	}
 	disWord := s.GetString("disWord")
+	belongUserId := ""
 	if disWord != "" {
 		redisDis := redis.GetStr("other", "DIS_"+disWord[1:])
 		if redisDis != "" {
@@ -56,7 +58,7 @@ func (s *Short) Article(stype, id string) error {
 				effectiveTime, _ := strconv.ParseInt(effectiveTimeStr, 10, 64)
 				//是否计算佣金
 				if time.Now().Unix() <= effectiveTime {
-					belongUserId := strings.Split(redisDis, "##")[1]
+					belongUserId = strings.Split(redisDis, "##")[1]
 					if public.Mysql.ExecTx("口号使用", func(tx *sql.Tx) bool {
 						//口号是否使用过
 						wordInfo := public.Mysql.Find("dis_word", map[string]interface{}{"userId": userId, "password": disWord}, "id", "", 0, 0)
@@ -78,7 +80,6 @@ func (s *Short) Article(stype, id string) error {
 						}
 						return true
 					}) {
-
 					}
 				}
 
@@ -129,6 +130,18 @@ func (s *Short) Article(stype, id string) error {
 	var obj map[string]interface{}
 	obj = wxvisitD(sid, userId)
 	if len(obj) > 0 {
+		if belongUserId != "" && belongUserId != userId && util.ObjToString(obj["subtype"]) != "拟建" { //分享开打的
+			article_id := util.CommonDecodeArticle(stype, id)[0]
+			if redis.Get("other", fmt.Sprintf("integral_article_%s_%s", belongUserId, article_id)) == nil {
+				err := jy.Publish(public.Mgo_Log, config.Sysconfig["nsq"].(string), jy.Jyweb_article_open, belongUserId, jy.Jyapp_node1)
+				if err != nil {
+					log.Println("nsq队列写入失败-->", jy.Jyweb_article_open, belongUserId)
+				} else {
+					//integral_article_ +userId+ 三级页id
+					redis.Put("other", fmt.Sprintf("integral_article_%s_%s", belongUserId, article_id), "1", 60*60*24)
+				}
+			}
+		}
 		//获取打赏文案
 		//util.ReadConfig(&config.Sysconfig)
 		s.T["rewardText"], s.T["advertText"] = getRewardText()