wangchuanjin 1 жил өмнө
parent
commit
8f23199c46

+ 143 - 134
common/src/qfw/util/dataexport/dataexport.go

@@ -14,11 +14,12 @@ import (
 	"sync"
 	"time"
 
+	. "app.yhyue.com/moapp/jybase/date"
+	. "app.yhyue.com/moapp/jybase/encrypt"
+
 	"github.com/gogf/gf/v2/util/gconv"
 
 	qutil "app.yhyue.com/moapp/jybase/common"
-	. "app.yhyue.com/moapp/jybase/date"
-	. "app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
 	mg "app.yhyue.com/moapp/jybase/mongodb"
 	"app.yhyue.com/moapp/jypkg/common/src/qfw/util/jy"
@@ -53,6 +54,7 @@ type SieveCondition struct {
 	Industry         []string  `json:"industry"`         //行业
 	Keyword          []KeyWord `json:"keywords"`         //关键词
 	Buyer            []string  `json:"buyer"`            //招标单位(采购单位)
+	Agency           []string  `json:"agency"`           //招标代理机构(采购单位)
 	Buyerclass       []string  `json:"buyerclass"`       //采购单位类型
 	HasBuyerTel      string    `json:"hasBuyertel"`      //是否有采购单位电话
 	Winner           []string  `json:"winner"`           //中标单位
@@ -111,6 +113,23 @@ func DetailANDTitle(findfields string) bool {
 	return strings.Contains(findfields, "detail") && strings.Contains(findfields, "title")
 }
 
+var getMatchPhraseSql = func(field string, val ...string) (sql string) {
+	if len(val) == 0 {
+		return
+	}
+	var arr []string
+	for _, s := range val {
+		if s == "" {
+			continue
+		}
+		arr = append(arr, fmt.Sprintf(`{"match_phrase": {"%s": "%s"}}`, field, s))
+	}
+	if len(arr) == 0 {
+		return ""
+	}
+	return fmt.Sprintf(`{"bool": {"should": [%s],"minimum_should_match": 1}}`, strings.Join(arr, ","))
+}
+
 // 获取数据导出查询语句
 func getDataExportSql(scd *SieveCondition) string {
 	if len(scd.SelectIds) > 0 {
@@ -242,14 +261,25 @@ func getDataExportSql(scd *SieveCondition) string {
 	if len(scd.Industry) > 0 {
 		musts = append(musts, fmt.Sprintf(query_bool_must, "s_subscopeclass", `"`+strings.Join(scd.Industry, `","`)+`"`))
 	}
-	if len(scd.Buyer) > 0 {
-		musts = append(musts, fmt.Sprintf(query_bool_must, "buyer", `"`+strings.Join(scd.Buyer, `","`)+`"`))
-	}
 	if len(scd.Buyerclass) > 0 {
 		musts = append(musts, fmt.Sprintf(query_bool_must, "buyerclass", `"`+strings.Join(scd.Buyerclass, `","`)+`"`))
 	}
+	//P492招标采购搜索匹配采购单位等优化 新增buyer、agency、winner模糊搜索,数据导出同步改为模糊
+	//query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
+	if len(scd.Buyer) > 0 {
+		if sql := getMatchPhraseSql("buyer.mbuyer", scd.Buyer...); sql != "" {
+			musts = append(musts, sql)
+		}
+	}
+	if len(scd.Agency) > 0 {
+		if sql := getMatchPhraseSql("agency.magency", scd.Agency...); sql != "" {
+			musts = append(musts, sql)
+		}
+	}
 	if len(scd.Winner) > 0 {
-		musts = append(musts, fmt.Sprintf(query_bool_must, "s_winner", `"`+strings.Join(scd.Winner, `","`)+`"`))
+		if sql := getMatchPhraseSql("s_winner.mwinner", scd.Winner...); sql != "" {
+			musts = append(musts, sql)
+		}
 	}
 	_minPrice := ""
 	_maxPrice := ""
@@ -496,6 +526,7 @@ func GetSqlObjFromId(mongo mg.MongodbSim, _id string) *SieveCondition {
 		SelectType:       qutil.ObjToString((*query)["selectType"]),
 		PublishTime:      qutil.ObjToString((*query)["publishtime"]),
 		Buyer:            getStringArrFromDbResult((*query)["buyer"]),
+		Agency:           getStringArrFromDbResult((*query)["agency"]),
 		Buyerclass:       getStringArrFromDbResult((*query)["buyerclass"]),
 		HasBuyerTel:      qutil.ObjToString((*query)["hasBuyertel"]),
 		Winner:           getStringArrFromDbResult((*query)["winner"]),
@@ -629,23 +660,30 @@ func GetDataExportSelectReallyCountFromEs(ids []string) int64 {
 	wait := &sync.WaitGroup{}
 	var total int64
 	var lock sync.Mutex
-	for _, v := range SplitArray(ids, 200) {
-		pool <- true
-		wait.Add(1)
-		go func(arr []string) {
-			defer func() {
-				wait.Done()
-				<-pool
-			}()
-			query := fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"id":["%s"]}}]}}}`, strings.Join(arr, "\",\""))
-			tCount := elastic.Count(INDEX, TYPE, query)
-			if tCount > 0 {
-				lock.Lock()
-				total += tCount
-				lock.Unlock()
-			}
-			return
-		}(v)
+	var idArr []string
+	for i, id := range ids {
+		idArr = append(idArr, id)
+		if len(idArr) == 200 || i+1 == len(ids) {
+			pool <- true
+			wait.Add(1)
+			go func(arr []string) {
+				defer func() {
+					wait.Done()
+					<-pool
+				}()
+				log.Println("GetDataExportSelectReallyCountFromEs===", arr[0])
+				query := fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"id":["%s"]}}]}}}`, strings.Join(arr, "\",\""))
+				tCount := elastic.Count(INDEX, TYPE, query)
+				if tCount > 0 {
+					lock.Lock()
+					total += tCount
+					lock.Unlock()
+				}
+				return
+			}(idArr)
+			idArr = []string{}
+		}
+
 	}
 	wait.Wait()
 	log.Printf("GetDataExportSelectReallyCount 选择数据共%d条记录,实际查询%d条\n", len(ids), total)
