Ver código fonte

Merge branch 'feature/v4.9.33' of https://jygit.jydev.jianyu360.cn/qmx/jy into dev/v4.9.33_wmh

wenmenghao321 1 ano atrás
pai
commit
f01da43bfe

+ 8 - 4
src/config.json

@@ -469,19 +469,23 @@
   "indexDocClass": [
     {
       "class": "招标文件",
-      "search": "招标文件"
+      "search": "招标文件",
+      "code": "02"
     },
     {
       "class": "办公文档",
-      "search": "招标投标"
+      "search": "招标投标",
+      "code": "07"
     },
     {
       "class": "行业报告",
-      "search": "行业报告"
+      "search": "行业报告",
+      "code": "03"
     },
     {
       "class": "建筑/环境",
-      "search": "建筑/环境"
+      "search": "建筑/环境",
+      "code": "16"
     }
   ]
 }

+ 9 - 0
src/db.json

@@ -57,6 +57,15 @@
       "password": "",
       "esIndex": "bidding",
       "esType": "bidding"
+    },
+    "doc": {
+      "address": "http://192.168.3.242:9200",
+      "size": 30,
+      "version": "v7",
+      "userName": "elastic",
+      "password": "elastic",
+      "esIndex": "jydoc",
+      "esType": "jydoc"
     }
   },
   "redis": {

+ 66 - 27
src/jfw/front/index.go

@@ -301,7 +301,46 @@ func GetDocsData() (docClass []string, indexDocs [][]map[string]interface{}) {
 	//浏览量前十的一级分类
 	docClassNames := config.Sysconfig["indexDocClass"].([]interface{})
 	if docClassNames != nil && len(docClassNames) > 0 {
-		docSql := `SELECT d.id,d.docName,d.docFileSuffix,d.docTags,d.previewImgId,d.productType,d.source FROM jydocs.doc d LEFT JOIN jydocs.doc_statistics ds ON d.id=ds.docId WHERE FIND_IN_SET(?,d.docTags) ORDER BY ds.viewTimes DESC LIMIT 10 `
+		indexDoc := []map[string]interface{}{}
+		//docSql := `SELECT d.id,d.docName,d.docFileSuffix,d.docTags,d.previewImgId,d.productType,d.source FROM jydocs.doc d LEFT JOIN jydocs.doc_statistics ds ON d.id=ds.docId WHERE FIND_IN_SET(?,d.docTags) ORDER BY ds.viewTimes DESC LIMIT 10 `
+		var docFormatFunc = func(docs *[]map[string]interface{}) {
+			for dock, docv := range *docs {
+				if dock > 7 {
+					break
+				}
+				previewImg := fmt.Sprintf(ossUrl, common.InterfaceToStr(docv["previewImgId"]))
+				if common.IntAll(docv["source"]) == 2 {
+					previewImg = fmt.Sprintf(docinUrl, common.InterfaceToStr(docv["previewImgId"]))
+				}
+				fileSuffix := common.InterfaceToStr(docv["docFileSuffix"])
+				//文件类型,1 doc 2 pdf 3 xls 4 ppt 5 txt 6 其他
+				docFileType := common.IntAll(docv["docFileType"])
+				switch docFileType {
+				case 1:
+					fileSuffix = "doc"
+				case 2:
+					fileSuffix = "pdf"
+				case 3:
+					fileSuffix = "xls"
+				case 4:
+					fileSuffix = "ppt"
+				case 5:
+					fileSuffix = "txt"
+				default:
+					fileSuffix = "其他"
+				}
+				//if strings.HasPrefix(fileSuffix, ".") {
+				//	fileSuffix = strings.ReplaceAll(fileSuffix, ".", "")
+				//}
+				indexDoc = append(indexDoc, map[string]interface{}{
+					"id":            common.InterfaceToStr(docv["id"]),
+					"docName":       common.InterfaceToStr(docv["docName"]),
+					"docFileSuffix": fileSuffix,
+					"previewImg":    previewImg,
+					"productType":   common.IntAll(docv["productType"]),
+				})
+			}
+		}
 		for _, dv := range docClassNames {
 			tmpClass := common.ObjToMap(dv)
 			if tmpClass == nil {
@@ -309,33 +348,34 @@ func GetDocsData() (docClass []string, indexDocs [][]map[string]interface{}) {
 			}
 			name := common.InterfaceToStr((*tmpClass)["class"])
 			search := common.InterfaceToStr((*tmpClass)["search"])
-			indexDoc := []map[string]interface{}{}
-			docs := public.BaseMysql.SelectBySql(docSql, search)
-			if docs != nil && len(*docs) > 0 {
-				for dock, docv := range *docs {
-					if dock > 7 {
-						break
-					}
-					previewImg := fmt.Sprintf(ossUrl, common.InterfaceToStr(docv["previewImgId"]))
-					if common.IntAll(docv["source"]) == 2 {
-						previewImg = fmt.Sprintf(docinUrl, common.InterfaceToStr(docv["previewImgId"]))
-					}
-					fileSuffix := common.InterfaceToStr(docv["docFileSuffix"])
-					if strings.HasPrefix(fileSuffix, ".") {
-						fileSuffix = strings.ReplaceAll(fileSuffix, ".", "")
-					}
-					indexDoc = append(indexDoc, map[string]interface{}{
-						"id":            common.InterfaceToStr(docv["id"]),
-						"docName":       common.InterfaceToStr(docv["docName"]),
-						"docFileSuffix": fileSuffix,
-						"previewImg":    previewImg,
-						"productType":   common.IntAll(docv["productType"]),
-					})
+			code := common.InterfaceToStr((*tmpClass)["code"])
+			//2.0 推荐表数据
+			var docByTidb = func() {
+				docSql := fmt.Sprintf(`SELECT d.id, d.docName, d.docFileType, d.docFileSuffix, d.previewImgId, d.productType, d.source FROM jydocs.doc d LEFT JOIN jydocs.doc_recommend dr ON d.id = dr.doc_id WHERE dr.region_state = 1  AND dr.doc_class_code = '%s'  ORDER BY dr.create_date DESC;`, code)
+				docs := public.BaseMysql.SelectBySql(docSql)
+				if docs != nil && len(*docs) > 0 {
+					docFormatFunc(docs)
 				}
 			}
-			docClass = append(docClass, name)
-			indexDocs = append(indexDocs, indexDoc)
-
+			docByTidb()
+			//1.0 查es
+			var docByEs = func() {
+				query := fmt.Sprintf(`{"query":{"bool":{"must":[{"term":{"docTags":"%s"}}]}},"size":10,"sort":[{"viewTimes":"desc"}]}`, search)
+				docs := public.Doc.Get("jydoc", "jydoc", query)
+				//docs := public.BaseMysql.SelectBySql(docSql, search)
+				if docs != nil && len(*docs) > 0 {
+					docFormatFunc(docs)
+				}
+			}
+			if len(indexDoc) == 0 {
+				docByEs()
+			}
+			if len(indexDoc) > 0 {
+				docClass = append(docClass, name)
+				indexDocs = append(indexDocs, indexDoc)
+				//
+				indexDoc = []map[string]interface{}{}
+			}
 		}
 	}
 	if len(indexDocs) > 0 {
@@ -352,7 +392,6 @@ func GetDocsData() (docClass []string, indexDocs [][]map[string]interface{}) {
 			}
 		}
 	}
-	fmt.Println(indexDocs)
 	return
 }
 

+ 1 - 1
src/jfw/modules/app/src/db.json

@@ -40,7 +40,7 @@
     },
   "redis": {
     "main":{
-      "address": "other=192.168.3.149:1712,sso=192.168.3.149:1713,push=192.168.3.149:1711,session=192.168.3.149:1713,merge=192.168.3.149:1712,grayupdate=192.168.3.206:1712,newother=192.168.3.149:1712,seoCache=192.168.3.149:1712,limitation=192.168.3.149:1713"
+      "address": "other=192.168.3.149:1712,sso=192.168.3.149:1713,push=192.168.3.149:1711,session=192.168.3.149:1713,merge=192.168.3.149:1712,grayupdate=192.168.3.206:1712,newother=192.168.3.149:1712,seoCache=192.168.3.149:1712,limitation=192.168.3.149:1713,poly=192.168.3.149:1713"
     }
     },
     "mysql": {

+ 1 - 1
src/jfw/modules/bigmember/src/db.json

@@ -45,7 +45,7 @@
   },
   "redis": {
     "main":{
-      "address": "other=192.168.3.149:1712,session=192.168.3.149:1713,push=192.168.3.149:1712,pushcache_1=192.168.3.149:5000,pushcache_2_a=192.168.3.149:5001,pushcache_2_b=192.168.3.149:5002,newother=192.168.3.149:1712"
+      "address": "other=192.168.3.149:1712,session=192.168.3.149:1713,push=192.168.3.149:1712,pushcache_1=192.168.3.149:5000,pushcache_2_a=192.168.3.149:5001,pushcache_2_b=192.168.3.149:5002,newother=192.168.3.149:1712,poly=192.168.3.149:1713"
     }
   },
   "mysql": {

+ 13 - 0
src/jfw/modules/bigmember/src/entity/marketAnalysis/analysisPdf.go

@@ -8,6 +8,7 @@ import (
 	"app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
 	"fmt"
+	"github.com/gogf/gf/v2/util/gconv"
 	. "jy/src/jfw/modules/bigmember/src/config"
 	"jy/src/jfw/modules/bigmember/src/db"
 	"jy/src/jfw/modules/bigmember/src/entity"
@@ -71,6 +72,15 @@ func (this *AnalysisReportPdf) GetPdfDetail() {
 			log.Println("rid==", rid)
 			return nil, fmt.Errorf("未获取数据")
 		}
+		timeRangeMap := make(map[string]int64)
+		timeRange := gconv.String((*rData)["timeRange"])
+		timeRangeArr := strings.Split(timeRange, "_")
+		if len(timeRangeArr) == 2 {
+			start, _ := time.Parse(time.DateOnly, timeRangeArr[0])
+			end, _ := time.Parse(time.DateOnly, timeRangeArr[1])
+			timeRangeMap["start"] = start.Unix()
+			timeRangeMap["end"] = end.Unix()
+		}
 		rMap := make(map[string]interface{})
 		wait := &sync.WaitGroup{}
 		var lock sync.Mutex
@@ -167,6 +177,7 @@ func (this *AnalysisReportPdf) GetPdfDetail() {
 				lock.Unlock()
 			}()
 			wait.Wait()
+			rMap["timeRange"] = timeRangeMap
 		case "1": //中标
 			wait.Add(3)
 			go func() { //分析数据
@@ -230,8 +241,10 @@ func (this *AnalysisReportPdf) GetPdfDetail() {
 				}
 			}()
 			wait.Wait()
+
 		}
 		delete(*rData, "_id")
+		rMap["timeRange"] = timeRangeMap
 		rMap["analysis_condition"] = rData
 		return rMap, err
 	}()

+ 1 - 1
src/jfw/modules/subscribepay/src/config.json

@@ -32,7 +32,7 @@
     "userName": "admin",
     "password": "123456"
   },
-  "redisaddrs": "other=192.168.3.149:1712,session=192.168.3.149:1713,push=192.168.3.149:1712,newother=192.168.3.149:1712,limitation=192.168.3.149:1712",
+  "redisaddrs": "other=192.168.3.149:1712,session=192.168.3.149:1713,push=192.168.3.149:1712,newother=192.168.3.149:1712,limitation=192.168.3.149:1712,poly=192.168.3.149:1713",
   "elasticsearch": "http://192.168.3.149:9200",
   "elasticPoolSize": 30,
   "elasticVersion": "v7",

+ 18 - 1
src/jfw/modules/subscribepay/src/config.yaml

@@ -21,4 +21,21 @@ pdfCreateServer:
     winner: https://jybx2-webtest.jydev.jianyu360.com/page_big_pc/report/pdf/ent?pid=%s #企业画像报告
     buyer: https://jybx2-webtest.jydev.jianyu360.com/page_big_pc/report/pdf/prop?pid=%s #采购单位报告
     analysis: https://jybx2-webtest.jydev.jianyu360.com/page_big_pc/report/pdf/market?pid=%s #定制化分析报告
-
+pdfPackPrice:
+  企业中标分析报告下载包:
+    - num: 5
+      price: 49900
+    - num: 10
+      price: 79900
+    - num: 20
+      price: 138900
+  业主采购分析报告下载包:
+    - num: 5
+      price: 49900
+    - num: 10
+      price: 79900
+    - num: 20
+      price: 138900
+  市场分析定制报告下载包:
+    - num: 1
+      price: 199900

+ 3 - 14
src/jfw/modules/subscribepay/src/entity/commodity.go

@@ -935,20 +935,9 @@ func GetExtend(productCode int64, types string, id string) map[int64]map[string]
 		}
 	case PDFPACK_SOURCENAME:
 		data = map[string]interface{}{
-			"validityYear": 3,   //有效期限
-			"priceUnit":    "元", //价格单位  元/分...
-			"specsUnit":    "个", //产品单位  天/条..,
-		}
-		switch id {
-		case PDFPACK_WINNER:
-			data["originalPrice"] = 2000
-			data["discountPrice"] = 1000
-		case PDFPACK_BUYER:
-			data["originalPrice"] = 2000
-			data["discountPrice"] = 1000
-		case PDFPACK_MARKET:
-			data["originalPrice"] = 2000
-			data["discountPrice"] = 1000
+			"validityYear": 3, //有效期限
+			//"priceUnit":    "元", //价格单位  元/分...
+			"specsUnit": "个", //产品单位  天/条..,
 		}
 	}
 	retData := map[int64]map[string]interface{}{}

