浏览代码

Merge branch 'dev4.5' of http://192.168.3.207:8080/qmx/jy into dev4.5

zhangyuhan 4 年之前
父节点
当前提交
7c88b2169b

+ 73 - 0
src/jfw/front/jylog.go

@@ -0,0 +1,73 @@
+package front
+
+/**
+日志文件自动切换,默认保留15天内日志
+**/
+
+import (
+	"log"
+	"os"
+	"path/filepath"
+	"regexp"
+	"time"
+
+	"github.com/go-xweb/xweb"
+	"github.com/robfig/cron"
+)
+
+//日志格式
+var fileReg = regexp.MustCompile("^(\\d{4}_[0-9_]{14})\\.log$")
+
+//当前日志文件句柄
+var LogFile *os.File
+
+//时间格式
+var FMT = "2006_01_02_15_04_05"
+
+//日志目录
+var LogPath = "./jylog"
+
+func init() {
+	os.Mkdir(LogPath, os.ModePerm)
+	//默认保留15天内的日志,-1为永久保留
+	initLog(15)
+}
+
+func initLog(saveDay int) {
+	go logfile()
+	task := cron.New()
+	task.Start()
+	task.AddFunc("0 0 0 * * ?", func() {
+		go logfile()
+		time.Sleep(50 * time.Second)
+		if saveDay > 0 {
+			filepath.Walk(LogPath, func(path string, info os.FileInfo, err error) error {
+				str := fileReg.FindStringSubmatch(info.Name())
+				if len(str) == 2 {
+					t, er := time.ParseInLocation(FMT, str[1], time.Local)
+					if er == nil {
+						if (time.Now().Unix()-t.Unix())/86400 > int64(saveDay) {
+							log.Println("delete log file:", path, os.Remove(path))
+						}
+					}
+				}
+				return nil
+			})
+		}
+	})
+}
+
+//创建并切换输出文件
+func logfile() {
+	now := time.Now().Format(FMT)
+	file, _ := os.Create(LogPath + "/" + now + ".log")
+	log.SetOutput(file)
+	xweb.RootApp().Logger.SetOutput(file)
+	go func(file *os.File) {
+		time.Sleep(5 * time.Second)
+		if LogFile != nil {
+			LogFile.Close()
+		}
+		LogFile = file
+	}(file)
+}

+ 4 - 3
src/jfw/modules/common/src/qfw/util/jy/subscribepush.go

@@ -180,6 +180,7 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, result
 		spqp.PageNum = 1
 	}
 	starttime, endtime := int64(0), int64(0)
+	st, et := "", ""
 	now := time.Now()
 	if spqp.SelectTime == "lately-7" { //最近7天
 		starttime = time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local).Unix()
