Browse Source

fix:公告详情页次数限制

xuemingyang 3 years ago
parent
commit
7623bf18e4
3 changed files with 211 additions and 195 deletions
  1. 38 28
      src/jfw/front/shorturl.go
  2. 10 5
      src/jfw/modules/app/src/app/front/shorturl.go
  3. 163 162
      src/jfw/modules/app/src/config.json

+ 38 - 28
src/jfw/front/shorturl.go

@@ -199,6 +199,7 @@ func (s *Short) Article(stype, id string) error {
 		s.T["signature"] = wx.SignJSSDK(s.Site() + s.Url())
 
 		obj := wxvisitD(sid, userId, myopenid, isVip || isMember || isEntniche)
+		s.T["canRead"] = SeeDetailLimit(obj, userId, sid)
 		if len(obj) > 0 {
 			FieldProcessing(obj, ssOpenid, industry, id, from_userid, userId, stype, isVip || isMember || isEntniche, true)
 
@@ -271,31 +272,10 @@ func (s *Short) Article(stype, id string) error {
 			return nil
 		}
 		sid := sids[0]
-		watchKey := fmt.Sprintf("article_count_%d_%s_%d_%s", time.Now().Year(), time.Now().Month(), time.Now().Day(), userId)
-		if seeRes := redis.Get("other", watchKey); seeRes != nil && seeRes != "" {
-			if resVal, _ := seeRes.(string); resVal != "" {
-				sidss := strings.Split(resVal, "_")
-				canRead := config.Sysconfig["canReadNotice"]
-				if len(sidss) < util.IntAll(canRead) {
-					s.T["canRead"] = true
-					sidss = append(sidss, sid)
-					arrs := RemoveDuplicatesAndEmpty(sidss)
-					newVal := strings.Join(arrs, "_")
-					redis.Put("other", watchKey, newVal, 60*60*24)
-				} else {
-					s.T["canRead"] = false
-					for _, v := range sidss {
-						if sid == v {
-							s.T["canRead"] = true
-							break
-						}
-					}
-				}
-			}
-		} else {
-			redis.Put("other", watchKey, sid, 60*60*24)
-			s.T["canRead"] = true
-		}
+		indust := s.GetString("industry")
+		_, _, _, objc := pcVRT(sid, indust, isVip || isMember || isEntniche)
+		s.T["canRead"] = SeeDetailLimit(objc, userId, sid)
+		fmt.Println(s.T["canRead"])
 		if userId != "" && stype == "indexcontent" { //已登录用户直接跳转至正常三级页
 			return s.Redirect(fmt.Sprintf("/article/content/%s.html", util.CommonEncodeArticle("content", sid)))
 		}
@@ -338,9 +318,6 @@ func (s *Short) Article(stype, id string) error {
 					if obj["winner_enttel"] != "" {
 						obj["winner_enttel"] = "无权限"
 					}
-					if obj["subType"] == "拟建" || obj["subType"] == "采购意向" {
-						s.T["canRead"] = false
-					}
 				}
 				//判断时间 //如果是seo页面超过时间访问的进入首页
 				comeinTime := time.Unix(util.Int64All(obj["comeintime"]), 0)
@@ -398,6 +375,39 @@ func (s *Short) Article(stype, id string) error {
 	return nil
 }
 
+//查看公告详情次数限制
+func SeeDetailLimit(obj map[string]interface{}, userId, sid string) bool {
+	watchKey := fmt.Sprintf("article_count_%d_%s_%d_%s", time.Now().Year(), time.Now().Month(), time.Now().Day(), userId)
+	if strings.Contains(obj["subtype"].(string), "拟建") || strings.Contains(obj["subtype"].(string), "采购意向") {
+		return false
+	} else {
+		if seeRes := redis.Get("other", watchKey); seeRes != nil && seeRes != "" {
+			if resVal, _ := seeRes.(string); resVal != "" {
+				sidss := strings.Split(resVal, "_")
+				canRead := config.Sysconfig["canReadNotice"]
+				if len(sidss) < util.IntAll(canRead) {
+					sidss = append(sidss, sid)
+					arrs := RemoveDuplicatesAndEmpty(sidss)
+					newVal := strings.Join(arrs, "_")
+					redis.Put("other", watchKey, newVal, 60*60*24)
+					return true
+				} else {
+					for _, v := range sidss {
+						if sid == v {
+							return true
+						}
+					}
+					return false
+				}
+			}
+		} else {
+			redis.Put("other", watchKey, sid, 60*60*24)
+			return true
+		}
+	}
+	return false
+}
+
 func SwiDef(sid_openid []string) (string, string) {
 	var shareopenid, sid string
 	if len(sid_openid) > 1 {

+ 10 - 5
src/jfw/modules/app/src/app/front/shorturl.go

@@ -62,7 +62,16 @@ func (s *Short) Article(stype, id string) error {
 		return s.Redirect("/jyapp/free/swordfish/about", 302)
 	} else {
 		sid = sid_openid[0]
-		watchKey := fmt.Sprintf("article_count_%d_%s_%d_%s", time.Now().Year(), time.Now().Month(), time.Now().Day(), userId)
+	}
+
+	s.T["keywords"] = kds
+	var obj map[string]interface{}
+	obj = wxvisitD(sid, userId, isVip || isEntniche || i_member_status > 0)
+
+	watchKey := fmt.Sprintf("article_count_%d_%s_%d_%s", time.Now().Year(), time.Now().Month(), time.Now().Day(), userId)
+	if strings.Contains(obj["subtype"].(string), "拟建") || strings.Contains(obj["subtype"].(string), "采购意向") {
+		s.T["canRead"] = false
+	} else {
 		if seeRes := redis.Get("other", watchKey); seeRes != nil && seeRes != "" {
 			if resVal, _ := seeRes.(string); resVal != "" {
 				sidss := strings.Split(resVal, "_")
@@ -88,10 +97,6 @@ func (s *Short) Article(stype, id string) error {
 			s.T["canRead"] = true
 		}
 	}
-
-	s.T["keywords"] = kds
-	var obj map[string]interface{}
-	obj = wxvisitD(sid, userId, isVip || isEntniche || i_member_status > 0)
 	if len(obj) > 0 {
 		if belongUserId != "" && belongUserId != userId && util.ObjToString(obj["subtype"]) != "拟建" { //分享开打的
 			article_id := util.CommonDecodeArticle(stype, id)[0]

+ 163 - 162
src/jfw/modules/app/src/config.json

@@ -1,162 +1,163 @@
-{
-	"cookiedomain": ".jianyu360.com",
-	"webport": "89",
-	"weixinrpc": "127.0.0.1:8083",
-	"cacheflag": false,
-	"agreement": "http",
-	"webdomain": "https://web-zxl.jydev.jianyu360.com",
-	"redirect": {
-		"wxpushlist": "/jyapp/wxpush/bidinfo/%s",
-		"newInfoFollow": "/jyapp/followent/newInfo/%s",
-		"wxpushfollowlist": "/jyapp/follow/notice/%s/%s",
-		"followset": "/jyapp/follow/set/%s/%s",
-		"myfeedbacks": "/jyapp/swordfish/myFeedbacks",
-		"historypush": "/jyapp/swordfish/historypush?f=push&t=%s&pushtime=%s",
-		"followEntDetail": "/jyapp/followent/detail/%s",
-		"msgremind": "/jyapp/vipsubscribe/msgremind?%s",
-		"vipreport": "/subscribepay/report/wxtplmsg?start=%s&end=%s&pushcount=%s",
-		"entnichehistorypush": "/jyapp/entniche/pushlist?selectTime=%s&pi=%s&pn=%s&type=%s",
-		"trackReport": "/page_entniche/business/t-report/detail/%s_%s/%s",
-		"viphomepage": "/jyapp/vipsubscribe/toSubVipSetPage",
-		"pushFollowEnt": "/jyapp/big/page/ent_follow",
-		"pushFollowProject": "/jyapp/big/page/pro_follow_list",
-		"pushMember": "/jyapp/big/page/big_subscribe?pushtime=%s",
-		"pushProjectForecast": "/jyapp/big/page/forecast_list",
-		"pushEntChange": "/jyapp/big/page/ent_follow",
-		"followProjectSet": "/jyapp/big/page/pro_follow_detail?fid=%s&sid=%s",
-		"memberreport":"/bigmember/report/openpushmsg?start=%s&end=%s&pushcount=%s",
-		"memberreport_experience":"/bigmember/report/openpushmsg?t=app_experience&start=%s&end=%s&pushcount=%s"
-	},
-	"followProject": 10,
-	"followentlimit": "10",
-	"followLimitDay": 30,
-	"followTipMsg": {
-		"title": "您关注的项目《%s》将于%s开标!",
-		"remark": "您收到这条信息是因为您之前设置了项目开标提醒,如果您不再需要此类提醒,可点击下方“详情”修改提醒设置。"
-	},
-	"followPushRpc": "127.0.0.1:8759",
-	"rewardText": [
-		"憋说话!赏我!",
-		"“赏”就一个字 我只说一次",
-		"厉害了word鱼!",
-		"看官赏点银子偶会更卖力噢!",
-		"各位客官,快来赏点吧!",
-		"夸我还是含蓄点的好,赏一个吧~",
-		"爱,就供养;喜欢,就打赏!",
-		"请简单粗暴地爱我!",
-		"最喜欢你一言不合就打赏的样子了~~~么么!"
-	],
-	"advertText": [
-		"与其一个人孤单  不如一群人狂欢   赶快加入剑鱼标讯社区",
-		"加入剑鱼标讯社区  和投标大神做朋友",
-		"来剑鱼标讯社区  找最合拍的伙伴",
-		"剑鱼标讯社区,让沟通连接你我。",
-		"剑鱼标讯社区,分享你的知识、解决问题、行业资源交换",
-		"勇敢发声,和老司机一起畅聊招投标。",
-		"春风十里,不如来剑鱼标讯社区!",
-		"只要心相通,相隔千里也能畅快交流。",
-		"弹指一挥间,剑鱼标讯因你而不同!",
-		"携手同行,认真对待每一次招投标"
-	],
-	"advertImg": "/jyapp/images/advert.png",
-	"advertName": "广告",
-	"advertUrl": "/jyapp/free/swordfish/about",
-	"industry": "分类综合测试",
-	"recommendEntLimit": "50",
-	"update": {
-		"isBrowserUpdate":1,
-		"grayupdate":false,
-		"version": "3.0.5",
-		"mustupdate": false,
-		"tipspace": 86400,
-		"ios_version": "2.7.3",
-		"ios_mustupdate": false,
-		"ios_openUpdate": false,
-		"ios_grayupdate":false,
-		"apkurl": "https://web2-jytest.jydev.jianyu360.com/jyinstallpkg/mobile/%s/jianyu360.apk",
-		"channelDir": {
-			"baidu": "baiduSem",
-			"shenma": "shenmaSem",
-			"huawei": "huawei",
-			"xiaomi": "xiaomi",
-			"yingyongbao": "yingyongbao",
-			"douyin": "douyin",
-			"weixin": "jywx",
-			"topnet": "topnet",
-			"duanxin": "duanxin",
-			"active_pullnew": "active_pullnew",
-			"default": "topnet"
-		}
-	},
-	"limitSearchText": {
-		"flag": false,
-		"count": 3,
-		"timeout": 60,
-		"totalPage": 3,
-		"userIds": [
-			"ocXeA0jceF8KRunDkwf9egT4bKI8",
-			"ocXeA0nBnaRZhKEZYhMBGvd4NvH0",
-			"ocXeA0rBxfsr_4GzysQFzF3Cf81U"
-		],
-		"msg": "f 开关状态:%s //-2 从配置文件重置,-1 关闭,1 打开<br><br>c 并发数:%d //-2 不限制并发数,-1 无条件直接限制,>0 限制并发数<br><br>t 个人查询限制时间:%ds //-1 不限制<br><br>p 限制页数:%d"
-	},
-	"share": {
-		"forceShareEnabled": false,
-		"onlineDate": "2018-08-20 00:00:00",
-		"regDaysForNewUser": 5,
-		"shareIntervalDays": 7,
-		"startHour": 8,
-		"endHour": 17,
-		"shareTimesUpperLimitR": 4000,
-		"shareTimesUpperLimitIrr": 1000
-	},
-	"appPushServiceRpc": "192.168.20.139:5566",
-	"afterSavePushId": 60,
-	"mail": [
-    {
-      "addr": "smtp.exmail.qq.com",
-      "port": 465,
-      "pwd": "ue9Rg9Sf4CVtdm5a",
-      "user": "public03@topnet.net.cn"
-    },
-    {
-      "addr": "smtp.exmail.qq.com",
-      "port": 465,
-      "pwd": "ue9Rg9Sf4CVtdm5a",
-      "user": "public03@topnet.net.cn"
-    }
-  ],
-	"policy": {
-		"title": "使用许可协议和隐私政策",
-		"content": "欢迎使用剑鱼标讯!\n我们依据最新法规及监管政策要求,更新了《剑鱼标讯用户使用许可协议》和《剑鱼标讯隐私政策》,在您使用剑鱼标讯前,请仔细阅读并充分了解。\n如你同意《剑鱼标讯用户使用许可协议》和《剑鱼标讯隐私政策》,请点击“同意”并开始使用我们的产品和服务,我们会全力保护你的个人信息安全。",
-		"href": [
-			"jyapp/free/staticPage/privacy_rules_client.html",
-			"jyapp/free/staticPage/permission_rules_client.html"
-		],
-		"name": [
-			"《剑鱼标讯隐私政策》",
-			"《剑鱼标讯用户使用许可协议》"
-		]
-	},
-	"tencentcloud": {
-		"appid": "TIDAXUV9",
-		"secretKey": "c7KJhtLMF805EeImBcOsoygu8KkdOrAfIaSU9SqAh8a2aiCgc69EfsaLM5EQcadF",
-		"version": "1.0.0"
-	},
-	"termValidity": 3600,
-	"uploadPath": "./web/staticres/jyapp/res/",
-	"appConfig":{
-		"pushGrpcServer":"192.168.20.139:5565",
-		"pushGrpcHeartBeat":3
-	},
-    "redisSessionLockSize":20,
-    "nsq":"192.168.3.240:4260",
-    "accountMergeOnline":"3333-03-30 00:00:00",
-	"bidSearchOldUserLimit": 1626105600,
-    "firstBindPop":3,
-    "maxBindPop":8,
-    "bindPopRedis":"merge",
-    "phoneFilterFlag":true,
-    "optimalTime":"2021-08-03 12:00:00",
-    "criticality":2
-}
+{
+	"cookiedomain": ".jianyu360.com",
+	"webport": "89",
+	"weixinrpc": "127.0.0.1:8083",
+	"cacheflag": false,
+	"agreement": "http",
+	"webdomain": "https://web-zxl.jydev.jianyu360.com",
+  "canReadNotice": 3,
+	"redirect": {
+		"wxpushlist": "/jyapp/wxpush/bidinfo/%s",
+		"newInfoFollow": "/jyapp/followent/newInfo/%s",
+		"wxpushfollowlist": "/jyapp/follow/notice/%s/%s",
+		"followset": "/jyapp/follow/set/%s/%s",
+		"myfeedbacks": "/jyapp/swordfish/myFeedbacks",
+		"historypush": "/jyapp/swordfish/historypush?f=push&t=%s&pushtime=%s",
+		"followEntDetail": "/jyapp/followent/detail/%s",
+		"msgremind": "/jyapp/vipsubscribe/msgremind?%s",
+		"vipreport": "/subscribepay/report/wxtplmsg?start=%s&end=%s&pushcount=%s",
+		"entnichehistorypush": "/jyapp/entniche/pushlist?selectTime=%s&pi=%s&pn=%s&type=%s",
+		"trackReport": "/page_entniche/business/t-report/detail/%s_%s/%s",
+		"viphomepage": "/jyapp/vipsubscribe/toSubVipSetPage",
+		"pushFollowEnt": "/jyapp/big/page/ent_follow",
+		"pushFollowProject": "/jyapp/big/page/pro_follow_list",
+		"pushMember": "/jyapp/big/page/big_subscribe?pushtime=%s",
+		"pushProjectForecast": "/jyapp/big/page/forecast_list",
+		"pushEntChange": "/jyapp/big/page/ent_follow",
+		"followProjectSet": "/jyapp/big/page/pro_follow_detail?fid=%s&sid=%s",
+		"memberreport":"/bigmember/report/openpushmsg?start=%s&end=%s&pushcount=%s",
+		"memberreport_experience":"/bigmember/report/openpushmsg?t=app_experience&start=%s&end=%s&pushcount=%s"
+	},
+	"followProject": 10,
+	"followentlimit": "10",
+	"followLimitDay": 30,
+	"followTipMsg": {
+		"title": "您关注的项目《%s》将于%s开标!",
+		"remark": "您收到这条信息是因为您之前设置了项目开标提醒,如果您不再需要此类提醒,可点击下方“详情”修改提醒设置。"
+	},
+	"followPushRpc": "127.0.0.1:8759",
+	"rewardText": [
+		"憋说话!赏我!",
+		"“赏”就一个字 我只说一次",
+		"厉害了word鱼!",
+		"看官赏点银子偶会更卖力噢!",
+		"各位客官,快来赏点吧!",
+		"夸我还是含蓄点的好,赏一个吧~",
+		"爱,就供养;喜欢,就打赏!",
+		"请简单粗暴地爱我!",
+		"最喜欢你一言不合就打赏的样子了~~~么么!"
+	],
+	"advertText": [
+		"与其一个人孤单  不如一群人狂欢   赶快加入剑鱼标讯社区",
+		"加入剑鱼标讯社区  和投标大神做朋友",
+		"来剑鱼标讯社区  找最合拍的伙伴",
+		"剑鱼标讯社区,让沟通连接你我。",
+		"剑鱼标讯社区,分享你的知识、解决问题、行业资源交换",
+		"勇敢发声,和老司机一起畅聊招投标。",
+		"春风十里,不如来剑鱼标讯社区!",
+		"只要心相通,相隔千里也能畅快交流。",
+		"弹指一挥间,剑鱼标讯因你而不同!",
+		"携手同行,认真对待每一次招投标"
+	],
+	"advertImg": "/jyapp/images/advert.png",
+	"advertName": "广告",
+	"advertUrl": "/jyapp/free/swordfish/about",
+	"industry": "分类综合测试",
+	"recommendEntLimit": "50",
+	"update": {
+		"isBrowserUpdate":1,
+		"grayupdate":false,
+		"version": "3.0.5",
+		"mustupdate": false,
+		"tipspace": 86400,
+		"ios_version": "2.7.3",
+		"ios_mustupdate": false,
+		"ios_openUpdate": false,
+		"ios_grayupdate":false,
+		"apkurl": "https://web2-jytest.jydev.jianyu360.com/jyinstallpkg/mobile/%s/jianyu360.apk",
+		"channelDir": {
+			"baidu": "baiduSem",
+			"shenma": "shenmaSem",
+			"huawei": "huawei",
+			"xiaomi": "xiaomi",
+			"yingyongbao": "yingyongbao",
+			"douyin": "douyin",
+			"weixin": "jywx",
+			"topnet": "topnet",
+			"duanxin": "duanxin",
+			"active_pullnew": "active_pullnew",
+			"default": "topnet"
+		}
+	},
+	"limitSearchText": {
+		"flag": false,
+		"count": 3,
+		"timeout": 60,
+		"totalPage": 3,
+		"userIds": [
+			"ocXeA0jceF8KRunDkwf9egT4bKI8",
+			"ocXeA0nBnaRZhKEZYhMBGvd4NvH0",
+			"ocXeA0rBxfsr_4GzysQFzF3Cf81U"
+		],
+		"msg": "f 开关状态:%s //-2 从配置文件重置,-1 关闭,1 打开<br><br>c 并发数:%d //-2 不限制并发数,-1 无条件直接限制,>0 限制并发数<br><br>t 个人查询限制时间:%ds //-1 不限制<br><br>p 限制页数:%d"
+	},
+	"share": {
+		"forceShareEnabled": false,
+		"onlineDate": "2018-08-20 00:00:00",
+		"regDaysForNewUser": 5,
+		"shareIntervalDays": 7,
+		"startHour": 8,
+		"endHour": 17,
+		"shareTimesUpperLimitR": 4000,
+		"shareTimesUpperLimitIrr": 1000
+	},
+	"appPushServiceRpc": "192.168.20.139:5566",
+	"afterSavePushId": 60,
+	"mail": [
+    {
+      "addr": "smtp.exmail.qq.com",
+      "port": 465,
+      "pwd": "ue9Rg9Sf4CVtdm5a",
+      "user": "public03@topnet.net.cn"
+    },
+    {
+      "addr": "smtp.exmail.qq.com",
+      "port": 465,
+      "pwd": "ue9Rg9Sf4CVtdm5a",
+      "user": "public03@topnet.net.cn"
+    }
+  ],
+	"policy": {
+		"title": "使用许可协议和隐私政策",
+		"content": "欢迎使用剑鱼标讯!\n我们依据最新法规及监管政策要求,更新了《剑鱼标讯用户使用许可协议》和《剑鱼标讯隐私政策》,在您使用剑鱼标讯前,请仔细阅读并充分了解。\n如你同意《剑鱼标讯用户使用许可协议》和《剑鱼标讯隐私政策》,请点击“同意”并开始使用我们的产品和服务,我们会全力保护你的个人信息安全。",
+		"href": [
+			"jyapp/free/staticPage/privacy_rules_client.html",
+			"jyapp/free/staticPage/permission_rules_client.html"
+		],
+		"name": [
+			"《剑鱼标讯隐私政策》",
+			"《剑鱼标讯用户使用许可协议》"
+		]
+	},
+	"tencentcloud": {
+		"appid": "TIDAXUV9",
+		"secretKey": "c7KJhtLMF805EeImBcOsoygu8KkdOrAfIaSU9SqAh8a2aiCgc69EfsaLM5EQcadF",
+		"version": "1.0.0"
+	},
+	"termValidity": 3600,
+	"uploadPath": "./web/staticres/jyapp/res/",
+	"appConfig":{
+		"pushGrpcServer":"192.168.20.139:5565",
+		"pushGrpcHeartBeat":3
+	},
+    "redisSessionLockSize":20,
+    "nsq":"192.168.3.240:4260",
+    "accountMergeOnline":"3333-03-30 00:00:00",
+	"bidSearchOldUserLimit": 1626105600,
+    "firstBindPop":3,
+    "maxBindPop":8,
+    "bindPopRedis":"merge",
+    "phoneFilterFlag":true,
+    "optimalTime":"2021-08-03 12:00:00",
+    "criticality":2
+}