Kaynağa Gözat

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

TANGSHIZHE 4 yıl önce
ebeveyn
işleme
9397de2044

+ 35 - 5
src/jfw/modules/app/src/web/templates/weixin/search/mainSearch.html

@@ -1,5 +1,40 @@
 <html>
 <head>
+    <script>
+        try {
+            window.onlyUserID = {{session "userId"}}
+        } catch (e) {
+            console.log('获取ID失败')
+        }
+        function clearOtherUserLocalStorage () {
+            var readUserID = JSON.parse(localStorage.getItem('big_member_full_video_play_reads') || '[]')
+            if (readUserID.length) {
+                try {
+                    var oCookie = window.onlyUserID || null
+                    var isUserNext = readUserID.indexOf(oCookie) === -1
+                    if (isUserNext) {
+                        localStorage.removeItem('big_member_full_video_play')
+                    } else {
+                        localStorage.setItem('big_member_full_video_play', 'true')
+                    }
+                } catch (e) {
+                    console.log('cookie 获取失败02')
+                }
+            } else {
+                localStorage.removeItem('big_member_full_video_play')
+            }
+        }
+        clearOtherUserLocalStorage()
+        if (localStorage.getItem('big_member_full_video_play')) {
+            console.log('已经播放')
+        } else {
+          console.log('应该跳转')
+          window.onload = function () {
+            history.pushState({state: 'full'}, null)
+            location.href = '/jyapp/big/page/full'
+          }
+        }
+    </script>
     {{include "/common/meta.html"}}
     <!--S-当前页必定需要预加载的资源-->
     <link rel="preload" as="script" href='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/local/swiper.min.js' />
@@ -24,11 +59,6 @@
     {{include "/common/js.html"}}
     <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/local/dropload.js'></script>
     <title>搜索</title>
-    <script>
-        try{
-            JyObj.hiddenBottom("1");
-        }catch(e){}
-    </script>
 </head>
 <body class="p13" id="home_main" data-weui-theme="light">
 <style>

+ 8 - 3
src/jfw/modules/bigmember/src/service/portrait/subvipPortraitAction.go

@@ -135,12 +135,17 @@ func (this *SubVipPortrait) PortraitUsage() {
 		if bigMsg.VipStatus <= 0 && bigMsg.Vip_BuySet.Upgrade != 1 {
 			return nil, fmt.Errorf("非法请求")
 		}
-		total, usage := bigMsg.SubVipPortraitUsage()
-		return map[string]interface{}{
+		entId := util.DecodeId(this.GetString("entId"))
+		total, usage, isUsed := bigMsg.SubVipPortraitUsage(db.Mysql, entId)
+		returnMap := map[string]interface{}{
 			"total":  total,
 			"usage":  usage,
 			"provin": bigMsg.Vip_BuySet.AreaCount,
-		}, nil
+		}
+		if entId != "" {
+			returnMap["visited"] = isUsed
+		}
+		return returnMap, nil
 	}()
 	if errMsg != nil {
 		log.Printf("%s SubVipPortrait-portraitUsage 企业画像浏览量查询出错:%s\n", userId, errMsg.Error())

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

@@ -15,7 +15,7 @@ const (
 	PortraitRecordTable = "portrait_record"
 )
 
-func (this *BigVipBaseMsg) SubVipPortraitUsage() (fullCount, usage int) {
+func (this *BigVipBaseMsg) SubVipPortraitUsage(mysql *mysql.Mysql, entId string) (fullCount, usage int, visited bool) {
 	if this.VipStatus <= 0 {
 		return
 	}
@@ -25,49 +25,67 @@ func (this *BigVipBaseMsg) SubVipPortraitUsage() (fullCount, usage int) {
 		fullCount = this.Vip_BuySet.AreaCount * OneAreaTimes
 	}
 	usage = redis.GetInt(PowerCacheDb, fmt.Sprintf(PortraitRecordTimes, this.Uid, int(time.Now().Month())))
+	if mysql != nil && entId != "" {
+		visited = this.isVisitEnt(mysql, entId)
+	}
 	return
 }
 
+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)
+	//本月有浏览记录
+	if exists, err := redis.Exists(PowerCacheDb, visitedCache); err == nil && exists {
+		return true
+	}
+	if mysql.CountBySql(fmt.Sprintf("select count(id) from %s where user_id =? and ent_id =? and year(create_time)=? and month(create_time)=?",
+		PortraitRecordTable), this.Uid, entId, now.Year(), int(now.Month())) == 0 {
+		return false
+	}
+	redis.Put(PowerCacheDb, fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId), 1, 60*60*5)
+	return true
+}
+
 func (this *BigVipBaseMsg) SubVipPortraitTimesCheck(mysql *mysql.Mysql, entId string) error {
 	if this.VipStatus <= 0 || entId == "" {
 		return fmt.Errorf("非法请求")
 	}
+
+	//查询本月是否浏览过
+	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
 	}
-	//浏览缓存
-	visitedCache := fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId)
-	//本月有浏览记录
-	if exists, err := redis.Exists(PowerCacheDb, visitedCache); err == nil && exists {
-		return nil
-	}
 
-	if mysql.CountBySql(fmt.Sprintf("select count(id) from %s where user_id =? and ent_id =? and year(create_time)=? and month(create_time)=?",
-		PortraitRecordTable), this.Uid, entId, now.Year(), int(now.Month())) == 0 {
-		//校验本月次数是否使用完
-		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) //次数缓存一个月
 	}
-	redis.Put(PowerCacheDb, fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId), 1, 60*60*5)
 	return nil
 }
 

+ 18 - 14
src/web/staticres/frontRouter/pc/seeHistory/js/index-pc.js

@@ -40,15 +40,12 @@ var vm = new Vue({
             points: [],
             statusEnum: ['存续', '吊销', '注销', '撤销'],
             statusColors: ['#2CB7CA', '#F5AF5C', '#58A1E7', '#51CEA2'],
-            listInfo: {
-                value: '',
-                pageNum: 0,
-                pageSize: 10,
-                total: -1,
-                loading: true,
-                finished: false
-            },
-            seeList: []
+            seeList: {
+                pageNum: 1, // 当前页
+                pageSize: 50, // 每页多少条数据
+                total: 0, // 总页数
+                list: [] // 返回的数据
+            }
         }
     },
     created() {
@@ -77,8 +74,8 @@ var vm = new Vue({
             return {
                 year: this.years,
                 month: this.months,
-                pageSize: this.listInfo.pageSize,
-                pageNum: this.listInfo.pageNum
+                pageSize: this.seeList.pageSize,
+                pageNum: this.seeList.pageNum
             }
         },
         subRecord() {
@@ -91,6 +88,9 @@ var vm = new Vue({
             }).done(res => {
                 var _this = this
                 if (res.error_code == 0 && res.data.list) {
+                    if (res.data.count) {
+                        this.listState.total = res.data.count
+                    }
                     res.data.list.forEach(v => {
                         const arrs = {
                             name: v.company_name,
@@ -106,16 +106,20 @@ var vm = new Vue({
                             statusWord: v.company_status,
                             checked: false
                         }
-                        this.seeList.push(arrs)
+                        this.seeList.list.push(arrs)
                     })
                 }
             })
         },
+        onPageChange(page) {
+            this.seeList.pageNum = page
+            this.subRecord()
+        },
         dateHandler(val) {
             this.years = val.getFullYear()
             this.months = val.getMonth() + 1
-            this.listInfo.pageNum = 0
-            this.seeList = []
+            this.seeList.pageNum = 0
+            this.seeList.list = []
             this.subRecord()
         },
         detailed(ids) {

+ 7 - 1
src/web/staticres/js/ent-search-index-pc.js

@@ -504,7 +504,13 @@ var vm = new Vue({
             $('#go-customer-4').trigger('click')
         },
         toDetail: function (id) {
-            window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + id)
+            if (this.powerInfo.vip > 1) {
+                // 去超级订阅画像
+                window.open('/swordfish/page_big_pc/svip/ent_ser_portrait/' + id)
+            } else {
+                // 去大会员画像
+                window.open('/swordfish/page_big_pc/ent_portrait/' + id)
+            }
         },
         calcListItemForCap: function (p) {
             if (p) {

+ 11 - 0
src/web/templates/frontRouter/pc/seeHistory/sess/index.html

@@ -59,6 +59,17 @@
                     <div class="cont-tips di-zhi">地址:<span>{item.address}</span></div>
                 </div>
             </div>
+            <div class="el-pagination-container">
+                <el-pagination
+                    background
+                    layout="prev, pager, next, ->"
+                    :hide-on-single-page="true"
+                    :current-page="seeList.pageNum"
+                    :page-size="seeList.pageSize"
+                    :total="seeList.total"
+                    @current-change="onPageChange"
+                ></el-pagination>
+            </div>
         </div>
         <div class="no-data" v-show="seeList.length === 0"><el-image src="/images/pc_12.png"></el-image><div class="tip-text"><p>暂无数据</p></div></div>
     </section>