浏览代码

Merge branch 'dev4.5.2' of http://127.0.0.1:8080/qmx/jy into dev4.5.2

xgwangman 4 年之前
父节点
当前提交
d25451fe0f

+ 3 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js

@@ -118,7 +118,8 @@ var vNode = {
                 usage: 0, // 本月已使用次数
                 provin: 0, // 购买省份数量
                 visited: false // 是否查看中标信息
-            }
+            },
+            portrait:'winner'
         }
     },
     created: function () {
@@ -498,6 +499,7 @@ var vNode = {
                                 _this.entInfo.followSearchFinish = true
                                 _this.entInfo.entExist = false
                                 _this.getEntVisits()
+                                _this.portrait = 'winnerVip'
                             }
                             _this.singleTab = false
                         }

+ 1 - 1
src/jfw/modules/app/src/web/templates/big-member/page_ent_portrait.html

@@ -258,7 +258,7 @@
                     <vip-component @tabactive="tabActive" type="item_1" :entvisit="entvisit" imgurl='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/collection/image/bg/vip_ex_1.png'></vip-component>
                 </div>
                 <div class="bg-white tab-card cell-list history-list" v-if="conf._4 && tabActiveName == '2' && !getStatus">
-                    <hispro-component type="winner" :id="entInfo.id"></hispro-component>
+                    <hispro-component :type="portrait" :id="entInfo.id"></hispro-component>
                 </div>
                 <div class="vip_component" v-if="getStatus" style="height:11.36rem;background:url('/common-module/collection/image/bg/vip_bg_9.png') no-repeat;background-size:100% 100%">
                     <vip-component @tabactive="tabActive" type="item_9" :entvisit="entvisit" imgurl='{{Cdns .Host "seo" "cdn"|SafeUrl}}/common-module/collection/image/bg/vip_ex_9.png'></vip-component>

+ 26 - 26
src/jfw/modules/common/src/qfw/util/jy/subvipPortrait.go

@@ -32,9 +32,6 @@ func (this *BigVipBaseMsg) SubVipPortraitUsage(mysql *mysql.Mysql, entId string)
 }
 
 func (this *BigVipBaseMsg) isVisitEnt(mysql *mysql.Mysql, entId string) bool {
-	if this.VipStatus <= 0 || entId == "" {
-		return false
-	}
 	now := time.Now()
 	//浏览缓存
 	visitedCache := fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId)
@@ -54,37 +51,40 @@ func (this *BigVipBaseMsg) SubVipPortraitTimesCheck(mysql *mysql.Mysql, entId st
 	if this.VipStatus <= 0 || entId == "" {
 		return fmt.Errorf("非法请求")
 	}
-
+	fullCount, now := 0, time.Now()
 	//查询本月是否浏览过
 	if this.isVisitEnt(mysql, entId) {
 		return nil
 	}
 
-	fullCount, now := 0, time.Now()
-	if this.Vip_BuySet.AreaCount == -1 {
-		fullCount = 16 * OneAreaTimes //全国全国行业
-	} else {
-		fullCount = this.Vip_BuySet.AreaCount * OneAreaTimes
-	}
+	//并发控制
+	if redis.Incr(PowerCacheDb, fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId)) == 1 {
+		_ = redis.SetExpire(PowerCacheDb, fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId), 60*60*5)
+		if this.Vip_BuySet.AreaCount == -1 {
+			fullCount = 16 * OneAreaTimes //全国全国行业
+		} else {
+			fullCount = this.Vip_BuySet.AreaCount * OneAreaTimes
+		}
 
-	//校验本月次数是否使用完
-	useKey := fmt.Sprintf(PortraitRecordTimes, this.Uid, int(now.Month()))
+		//校验本月次数是否使用完
+		useKey := fmt.Sprintf(PortraitRecordTimes, this.Uid, int(now.Month()))
 
-	useCount := redis.GetInt(PowerCacheDb, useKey)
-	if useCount >= fullCount {
-		return fmt.Errorf("本月次数已使用完")
-	}
+		useCount := redis.GetInt(PowerCacheDb, useKey)
+		if useCount >= fullCount {
+			return fmt.Errorf("本月次数已使用完")
+		}
 
-	//新增使用记录
-	if mysql.Insert(PortraitRecordTable, map[string]interface{}{
-		"user_id":     this.Uid,
-		"ent_id":      entId,
-		"create_time": now.Format("2006-01-02 15:04:05"),
-	}) == 0 {
-		return fmt.Errorf("数据记录异常")
-	}
-	if redis.Incr(PowerCacheDb, useKey) == 1 {
-		_ = redis.SetExpire(PowerCacheDb, useKey, 24*60*60*31) //次数缓存一个月
+		//新增使用记录
+		if mysql.Insert(PortraitRecordTable, map[string]interface{}{
+			"user_id":     this.Uid,
+			"ent_id":      entId,
+			"create_time": now.Format("2006-01-02 15:04:05"),
+		}) == 0 {
+			return fmt.Errorf("数据记录异常")
+		}
+		if redis.Incr(PowerCacheDb, useKey) == 1 {
+			_ = redis.SetExpire(PowerCacheDb, useKey, 24*60*60*31) //次数缓存一个月
+		}
 	}
 	return nil
 }

+ 8 - 3
src/jfw/modules/weixin/src/github.com/wizjin/weixin/weixin.go

@@ -792,13 +792,18 @@ func (wx *Weixin) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 			log.Println("Weixin parse message failed:", err)
 			http.Error(w, "", http.StatusBadRequest)
 		} else {
-			if msg.Event == EventTemplateSent || msg.Event == EventView {
+			//update by wcj on 2021-07-29
+			//update before
+			/*if msg.Event == EventTemplateSent || msg.Event == EventView {
 				http.Error(w, "", http.StatusNotFound)
 			} else {
 				wx.routeRequest(w, &msg)
-			}
+			}*/
+			//update after
+			wx.routeRequest(w, &msg)
 		}
 	}
+	w.Write([]byte("success")) //add by wcj on 2021-07-30
 	return
 }
 
@@ -819,7 +824,7 @@ func (wx *Weixin) routeRequest(w http.ResponseWriter, r *Request) {
 		route.handler(writer, r)
 		return
 	}
-	http.Error(w, "", http.StatusNotFound)
+	//http.Error(w, "", http.StatusNotFound)
 	return
 }
 

+ 13 - 3
src/jfw/modules/weixin/src/wx/wx.go

@@ -109,10 +109,20 @@ func MenuClickHandler(w ResponseWriter, r *Request) {
 	clickButtonKey := r.EventKey
 	if replyText, ok := menuClickReplyTextMap[clickButtonKey]; ok {
 		w.PostText(replyText)
-		//二维码
-		mediaId, err := w.UploadMediaFromFile("image", tools.BusinessCoop)
+		CBKey := fmt.Sprintf("%s_%d", clickButtonKey, time.Now().Day())
+		mediaId := redis.GetStr("other", CBKey)
+		if mediaId == "" {
+			//二维码
+			_mediaId, err := w.UploadMediaFromFile("image", tools.BusinessCoop)
+			if _mediaId != "" && err == nil {
+				mediaId = _mediaId
+			}
+		}
 		// log.Println(mediaId, "--", err, "--", tools.BusinessCoop)
-		if mediaId != "" && err == nil {
+		if mediaId != "" {
+			go func() {
+				redis.Put("other", CBKey, mediaId, 24*60*60)
+			}()
 			w.PostImage(mediaId)
 		}
 	}

+ 3 - 1
src/web/staticres/common-module/collection/js/ent_portrait.js

@@ -116,7 +116,8 @@ var vNode = {
                 usage: 0, // 本月已使用次数
                 provin: 0, // 购买省份数量
                 visited: false // 是否查看中标信息
-            }
+            },
+            portrait:'winner'
         }
     },
     created: function () {
@@ -497,6 +498,7 @@ var vNode = {
                                 _this.entInfo.followSearchFinish = true
                                 _this.entInfo.entExist = false
                                 _this.getEntVisits()
+                                _this.portrait = 'winnerVip'
                             }
                             _this.singleTab = false
                         }

+ 4 - 1
src/web/staticres/common-module/collection/js/history-project.js

@@ -83,9 +83,12 @@ var hisproComponent = {
       if(this.type == 'winner') {
         item.url = '/bigmember/portrait/winner/contacts'
         item.datas.entId = this.id
-      } else {
+      } else if(this.type == 'buyer') {
         item.url = '/bigmember/portrait/buyer/contacts'
         item.datas.buyer = this.buyer
+      } else {
+        loading.clear()
+        return
       }
       $.ajax({
         type: "POST",

+ 1 - 1
src/web/templates/frontRouter/wx/collection/sess/ent_portrait.html

@@ -263,7 +263,7 @@
                     <vip-component @tabactive="tabActive" type="item_1" :entvisit="entvisit" imgurl='{{Msg "seo" "cdn"}}/common-module/collection/image/bg/vip_ex_1.png'></vip-component>
                 </div>
                 <div class="bg-white tab-card cell-list history-list" v-if="conf._4 && tabActiveName == '2' && !getStatus">
-                    <hispro-component type="winner" :id="entInfo.id"></hispro-component>
+                    <hispro-component :type="portrait" :id="entInfo.id"></hispro-component>
                 </div>
                 <div class="vip_component" v-if="getStatus" style="height:11.36rem;background:url('/common-module/collection/image/bg/vip_bg_9.png') no-repeat;background-size:100% 100%">
                     <vip-component @tabactive="tabActive" type="item_9" :entvisit="entvisit" imgurl='{{Msg "seo" "cdn"}}/common-module/collection/image/bg/vip_ex_9.png'></vip-component>