+ 27 - 16
src/jfw/modules/subscribepay/src/entity/pdfExportPack.go

@@ -13,7 +13,6 @@ import (
 	"github.com/gogf/gf/v2/util/gconv"
 	"github.com/google/uuid"
 	"io"
-	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/util"
 	"log"
 	"net"
@@ -37,7 +36,7 @@ const (
 )
 
 var (
-	pdfPackPriceMap = map[string]*PdfPackDetail{}
+	pdfPackPriceMap = map[string]map[int]int{}
 	JyPdfExportPack pdfExportPackStruct
 	ClientPool      chan *http.Client
 
@@ -115,20 +114,23 @@ type (
 )
 
 func init() {
-	for _, pack := range config.ExConf.Packs_showList {
-		pdfPackPriceMap[fmt.Sprintf("%s_%d", "normal", pack.PackNum)] = &PdfPackDetail{
-			PackType:  1,
-			PackNum:   pack.PackNum,
-			ValidYear: 3, //默认全为两年
-			Price:     int(config.ExConf.UnitPrice_normal*config.ExConf.Discount*pack.Normal_discount*100) * pack.PackNum,
-		}
-		pdfPackPriceMap[fmt.Sprintf("%s_%d", "senior", pack.PackNum)] = &PdfPackDetail{
-			PackType:  2,
-			PackNum:   pack.PackNum,
-			ValidYear: 3, //默认全为两年
-			Price:     int(config.ExConf.UnitPrice_senior*config.ExConf.Discount*pack.Senior_discount*100) * pack.PackNum,
+	type priceSpe struct {
+		Num   int `json:"num"`
+		Price int `json:"price"`
+	}
+	for productName, detail := range g.Cfg().MustGet(context.TODO(), "pdfPackPrice").Map() {
+		var (
+			arr     []priceSpe
+			mapping = map[int]int{}
+		)
+		if gconv.Struct(detail, &arr) == nil {
+			for _, spe := range arr {
+				mapping[spe.Num] = spe.Price
+			}
 		}
+		pdfPackPriceMap[productName] = mapping
 	}
+	g.Dump(pdfPackPriceMap)
 }
 
 // PayCallBack 支付完成回调
@@ -201,13 +203,22 @@ func (this *pdfExportPackStruct) GetPdfPackDetail(packId string) (PdfPackDetail,
 	if err != nil {
 		return PdfPackDetail{}, err
 	}
+	productPricesMap, ok := pdfPackPriceMap[productType]
+	if !ok || productPricesMap == nil || len(productPricesMap) == 0 {
+		return PdfPackDetail{}, fmt.Errorf("未知产品类型")
+	}
+	price, ok := productPricesMap[num]
+	if !ok || price == 0 {
+		return PdfPackDetail{}, fmt.Errorf("未知规格")
+	}
+
 	//TODO:获取计价
 	return PdfPackDetail{
 		PackType:      packType,
 		PackNum:       num,
 		ValidYear:     3,
-		Price:         num * 1000,
-		OriginalPrice: num * 2000,
+		Price:         price,
+		OriginalPrice: price,
 	}, nil
 }
 

+ 1 - 1
src/web/templates/pc/myOrder.html

@@ -458,7 +458,7 @@
                     <p>产品类型: @#item.product_type#@</p>
                     <p>报告下载份数:@#item.filter.pNum#@份<span style="color: #2cb7ca;"> @#item.filter.give_cycle >0 ? '赠' +
                             item.filter.give_cycle +'份': ''#@</span></p>
-                    <p>使用有效期:@# item.filter.validYear#@年</p>
+                    <p>使用有效期@# item.filter.validYear#@年</p>
                     <p v-if="item.order_status === 1">有效期至:@#item.filter.endTime#@</p>
                  </div>
                 </div>