@@ -189,9 +190,9 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, result
 		starttime = time.Date(now.Year()-1, 1, 1, 0, 0, 0, 0, time.Local).Unix()
 		endtime = time.Date(now.Year()-1, 12, 31, 23, 59, 59, 0, time.Local).Unix()
 	} else if len(strings.Split(spqp.SelectTime, "_")) == 2 {
-		st := strings.Split(spqp.SelectTime, "_")[0]
+		st = strings.Split(spqp.SelectTime, "_")[0]
 		starttime, _ = strconv.ParseInt(st, 0, 64)
-		et := strings.Split(spqp.SelectTime, "_")[1]
+		et = strings.Split(spqp.SelectTime, "_")[1]
 		endtime, _ = strconv.ParseInt(et, 0, 64)
 		if endtime > 0 {
 			etTime := time.Unix(endtime, 0)
@@ -202,7 +203,7 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, result
 	start := (spqp.PageNum - 1) * pageSize
 	end := start + pageSize
 	//时间是今天,没有别的过滤条件
-	if starttime > 0 && starttime == endtime && nowFormat == FormatDateByInt64(&starttime, Date_Short_Layout) && spqp.Area == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" {
+	if starttime > 0 && st == et && nowFormat == FormatDateByInt64(&starttime, Date_Short_Layout) && spqp.Area == "" && spqp.Buyerclass == "" && spqp.Subscopeclass == "" && spqp.Subtype == "" && spqp.Key == "" {
 		subPush, err := s.GetTodayCache(spqp.UserId)
 		if err != nil {
 			log.Println(spqp.UserId, "GetTodayCache Error", err)

+ 4 - 3
src/jfw/modules/publicapply/src/bidcollection.json

@@ -1,6 +1,7 @@
 {
-    "payUserCollLimit":10,
+    "payUserCollLimit":5000,
     "freeUserCollLimit":100,
-    "pageSize":10,
-    "labelMaxCount":2
+    "pageSize":50,
+    "labelMaxCount":50,
+    "freeCollRedisKey":"other"
 }

+ 31 - 7
src/jfw/modules/publicapply/src/bidcollection/entity/entity.go

@@ -101,7 +101,9 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
 	ok, msg := true, ""
 	var wg sync.WaitGroup
 	maxCount := config.BidCollConfig.FreeUserCollLimit
-	isPay := Power(userid)
+	isPay, _ := Power(userid)
+	redisCollKey := fmt.Sprintf("coll_%s", userid)
+	redisArr := []string{}
 	if isPay {
 		maxCount = config.BidCollConfig.PayUserCollLimit
 	}
@@ -139,6 +141,9 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
 							"createdate": qu.FormatDateByInt64(&now, qu.Date_Full_Layout),
 						}
 						if it := db.Mysql.Insert(db.DbConf.Bdcollection, inserMap); it > 0 {
+							if !isPay {
+								redisArr = append(redisArr, util.DecodeId(bd.Bid))
+							}
 							i++
 							collCount++
 						} else {
@@ -153,6 +158,12 @@ func BidCollOrRemByIds(bidAction BidAction, userid string) map[string]interface{
 		}(v)
 	}
 	wg.Wait()
+	if len(redisArr) > 0 {
+		// coll := redis.Get(config.BidCollConfig.FreeCollRedisKey, redisCollKey).([]string)
+		// ar := append(redisArr, coll)
+		// redis.Put(config.BidCollConfig.FreeCollRedisKey, ar)
+		log.Println(redisCollKey)
+	}
 	m := map[string]interface{}{
 		"status": qu.If(ok, i <= len(bidAction.Binfo), ok),
 		"msg":    msg,
@@ -231,7 +242,7 @@ func LabelAction(labInfo *LabelInfo, userid string) map[string]interface{} {
 		//收藏招标信息
 		if labInfo.Lids != "" && len(labInfo.Binfo) > 0 {
 			maxCount := config.BidCollConfig.FreeUserCollLimit
-			isPay := Power(userid)
+			isPay, _ := Power(userid)
 			if isPay {
 				maxCount = config.BidCollConfig.PayUserCollLimit
 			}
@@ -326,7 +337,7 @@ func GetCollList(c *CollList, userid string) map[string]interface{} {
 		"pageSize":     pagesize_max,
 	}
 	sql := fmt.Sprintf(`select bid from %s where userid ='%s'`, db.DbConf.Bdcollection, userid)
-	isPay := Power(userid)
+	isPay, _ := Power(userid)
 	limit := config.BidCollConfig.FreeUserCollLimit
 	if isPay {
 		now := time.Now()
@@ -435,15 +446,24 @@ func GetCollList(c *CollList, userid string) map[string]interface{} {
 }
 
 //是否是付费用户 -bool: true:是 fasle:不是
-func Power(userid string) bool {
+func Power(userid string) (bool, map[string]interface{}) {
 	isVip, isMember, isEnt := false, false, false
+	vipstatus := 0
 	phone := ""
-	data, ok := db.Mgo.FindById("user", userid, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1`)
+	data, ok := db.Mgo.FindById("user", userid, `"i_member_status":1,"i_vip_status":1,"s_m_phone":1,"s_phone":1,"o_vipjy":1`)
 	if data != nil && len(*data) > 0 && ok {
 		i_vip_status := qu.IntAll((*data)["i_vip_status"])
-		if i_vip_status > 0 {
+		if i_vip_status > 1 {
+			vipstatus = 1
 			isVip = true
 		}
+		ovipjy, _ := (*data)["o_vipjy"].(map[string]interface{})
+		if ovipjy["o_buyset"] != nil {
+			o_buyset := ovipjy["o_buyset"].(map[string]interface{})
+			if o_buyset["upgrade"] != nil && isVip {
+				vipstatus = 2
+			}
+		}
 		if i_member_status := qu.IntAllDef((*data)["i_member_status"], 0); i_member_status > 0 {
 			isMember = true
 		}
@@ -458,7 +478,11 @@ func Power(userid string) bool {
 			}
 		}
 	}
-	return isVip || isEnt || isMember
+	return isVip || isEnt || isMember, map[string]interface{}{
+		"vip":      vipstatus,
+		"member":   isMember,
+		"entniche": isEnt,
+	}
 }
 
 type InfoList struct {

+ 3 - 3
src/jfw/modules/publicapply/src/bidcollection/service/service.go

@@ -128,11 +128,11 @@ func (this *ServiceStruct) Power() {
 	defer qu.Catch()
 	userId, _ := this.GetSession("userId").(string)
 	r := func() Result {
-		ispay, msg := false, ""
+		m, msg := map[string]interface{}{}, ""
 		if userId != "" {
-			ispay = entity.Power(userId)
+			_, m = entity.Power(userId)
 		}
-		return Result{Data: ispay, Error_msg: msg}
+		return Result{Data: m, Error_msg: msg}
 	}()
 	this.ServeJson(r)
 }

+ 1 - 0
src/jfw/modules/publicapply/src/config/config.go

@@ -19,6 +19,7 @@ type BidColl struct {
 	FreeUserCollLimit int
 	Pagesize          int
 	LabelMaxCount     int
+	FreeCollRedisKey  string
 }
 
 var Config *config

+ 2 - 2
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -340,7 +340,7 @@ func TimeProcessing(hour interface{}, duration int) time.Time {
 	return t
 }
 
-//cycleunit(1:年 2:月 3:季)
+//cycleunit(1:年 2:月 3:季)
 //cyclecount 数字长度
 func checkReqDate(dateStr string) (cyclecount, cycleunit int, err error) {
 	if strings.HasSuffix(dateStr, "年") {
@@ -353,7 +353,7 @@ func checkReqDate(dateStr string) (cyclecount, cycleunit int, err error) {
 		return
 	} else if strings.HasSuffix(dateStr, "季") {
 		cycleunit = 3
-		dateStr = strings.Replace(dateStr, "", "", -1)
+		dateStr = strings.Replace(dateStr, "季", "", -1)
 		cyclecount, err = strconv.Atoi(strings.Trim(dateStr, " "))
 		if cyclecount > 12 && err == nil {
 			err = errors.New(fmt.Sprintf("日期%s范围超出最大值", dateStr))

+ 0 - 39
src/web/staticres/collection/css/index-pc.css → src/web/staticres/frontRouter/pc/collection/css/index-pc.css

@@ -243,42 +243,3 @@
 .tag-drawer .el-tag {
     margin: 6px;
 }
-
-.j-t-button {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-    padding: 7px 50px;
-    font-size: 16px;
-    color: #686868;
-    border: 1px solid #e0e0e0;
-    border-radius: 7px;
-    background-color: #fff;
-}
-.j-t-button.confirm {
-    color: #2cb7ca;
-    border-color: #2cb7ca;
-}
-.j-t-button.confirm:hover {
-    color: #fff;
-    background-color: #2cb7ca;
-}
-.j-t-button.cancel {
-    margin-left: 40px;
-}
-.j-el-confirm .el-dialog__header,
-.j-el-confirm .el-dialog__body,
-.j-el-confirm .el-dialog__footer {
-    text-align: center;
-}
-.j-el-confirm .el-dialog__header {
-    padding-top: 30px;
-}
-.j-el-confirm .el-dialog__footer {
-    padding-bottom: 40px;
-}
-.dialog-footer {
-    display: flex;
-    align-items: center;
-    justify-content: center;
-}

+ 2 - 0
src/web/staticres/collection/js/index-pc.js → src/web/staticres/frontRouter/pc/collection/js/index-pc.js

@@ -11,6 +11,7 @@ var vm = new Vue({
     data: function () {
         return {
             power: false,
+            powerLoaded: false,
             toast: {
                 show: false,
                 content: '暂无数据'
@@ -82,6 +83,7 @@ var vm = new Vue({
                     }
                 }.bind(this),
                 complete: function () {
+                    this.powerLoaded = true
                     callback && callback()
                 }.bind(this)
             })

+ 5 - 0
src/web/staticres/js/selector/price-pc.js

@@ -38,6 +38,11 @@ var priceComponent = {
             this.price.max = max
         },
         getState: function () {
+            if (this.price.min > this.price.max) {
+                var max = this.price.max
+                this.price.max = this.price.min
+                this.price.min = max
+            }
             return this.price
         },
         confirm: function () {

+ 6 - 6
src/web/templates/frontRouter/pc/collection/sess/index.html

@@ -18,7 +18,7 @@
         <link href="//cdn.jsdelivr.net/npm/element-ui@2.13.2/lib/theme-chalk/index.css" rel="stylesheet" />
         <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/css/ele-reset.css?v={{Msg "seo" "version"}}'>
         <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/css/selector/selector.css?v={{Msg "seo" "version"}}'>
-        <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/collection/css/index-pc.css?v={{Msg "seo" "version"}}'>
+        <link rel="stylesheet" href='{{Msg "seo" "cdn"}}/frontRouter/pc/collection/css/index-pc.css?v={{Msg "seo" "version"}}'>
         <style>
             .collection-container {
                 line-height: 1;
@@ -34,7 +34,7 @@
         <div class="collection-header w">
             <h3 class="tab-title">标讯收藏</h3>
         </div>
-        <div class="search-content w" v-cloak>
+        <div class="search-content w" v-cloak v-show="powerLoaded">
             <div class="selector-card-container search-filters" v-if="power">
                 <div class="selector-card">
                     <div class="selector-card-header">个人标签:</div>
@@ -117,7 +117,7 @@
                 </div>
             </div>
             <div class="collect-list-container">
-                <div class="collect-list-header">
+                <div class="collect-list-header" v-show="listState.list.length !== 0 && listState.loaded">
                     <div class="c-tab-container flex">
                         <div class="left flex">
                             <el-checkbox v-model="currentPageAllChecked" @change="allCheckboxChange"></el-checkbox>
@@ -166,7 +166,7 @@
                     </div>
                     <div class="list collect-table-list" v-loading="listState.loading" v-show="listState.listType === 'table'" style="display: none;">
                         <table class="table">
-                            <thead class="thead">
+                            <thead class="thead" v-show="listState.list.length !== 0">
                                 <tr>
                                     <td width="48">序号</td>
                                     <td width="315" class="deep-border">项目名称</td>
@@ -241,7 +241,7 @@
                 width="30%">
                 <span>确定删除该标签?</span>
                 <span slot="footer" class="dialog-footer">
-                    <button class="j-t-button confirm" @click="delThisTagConfirm">确 定</el-button>
+                    <button class="j-t-button confirm active" @click="delThisTagConfirm">确 定</el-button>
                     <button class="j-t-button cancel" @click="tagDrawer.dialogShow=false">取 消</button>
                 </span>
             </el-dialog>
@@ -264,7 +264,7 @@
     <script src='{{Msg "seo" "cdn"}}/js/selector/select-level2-pc.js?v={{Msg "seo" "version"}}'></script>
     <script src='{{Msg "seo" "cdn"}}/js/selector/article-item-pc.js?v={{Msg "seo" "version"}}'></script>
     <script src='{{Msg "seo" "cdn"}}/js/selector/no-data-pc.js?v={{Msg "seo" "version"}}'></script>
-    <script src='{{Msg "seo" "cdn"}}/collection/js/index-pc.js?v={{Msg "seo" "version"}}'></script>
+    <script src='{{Msg "seo" "cdn"}}/frontRouter/pc/collection/js/index-pc.js?v={{Msg "seo" "version"}}'></script>
 </body>
 
 </html>