@@ -666,44 +704,50 @@ func GetDataExportSelectReallyCountFromMongo(bid mg.MongodbSim, biddingName stri
 	)
 	pool := make(chan bool, 10)
 	wait := &sync.WaitGroup{}
-
-	for _, i2 := range SplitArray(ids, 200) {
-		pool <- true
-		wait.Add(1)
-		go func(arr []string) {
-			defer func() {
-				wait.Done()
-				<-pool
-			}()
-			lenNum := int64(len(arr))
-			var (
-				queryIds   []interface{}
-				num1, num2 int64
-				err        error
-			)
-			for _, idStr := range arr {
-				queryIds = append(queryIds, mg.StringTOBsonId(idStr))
-			}
-			num1, err = sess.DB(biddingName).C("bidding").Find(map[string]interface{}{"_id": map[string]interface{}{
-				"$in": queryIds,
-			}}).Count()
-			if err == nil {
-				if num1 == lenNum {
-					lock.Lock()
-					count += num1
-					lock.Unlock()
-					return
+	var idArr []string
+	for i, id := range ids {
+		idArr = append(idArr, id)
+		if len(idArr) == 200 || i+1 == len(ids) {
+			pool <- true
+			wait.Add(1)
+			go func(arr []string) {
+				defer func() {
+					wait.Done()
+					<-pool
+				}()
+				log.Println("GetDataExportSelectReallyCountFromMongo===", arr[0])
+				lenNum := int64(len(arr))
+				var (
+					queryIds   []interface{}
+					num1, num2 int64
+					err        error
+				)
+				for _, idStr := range arr {
+					queryIds = append(queryIds, mg.StringTOBsonId(idStr))
 				}
-				num2, err = sess.DB(biddingName).C("bidding_back").Find(map[string]interface{}{"_id": map[string]interface{}{
+				num1, err = sess.DB(biddingName).C("bidding").Find(map[string]interface{}{"_id": map[string]interface{}{
 					"$in": queryIds,
 				}}).Count()
 				if err == nil {
-					lock.Lock()
-					count += qutil.If(num2+num1 >= lenNum, lenNum, num2+num1).(int64)
-					lock.Unlock()
+					if num1 == lenNum {
+						lock.Lock()
+						count += num1
+						lock.Unlock()
+						return
+					}
+					num2, err = sess.DB(biddingName).C("bidding_back").Find(map[string]interface{}{"_id": map[string]interface{}{
+						"$in": queryIds,
+					}}).Count()
+					if err == nil {
+						lock.Lock()
+						count += qutil.If(num2+num1 >= lenNum, lenNum, num2+num1).(int64)
+						lock.Unlock()
+					}
 				}
-			}
-		}(i2)
+			}(idArr)
+			idArr = []string{}
+		}
+
 	}
 	wait.Wait()
 	return qutil.If(count > 0, count, -2).(int64)
@@ -717,19 +761,15 @@ func GetDataExportSelectResultFromEs(bidding mg.MongodbSim, biddingName string,
 	if checkCount == -1 && len(scd.SelectIds) > 500 {
 		scd.SelectIds = scd.SelectIds[:500]
 	}
-	pool := make(chan bool, 10)
-	wait := &sync.WaitGroup{}
-	var lock sync.Mutex
+
 	returnLsit := make([]map[string]interface{}, 0, len(scd.SelectIds))
-	for _, v := range SplitArray(scd.SelectIds, 200) {
-		pool <- true
-		wait.Add(1)
-		go func(arr []string) error {
-			defer func() {
-				wait.Done()
-				<-pool
-			}()
-			query := fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"id":["%s"]}}]}},"_source": [%s],"size":%d}`, strings.Join(arr, "\",\""), bidField, len(arr))
+	var idArr []string
+	for i, id := range scd.SelectIds {
+		idArr = append(idArr, id)
+		if len(idArr) == 200 || i+1 == len(scd.SelectIds) {
+
+			log.Println(scd.Id, "GetDataExportSelectResultFromEs===", idArr[0])
+			query := fmt.Sprintf(`{"query":{"bool":{"must":[{"terms":{"id":["%s"]}}]}},"_source": [%s],"size":%d}`, strings.Join(idArr, "\",\""), bidField, len(idArr))
 			log.Println("GetDataExportSelectResultFromEs 数据流量包 es count 信息查询:", query)
 			data := *elastic.Get(INDEX, TYPE, query)
 			if data != nil && len(data) > 0 {
@@ -739,15 +779,12 @@ func GetDataExportSelectResultFromEs(bidding mg.MongodbSim, biddingName string,
 					if detail != "" {
 						bv["detail"] = contentfilterReg.ReplaceAllString(detail, "")
 					}
-					lock.Lock()
 					returnLsit = append(returnLsit, bv)
-					lock.Unlock()
 				}
 			}
-			return nil
-		}(v)
+			idArr = []string{}
+		}
 	}
-	wait.Wait()
 	if len(returnLsit) == checkCount || checkCount == -1 || checkCount == -2 {
 		return &returnLsit, nil
 	} else {
@@ -769,20 +806,18 @@ func GetDataExportSelectResultFromMongoDb(bidding mg.MongodbSim, biddingName str
 	if checkCount == -1 && len(scd.SelectIds) > 500 {
 		scd.SelectIds = scd.SelectIds[:500]
 	}
-	pool := make(chan bool, 10)
-	wait := &sync.WaitGroup{}
-	var lock sync.Mutex
 	returnLsit := make([]map[string]interface{}, 0, len(scd.SelectIds))
-	for _, v := range SplitArray(scd.SelectIds, 200) {
-		pool <- true
-		wait.Add(1)
-		go func(arr []string) error {
-			defer func() {
-				wait.Done()
-				<-pool
-			}()
-			var queryIds []interface{}
-			for _, idStr := range arr {
+	var idArr []string
+	for i, id := range scd.SelectIds {
+		idArr = append(idArr, id)
+		if len(idArr) == 200 || i+1 == len(scd.SelectIds) {
+
+			log.Println(scd.Id, "GetDataExportSelectResultFromMongoDb===", idArr[0])
+			var (
+				queryIds []interface{}
+				count    int
+			)
+			for _, idStr := range idArr {
 				queryIds = append(queryIds, mg.StringTOBsonId(idStr))
 			}
 			iter := sess.DB(biddingName).C("bidding").Select(selectMap).Find(map[string]interface{}{"_id": map[string]interface{}{
@@ -794,66 +829,35 @@ func GetDataExportSelectResultFromMongoDb(bidding mg.MongodbSim, biddingName str
 				if detail != "" {
 					m["detail"] = contentfilterReg.ReplaceAllString(detail, "")
 				}
-				lock.Lock()
+				count++
 				returnLsit = append(returnLsit, m)
-				lock.Unlock()
 				m = make(map[string]interface{})
 			}
-			iter_back := sess.DB(biddingName).C("bidding_back").Select(selectMap).Find(map[string]interface{}{"_id": map[string]interface{}{
-				"$in": queryIds,
-			}}).Iter()
-			for m := make(map[string]interface{}); iter_back.Next(&m); {
-				m["_id"] = mg.BsonIdToSId(m["_id"])
-				detail, _ := m["detail"].(string)
-				if detail != "" {
-					m["detail"] = contentfilterReg.ReplaceAllString(detail, "")
+			if count != len(idArr) {
+				iter_back := sess.DB(biddingName).C("bidding_back").Select(selectMap).Find(map[string]interface{}{"_id": map[string]interface{}{
+					"$in": queryIds,
+				}}).Iter()
+				for m := make(map[string]interface{}); iter_back.Next(&m); {
+					m["_id"] = mg.BsonIdToSId(m["_id"])
+					detail, _ := m["detail"].(string)
+					if detail != "" {
+						m["detail"] = contentfilterReg.ReplaceAllString(detail, "")
+					}
+					returnLsit = append(returnLsit, m)
+					m = make(map[string]interface{})
 				}
-				lock.Lock()
-				returnLsit = append(returnLsit, m)
-				lock.Unlock()
-				m = make(map[string]interface{})
 			}
-			return nil
-		}(v)
+
+			idArr = []string{}
+		}
 	}
-	wait.Wait()
-	if len(returnLsit) == checkCount || checkCount == -1 {
+	if len(returnLsit) == checkCount || checkCount == -1 || checkCount == -2 {
 		return &returnLsit, nil
 	} else {
 		return nil, fmt.Errorf("GetDataExportSelectResultFromMongoDb 选择数据导出异常 数据量期望%d条,实际查询%d条", checkCount, len(returnLsit))
 	}
 }
 
-// SplitArray 分割数组
-func SplitArray(arr []string, num int64) [][]string {
-	max := int64(len(arr))
-	//判断数组大小是否小于等于指定分割大小的值,是则把原数组放入二维数组返回
-	if max <= num {
-		return [][]string{arr}
-	}
-	//获取应该数组分割为多少份
-	var quantity int64
-	if max%num == 0 {
-		quantity = max / num
-	} else {
-		quantity = (max / num) + 1
-	}
-	//声明分割好的二维数组
-	var segments = make([][]string, 0)
-	//声明分割数组的截止下标
-	var start, end, i int64
-	for i = 1; i <= quantity; i++ {
-		end = i * num
-		if i != quantity {
-			segments = append(segments, arr[start:end])
-		} else {
-			segments = append(segments, arr[start:])
-		}
-		start = i * num
-	}
-	return segments
-}
-
 func GetDataExportIds(elasticAddress string, scd *SieveCondition, checkCount int) ([]string, error) {
 	defer qutil.Catch()
 	if scd == nil {
@@ -1046,6 +1050,11 @@ func FormatExportData(entmg mg.MongodbSim, data *[]map[string]interface{}, webdo
 	if len(encry) > 0 {
 		isEncry = true
 	}
+	sort.Slice(*data, func(i, j int) bool {
+		time1 := qutil.Int64All((*data)[i]["publishtime"])
+		time2 := qutil.Int64All((*data)[j]["publishtime"])
+		return time1 > time2
+	})
 	var entCacheMap = map[string]map[string]interface{}{}
 	for index := 0; index < len(*data); index++ {
 		v := (*data)[index]

+ 6 - 0
common/src/qfw/util/dataexport/entdataexport.go

@@ -7,6 +7,7 @@ import (
 	"log"
 	"net/http"
 	"os"
+	"sort"
 	"strconv"
 	"strings"
 	"sync"
@@ -148,6 +149,11 @@ func FormatExportDatas(Mgo_Ent mongodb.MongodbSim, data *[]map[string]interface{
 		entexportPool      = make(chan bool, 20)
 		entexportWaitGroup = &sync.WaitGroup{}
 	)
+	sort.Slice(*data, func(i, j int) bool {
+		time1 := util.Int64All((*data)[i]["publishtime"])
+		time2 := util.Int64All((*data)[j]["publishtime"])
+		return time1 > time2
+	})
 	log.Println("补充信息开始")
 	for _, v := range *data {
 		entexportWaitGroup.Add(1)

+ 40 - 19
common/src/qfw/util/jy/subScribe.go

@@ -6,6 +6,7 @@ import (
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
 	"app.yhyue.com/moapp/jybase/go-xweb/log"
 	"app.yhyue.com/moapp/jybase/mongodb"
+	"time"
 )
 
 func GetSubScribeInfo(session *httpsession.Session, mg mongodb.MongodbSim, types, appid string) *map[string]interface{} {
@@ -25,31 +26,31 @@ func GetSubScribeInfo(session *httpsession.Session, mg mongodb.MongodbSim, types
 		}
 	}
 	object := &map[string]interface{}{}
-	jyData := &map[string]interface{}{}
+	var jyData map[string]interface{}
 	switch types {
 	case MemberFlag:
 		//大会员
 		if positionType == 0 {
 			//个人
 			if (*data)["o_member_jy"] != nil {
-				jyData = common.ObjToMap((*data)["o_member_jy"])
+				jyData = *common.ObjToMap((*data)["o_member_jy"])
 			}
 		} else {
-			jyData = EntnicheSub(entUserId, entId, 1, mg)
+			jyData = *EntnicheSub(entUserId, entId, 1, mg)
 		}
 	case EntnicheFlag:
 		//商机管理
-		jyData = EntnicheSub(entUserId, entId, 0, mg)
+		jyData = *EntnicheSub(entUserId, entId, 0, mg)
 		log.Println("~~~", jyData)
 	case SubVipFlag:
 		//超级订阅
 		if positionType == 0 {
 			if (*data)["o_vipjy"] != nil {
 				//个人
-				jyData = common.ObjToMap((*data)["o_vipjy"])
+				jyData = *common.ObjToMap((*data)["o_vipjy"])
 			}
 		} else {
-			jyData = EntnicheSub(entUserId, entId, 1, mg)
+			jyData = *EntnicheSub(entUserId, entId, 1, mg)
 		}
 	case SubFreeFlag:
 		if positionType == 0 {
@@ -72,40 +73,40 @@ func GetSubScribeInfo(session *httpsession.Session, mg mongodb.MongodbSim, types
 				}
 			}
 		} else {
-			jyData = EntnicheSub(entUserId, entId, 2, mg)
+			jyData = *EntnicheSub(entUserId, entId, 2, mg)
 		}
 	}
 	if jyData != nil {
-		object = format(jyData)
+		object = format(&jyData)
 	}
 	return object
 }
 
-//商机管理订阅设置
+// 商机管理订阅设置
 func EntnicheSub(entUserId, entId int64, types int64, mg mongodb.MongodbSim) *map[string]interface{} {
-	object := &map[string]interface{}{}
+	//object := &map[string]interface{}{}
 	entnicheJy := &map[string]interface{}{}
 	res, _ := mg.FindOne("entniche_rule", map[string]interface{}{
 		"i_userid": entUserId,
 		"i_entid":  entId,
-		"types":    types,
+		"i_type":   types,
 	})
 	if types == 2 {
 		if (*res)["o_entniche"] != nil {
-			ojy := common.ObjToMap((*res)["o_jy"])
-			object = ojy
-			if (*ojy)["a_key"] != nil {
+			ojy := common.ObjToMap((*res)["o_entniche"])
+			entnicheJy = ojy
+			if _, ok := (*ojy)["a_key"]; ok {
 				akey := common.ObjArrToMapArr((*ojy)["a_key"].([]interface{}))
-				(*object)["a_items"] = []map[string]interface{}{ //转换至和其它结构一致
+				(*entnicheJy)["a_items"] = []interface{}{ //转换至和其它结构一致
 					map[string]interface{}{
 						"a_key": akey,
 					},
 				}
 			}
-			if (*ojy)["o_area"] == nil {
-				(*object)["o_area"] = map[string]interface{}{}
+			if _, ok := (*ojy)["o_area"]; !ok {
+				(*entnicheJy)["o_area"] = map[string]interface{}{}
 			} else {
-				(*object)["o_area"] = (*ojy)["o_area"]
+				(*entnicheJy)["o_area"] = (*ojy)["o_area"]
 			}
 		}
 	} else {
@@ -115,7 +116,7 @@ func EntnicheSub(entUserId, entId int64, types int64, mg mongodb.MongodbSim) *ma
 	return entnicheJy
 }
 
-//格式化数据 大会员/超级订阅/商机管理 结构一致 关键词格式化
+// 格式化数据 大会员/超级订阅/商机管理 结构一致 关键词格式化
 func format(data *map[string]interface{}) *map[string]interface{} {
 	if data == nil {
 		return nil
@@ -156,3 +157,23 @@ func format(data *map[string]interface{}) *map[string]interface{} {
 	}
 	return data
 }
+
+// 用户注册日志保存
+func SaveUserLog(mg mongodb.MongodbSim, userid, phone, way, system, source, openid, search_engine, promotion, ip, user_agent, site, event string) {
+	data := map[string]interface{}{
+		"userid":        userid,
+		"phone":         phone,
+		"way":           way,
+		"system":        system,
+		"source":        source,
+		"create_time":   time.Now().Format("2006-01-02 15:04:05"),
+		"openid":        openid,
+		"search_engine": search_engine,
+		"promotion":     promotion,
+		"ip":            ip,
+		"user_agent":    user_agent,
+		"site":          site,
+		"event":         event,
+	}
+	mg.Save("user", data)
+}

+ 65 - 60
go.mod

@@ -1,22 +1,24 @@
 module app.yhyue.com/moapp/jypkg
 
-go 1.18
+go 1.19
 
 require (
 	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547
-	app.yhyue.com/moapp/jybase v0.0.0-20230718012114-37013054344b
-	app.yhyue.com/moapp/message v0.0.0-20221223100203-6402e389d9ae
-	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20230214091519-89a98c01ab0e
-	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20231219095433-7e7d4aa59822
-	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.0.8
-	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.15-0.20230925060020-8e4db0f1e13e
+	app.yhyue.com/moapp/jyPoints v1.1.2-0.20231020023521-1a4b1bbf9736
+	app.yhyue.com/moapp/jybase v0.0.0-20240104022202-158734833402
+	app.yhyue.com/moapp/message v0.0.0-20231204024949-8c7145bfc161
+	bp.jydev.jianyu360.cn/BaseService/entManageApplication v0.0.0-20231226074509-942d80dc34eb
+	bp.jydev.jianyu360.cn/BaseService/powerCheckCenter v0.0.0-20231222060155-36e225b61353
+	bp.jydev.jianyu360.cn/BaseService/resourceCenter v0.1.3
+	bp.jydev.jianyu360.cn/BaseService/userCenter v1.2.16
+	github.com/gogf/gf/v2 v2.6.2
 	github.com/nsqio/go-nsq v1.1.0
 	github.com/robfig/cron v1.2.0
 	github.com/tealeg/xlsx v1.0.5
 	github.com/thinxer/go-word2vec v0.0.0-20150917053916-5c19ec7379ed
-	github.com/zeromicro/go-zero v1.5.3
-	go.mongodb.org/mongo-driver v1.11.6
-	jygit.jydev.jianyu360.cn/ApplicationCenter/publicService v0.0.0-20231017031425-45003ca9f35a
+	github.com/zeromicro/go-zero v1.6.1
+	go.mongodb.org/mongo-driver v1.13.1
+	jygit.jydev.jianyu360.cn/ApplicationCenter/publicService v0.0.0-20231023011746-38dc3b6aded8
 )
 
 require (
@@ -29,13 +31,13 @@ require (
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
 	github.com/emicklei/go-restful/v3 v3.9.0 // indirect
-	github.com/fatih/color v1.15.0 // indirect
+	github.com/fatih/color v1.16.0 // indirect
 	github.com/garyburd/redigo v1.6.2 // indirect
 	github.com/go-logr/logr v1.2.4 // indirect
 	github.com/go-logr/stdr v1.2.2 // indirect
 	github.com/go-openapi/jsonpointer v0.19.6 // indirect
-	github.com/go-openapi/jsonreference v0.20.1 // indirect
-	github.com/go-openapi/swag v0.22.3 // indirect
+	github.com/go-openapi/jsonreference v0.20.2 // indirect
+	github.com/go-openapi/swag v0.22.4 // indirect
 	github.com/go-redis/redis/v8 v8.11.5 // indirect
 	github.com/go-sql-driver/mysql v1.7.1 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
@@ -43,19 +45,20 @@ require (
 	github.com/golang/protobuf v1.5.3 // indirect
 	github.com/golang/snappy v0.0.4 // indirect
 	github.com/gomodule/redigo v2.0.0+incompatible // indirect
-	github.com/google/gnostic v0.5.7-v3refs // indirect
-	github.com/google/go-cmp v0.5.9 // indirect
+	github.com/google/gnostic-models v0.6.8 // indirect
+	github.com/google/go-cmp v0.6.0 // indirect
 	github.com/google/gofuzz v1.2.0 // indirect
-	github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
+	github.com/google/uuid v1.4.0 // indirect
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.0 // indirect
 	github.com/howeyc/fsnotify v0.9.0 // indirect
 	github.com/jinzhu/inflection v1.0.0 // indirect
 	github.com/jinzhu/now v1.1.1 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
-	github.com/klauspost/compress v1.15.15 // indirect
+	github.com/klauspost/compress v1.16.7 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect
 	github.com/mattn/go-colorable v0.1.13 // indirect
-	github.com/mattn/go-isatty v0.0.17 // indirect
+	github.com/mattn/go-isatty v0.0.20 // indirect
 	github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -63,61 +66,63 @@ require (
 	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
 	github.com/olivere/elastic v6.2.37+incompatible // indirect
 	github.com/olivere/elastic/v7 v7.0.22 // indirect
-	github.com/openzipkin/zipkin-go v0.4.1 // indirect
-	github.com/pelletier/go-toml/v2 v2.0.8 // indirect
+	github.com/openzipkin/zipkin-go v0.4.2 // indirect
+	github.com/pelletier/go-toml/v2 v2.1.0 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
-	github.com/prometheus/client_golang v1.15.1 // indirect
-	github.com/prometheus/client_model v0.3.0 // indirect
-	github.com/prometheus/common v0.42.0 // indirect
-	github.com/prometheus/procfs v0.9.0 // indirect
+	github.com/prometheus/client_golang v1.17.0 // indirect
+	github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
+	github.com/prometheus/common v0.44.0 // indirect
+	github.com/prometheus/procfs v0.11.1 // indirect
 	github.com/spaolacci/murmur3 v1.1.0 // indirect
 	github.com/xdg-go/pbkdf2 v1.0.0 // indirect
-	github.com/xdg-go/scram v1.1.1 // indirect
-	github.com/xdg-go/stringprep v1.0.3 // indirect
-	github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
+	github.com/xdg-go/scram v1.1.2 // indirect
+	github.com/xdg-go/stringprep v1.0.4 // indirect
+	github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
 	github.com/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb // indirect
-	go.etcd.io/etcd/api/v3 v3.5.9 // indirect
-	go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
-	go.etcd.io/etcd/client/v3 v3.5.9 // indirect
-	go.opentelemetry.io/otel v1.15.1 // indirect
-	go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect
-	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.15.1 // indirect
-	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.14.0 // indirect
-	go.opentelemetry.io/otel/exporters/zipkin v1.15.1 // indirect
-	go.opentelemetry.io/otel/sdk v1.15.1 // indirect
-	go.opentelemetry.io/otel/trace v1.15.1 // indirect
-	go.opentelemetry.io/proto/otlp v0.19.0 // indirect
+	go.etcd.io/etcd/api/v3 v3.5.11 // indirect
+	go.etcd.io/etcd/client/pkg/v3 v3.5.11 // indirect
+	go.etcd.io/etcd/client/v3 v3.5.11 // indirect
+	go.opentelemetry.io/otel v1.19.0 // indirect
+	go.opentelemetry.io/otel/exporters/jaeger v1.17.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect
+	go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.19.0 // indirect
+	go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.19.0 // indirect
+	go.opentelemetry.io/otel/exporters/zipkin v1.19.0 // indirect
+	go.opentelemetry.io/otel/metric v1.19.0 // indirect
+	go.opentelemetry.io/otel/sdk v1.19.0 // indirect
+	go.opentelemetry.io/otel/trace v1.19.0 // indirect
+	go.opentelemetry.io/proto/otlp v1.0.0 // indirect
 	go.uber.org/atomic v1.10.0 // indirect
-	go.uber.org/automaxprocs v1.5.2 // indirect
+	go.uber.org/automaxprocs v1.5.3 // indirect
 	go.uber.org/multierr v1.9.0 // indirect
 	go.uber.org/zap v1.24.0 // indirect
-	golang.org/x/crypto v0.6.0 // indirect
-	golang.org/x/net v0.10.0 // indirect
-	golang.org/x/oauth2 v0.7.0 // indirect
-	golang.org/x/sync v0.1.0 // indirect
-	golang.org/x/sys v0.8.0 // indirect
-	golang.org/x/term v0.8.0 // indirect
-	golang.org/x/text v0.9.0 // indirect
-	golang.org/x/time v0.3.0 // indirect
-	google.golang.org/appengine v1.6.7 // indirect
-	google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
-	google.golang.org/grpc v1.56.1 // indirect
-	google.golang.org/protobuf v1.31.0 // indirect
+	golang.org/x/crypto v0.16.0 // indirect
+	golang.org/x/net v0.19.0 // indirect
+	golang.org/x/oauth2 v0.13.0 // indirect
+	golang.org/x/sync v0.5.0 // indirect
+	golang.org/x/sys v0.15.0 // indirect
+	golang.org/x/term v0.15.0 // indirect
+	golang.org/x/text v0.14.0 // indirect
+	golang.org/x/time v0.5.0 // indirect
+	google.golang.org/appengine v1.6.8 // indirect
+	google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
+	google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
+	google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect
+	google.golang.org/grpc v1.60.0 // indirect
+	google.golang.org/protobuf v1.31.1-0.20231027082548-f4a6c1f6e5c1 // indirect
 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
 	gopkg.in/inf.v0 v0.9.1 // indirect
 	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gopkg.in/yaml.v3 v3.0.1 // indirect
 	gorm.io/driver/mysql v1.0.5 // indirect
 	gorm.io/gorm v1.21.3 // indirect
-	k8s.io/api v0.26.3 // indirect
-	k8s.io/apimachinery v0.27.0-alpha.3 // indirect
-	k8s.io/client-go v0.26.3 // indirect
-	k8s.io/klog/v2 v2.90.1 // indirect
-	k8s.io/kube-openapi v0.0.0-20230307230338-69ee2d25a840 // indirect
-	k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
+	k8s.io/api v0.28.4 // indirect
+	k8s.io/apimachinery v0.28.4 // indirect
+	k8s.io/client-go v0.28.4 // indirect
+	k8s.io/klog/v2 v2.100.1 // indirect
+	k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
+	k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
 	sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
 	sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
 	sigs.k8s.io/yaml v1.3.0 // indirect

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 845 - 35
go.sum


+ 107 - 0
middleground/jypoints.go

@@ -0,0 +1,107 @@
+package middleground
+
+import (
+	"app.yhyue.com/moapp/jyPoints/rpc/integral"
+	"app.yhyue.com/moapp/jyPoints/rpc/integralclient"
+	"context"
+	"fmt"
+	"github.com/zeromicro/go-zero/core/discov"
+	"github.com/zeromicro/go-zero/zrpc"
+	"log"
+)
+
+type jyPoints struct {
+	hosts  []string
+	key    string
+	client zrpc.Client
+}
+
+func newJyPoints(hosts []string, key string) *jyPoints {
+	r := &jyPoints{
+		hosts: hosts,
+		key:   key,
+	}
+	r.client = r.NewClient()
+	return r
+}
+
+func (r *jyPoints) NewClient() zrpc.Client {
+	if r.client != nil && r.client.Conn() != nil {
+		return r.client
+	}
+	client, err := zrpc.NewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: r.hosts,
+			Key:   r.key,
+		},
+	})
+	if err != nil {
+		log.Println(err)
+		return nil
+	}
+	r.client = client
+	return client
+}
+
+// 积分消费2008
+func (r *jyPoints) PointConsume(userId, appId, endDate, sourceType, abstract string, point, pointType int64, operationType bool) (resp *integral.Resp, err error) {
+	client := r.NewClient()
+	if client == nil {
+		err = fmt.Errorf("jyPoint client err 01")
+		return
+	}
+	resp, err = integralclient.NewIntegral(client).IntegralConsume(context.Background(), &integral.Req{
+		UserId:        userId,
+		AppId:         appId,
+		EndDate:       endDate,
+		SourceType:    sourceType,
+		Point:         point,
+		PointType:     pointType,
+		Abstract:      abstract,
+		OperationType: operationType,
+	})
+	log.Println("消费剑鱼币 请求积分rpc 返回内容:", resp)
+	return
+}
+
+// 积分新增
+func (r *jyPoints) PointHarvest(userId, appId, endDate, sourceType, abstract string, point, pointType int64, operationType bool) (resp *integral.Resp, err error) {
+	client := r.NewClient()
+	if client == nil {
+		err = fmt.Errorf("jyPoint client err 02")
+		return
+	}
+	var (
+		ctx = context.Background()
+	)
+	resp, err = integralclient.NewIntegral(client).IntegralHarvest(ctx, &integral.Req{
+		UserId:        userId,
+		AppId:         appId,
+		EndDate:       endDate,
+		SourceType:    sourceType,
+		Point:         point,
+		PointType:     pointType,
+		Abstract:      abstract,
+		OperationType: operationType,
+	})
+	log.Println("奖励剑鱼币 请求积分rpc 返回内容:", resp)
+	return
+}
+
+// 积分查询
+func (r *jyPoints) PointIntegralBalance(userId, appId string) (resp *integral.Resp, err error) {
+	client := r.NewClient()
+	if client == nil {
+		err = fmt.Errorf("jyPoint client err 03")
+		return
+	}
+	var (
+		ctx = context.Background()
+	)
+	resp, err = integralclient.NewIntegral(client).IntegralBalanceCheck(ctx, &integral.Req{
+		UserId: userId,
+		AppId:  appId,
+	})
+	log.Println("奖励剑鱼币 请求积分rpc 返回内容:", resp)
+	return
+}

+ 5 - 0
middleground/middleground.go

@@ -8,6 +8,7 @@ type Middleground struct {
 	EntManageApplication *entManageApplication
 	ActivityCenter       *activity
 	Publicservice        *publicService
+	JyPoints             *jyPoints
 }
 
 func NewMiddleground(hosts []string) *Middleground {
@@ -39,6 +40,10 @@ func (m *Middleground) RegPublicservice(key string) *Middleground {
 	m.Publicservice = newPublicservice(m.hosts, key)
 	return m
 }
+func (m *Middleground) RegJyPoints(key string) *Middleground {
+	m.JyPoints = newJyPoints(m.hosts, key)
+	return m
+}
 func main() {
 	//userId: 63d498bb6ae0e1ea2170e03d -baseUserId: 366251 -accountId: 13485 -entId: 15419 -positionType: 0 -baseUserId: 366251 -accountId: 13485 -entId: 15419 -positionType: 0 -positionId: 932
 	NewMiddleground([]string{"192.168.3.206:2379"}).RegPowerCheckCenter("powercheck.rpc")

+ 15 - 2
public/dataexport.go

@@ -106,6 +106,8 @@ type BidSearchExport struct {
 	Industry        string //选中的行业
 	SelectType      string //标题 or 全文
 	Winner          string //中标单位
+	Buyer           string `json:"buyer"`  //招标单位(采购单位)
+	Agency          string `json:"agency"` //招标代理机构(采购单位)
 	Buyerclass      string //采购单位行业
 	Hasbuyertel     string //是否有采购电话
 	Haswinnertel    string //是否有中标电话
@@ -124,8 +126,11 @@ type BidSearchExport struct {
 
 func (this *BidSearchExport) PassBidSearchExport(Sysconfig map[string]interface{}) (returnData map[string]interface{}) {
 	defer util.Catch()
-	areaSave, industrySave, citySave, districtSave := []string{}, []string{}, []string{}, []string{}
-	winnerSave, buyerclassSave := []string{}, []string{}
+
+	var (
+		areaSave, industrySave, citySave, districtSave    = []string{}, []string{}, []string{}, []string{}
+		winnerSave, buyerSave, agencySave, buyerclassSave = []string{}, []string{}, []string{}, []string{}
+	)
 	publishtimeSave := this.Publishtime
 	if len(this.Area) > 0 {
 		areaSave = strings.Split(this.Area, ",")
@@ -146,6 +151,12 @@ func (this *BidSearchExport) PassBidSearchExport(Sysconfig map[string]interface{
 	if len(this.Winner) > 0 {
 		winnerSave = strings.Split(this.Winner, ",")
 	}
+	if len(this.Buyer) > 0 {
+		buyerSave = strings.Split(this.Buyer, ",")
+	}
+	if len(this.Agency) > 0 {
+		agencySave = strings.Split(this.Agency, ",")
+	}
 
 	KeyWordSave := []dataexport.KeyWord{}
 	if len(this.Keywords) > 0 || len(this.AdditionalWords) > 0 {
@@ -210,6 +221,8 @@ func (this *BidSearchExport) PassBidSearchExport(Sysconfig map[string]interface{
 		"selectType":   this.SelectType,
 		"buyerclass":   buyerclassSave,
 		"winner":       winnerSave,
+		"buyer":        buyerSave,
+		"agency":       agencySave,
 		"hasBuyertel":  this.Hasbuyertel,
 		"hasWinnertel": this.Haswinnertel,
 		"fileExists":   this.FileExists,

+ 50 - 0
public/ordercode.go

@@ -0,0 +1,50 @@
+package public
+
+import (
+	qutil "app.yhyue.com/moapp/jybase/common"
+	"fmt"
+	"sync"
+	"time"
+)
+
+var (
+	VarOrderCode *orderCode
+)
+
+type orderCode struct {
+	Pool chan string
+	All  *sync.Map
+	Lock *sync.Mutex
+}
+
+func (o *orderCode) gc() {
+	VarOrderCode.All.Range(func(key, value interface{}) bool {
+		if time.Now().Day() != value.(int) {
+			VarOrderCode.All.Delete(key)
+		}
+		return true
+	})
+	time.AfterFunc(24*time.Hour, o.gc)
+}
+func init() {
+	VarOrderCode = &orderCode{
+		Pool: make(chan string, 20),
+		All:  &sync.Map{},
+		Lock: &sync.Mutex{},
+	}
+	VarOrderCode.gc()
+	for i := 0; i < 10; i++ {
+		go func() {
+			VarOrderCode.Lock.Lock()
+			defer VarOrderCode.Lock.Unlock()
+			for {
+				o := fmt.Sprintf("%d%s", time.Now().Unix()+900000000, qutil.GetRandom(2))
+				if _, ok := VarOrderCode.All.Load(o); ok {
+					continue
+				}
+				VarOrderCode.All.Store(o, time.Now().Day())
+				VarOrderCode.Pool <- o
+			}
+		}()
+	}
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно