ソースを参照

Merge branch 'master' of https://jygit.jydev.jianyu360.cn/moapp/jypkg into master

zhangxinlei1996 2 年 前
コミット
a2ce1f2059

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

@@ -530,7 +530,7 @@ func GetDataExportSearchCountBySieveCondition(scd *SieveCondition, elasticAddres
 			}
 			if searchTextSize > 0 {
 				if secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress); secondKWS != "" {
-					scd.Keyword[0].Keyword = secondKWS
+					scd.Keyword[0].Keyword = jy.KeywordsProcessing(strings.ReplaceAll(secondKWS, "+", " "), " ")
 				}
 			}
 			// 附加词分词
@@ -541,7 +541,7 @@ func GetDataExportSearchCountBySieveCondition(scd *SieveCondition, elasticAddres
 				}
 				if appendTextSize > 0 {
 					if secondKWS := jy.HttpEs(scd.Keyword[0].Appended[i], "ik_smart", elasticAddress); secondKWS != "" {
-						scd.Keyword[0].Appended[i] = secondKWS
+						scd.Keyword[0].Appended[i] = jy.KeywordsProcessing(strings.ReplaceAll(secondKWS, "+", " "), " ")
 					}
 				}
 			}
@@ -768,7 +768,7 @@ func GetDataExportIds(elasticAddress string, scd *SieveCondition, checkCount int
 			}
 			if searchTextSize > 0 {
 				if secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress); secondKWS != "" {
-					scd.Keyword[0].Keyword = secondKWS
+					scd.Keyword[0].Keyword = jy.KeywordsProcessing(strings.ReplaceAll(secondKWS, "+", " "), " ")
 				}
 			}
 			// 附加词分词
@@ -779,7 +779,7 @@ func GetDataExportIds(elasticAddress string, scd *SieveCondition, checkCount int
 				}
 				if appendTextSize > 0 {
 					if secondKWS := jy.HttpEs(scd.Keyword[0].Appended[i], "ik_smart", elasticAddress); secondKWS != "" {
-						scd.Keyword[0].Appended[i] = secondKWS
+						scd.Keyword[0].Appended[i] = jy.KeywordsProcessing(strings.ReplaceAll(secondKWS, "+", " "), " ")
 					}
 				}
 			}
@@ -838,7 +838,7 @@ func GetDataExportSearchResult(bid mg.MongodbSim, bidMgoDBName, elasticAddress s
 			}
 			if searchTextSize > 0 {
 				if secondKWS := jy.HttpEs(scd.Keyword[0].Keyword, "ik_smart", elasticAddress); secondKWS != "" {
-					scd.Keyword[0].Keyword = secondKWS
+					scd.Keyword[0].Keyword = jy.KeywordsProcessing(strings.ReplaceAll(secondKWS, "+", " "), " ")
 				}
 			}
 			// 附加词分词
@@ -849,7 +849,7 @@ func GetDataExportSearchResult(bid mg.MongodbSim, bidMgoDBName, elasticAddress s
 				}
 				if appendTextSize > 0 {
 					if secondKWS := jy.HttpEs(scd.Keyword[0].Appended[i], "ik_smart", elasticAddress); secondKWS != "" {
-						scd.Keyword[0].Appended[i] = secondKWS
+						scd.Keyword[0].Appended[i] = jy.KeywordsProcessing(strings.ReplaceAll(secondKWS, "+", " "), " ")
 					}
 				}
 			}

+ 87 - 0
common/src/qfw/util/jy/ad.go

@@ -0,0 +1,87 @@
+package jy
+
+import (
+	"encoding/json"
+	"log"
+	"strings"
+	"time"
+)
+
+// AdInfo 广告信息
+type AdInfo struct {
+	S_link   string `json:"s_link"`   //广告位跳转链接
+	S_pic    string `json:"s_pic"`    //广告位弹窗
+	S_remark string `json:"s_remark"` //备注
+	S_picalt string `json:"s_picalt"` //图片ALT
+	S_id     string `json:"s_id"`     //广告标识id
+	O_extend struct {
+		Linktype  string `json:"linktype"`  //是否外部链接
+		Height    string `json:"height"`    //高度
+		Width     string `json:"width"`     //宽度
+		StartTime string `json:"startTime"` //开始时间
+		EndTime   string `json:"endTime"`   //结束时间
+		IosHref   string `json:"iosHref"`   //根据客户端不同 是否访问不同地址
+		Theme     string `json:"theme"`     // 主题样式
+		Title     string `json:"title"`     //标题
+		Power     string `json:"power"`     // 权限判断
+		Tab       string `json:"tab"`       // tab切换
+	} `json:"o_extend"` //拓展属性
+	S_script string `json:"s_script"` //脚本
+}
+
+// Handle 广告位信息处理
+func Handle(data []interface{}, host string) []AdInfo {
+	var res = []AdInfo{}
+	if len(data) > 0 {
+		AdInfo_Arr := []AdInfo{}
+		bytes, err := json.Marshal(data)
+		if err != nil {
+			return res
+		}
+		json.Unmarshal(bytes, &AdInfo_Arr)
+		if len(AdInfo_Arr) > 0 {
+			now := time.Now()
+			for _, v := range AdInfo_Arr {
+				log.Println(v.S_id, "---", host, "----", strings.Contains(host, v.S_id))
+				if v.S_id != "" && host != "" {
+					//根据不同环境区分广告位信息 v.S_id 填充内容, 例:app-i2;app-a1
+					if !strings.Contains(host, v.S_id) {
+						continue
+					}
+				}
+				if v.O_extend.StartTime != "" && len(strings.Split(v.O_extend.StartTime, "-")) == 6 {
+					if thisTime, err := time.ParseInLocation("2006-01-02-15-04-05", v.O_extend.StartTime, time.Local); err == nil {
+						//广告还未开始
+						if thisTime.Unix() > now.Unix() {
+							continue
+						}
+					}
+				}
+				if v.O_extend.EndTime != "" && len(strings.Split(v.O_extend.EndTime, "-")) == 6 {
+					if thisTime, err := time.ParseInLocation("2006-01-02-15-04-05", v.O_extend.EndTime, time.Local); err == nil {
+						//广告已经结束
+						if thisTime.Unix() < now.Unix() {
+							continue
+						}
+					}
+				}
+				res = append(res, v)
+			}
+		}
+	}
+	return res
+}
+
+// 获取当天剩余时间
+var (
+	timeOut int64 = 24 * 60 * 60
+)
+
+func GetLastTime() int64 {
+	t := time.Now()
+	midnight := time.Date(t.Year(), t.Month(), t.Day()+1, 0, 0, 0, 0, t.Location())
+	if midnight.After(t) {
+		return midnight.Unix() - t.Unix()
+	}
+	return timeOut
+}

+ 5 - 3
common/src/qfw/util/jy/bigVipPower.go

@@ -48,8 +48,9 @@ type BigVipBaseMsg struct {
 	FreeBuyerPort   int                    `json:"freeBuyerPort"`
 	FreeFile        int                    `json:"freeFile"`
 	FreeHasKey      bool                   `json:"freeHasKey"`
-	StartTime       int64                  `json:"startTime"` //开始时间戳
-	EndTime         int64                  `json:"endTime"`   //结束时间戳
+	StartTime       int64                  `json:"startTime"`    //开始时间戳
+	EndTime         int64                  `json:"endTime"`      //结束时间戳
+	EntSubscribe    int64                  `json:"entSubscribe"` // 是否有企业订阅权限;0:否 1:是
 	Data            *pb.CheckResp
 }
 
@@ -195,6 +196,7 @@ func GetBigVipUserBaseMsg(session *httpsession.Session, middleground middlegroun
 			FreeHasKey:      data.Free.FreeHasKey,
 			StartTime:       data.Member.StartTime,
 			EndTime:         data.Member.EndTime,
+			EntSubscribe:    data.Ent.EntSubscribe,
 		}
 		if entId > 0 {
 			userPower.EntInfo[qutil.IntAll(entId)] = &EntInfoStruct{
@@ -252,7 +254,7 @@ func (this *BigVipBaseMsg) GetUseId() string {
 	return this.Uid
 }
 
-//根据userid获取用户基本信息
+// 根据userid获取用户基本信息
 func GetInfoForBaseUser(mgo m.MongodbSim, userid string) *userCenterBp.UserIdReq {
 	if userid == "" {
 		return nil

+ 65 - 32
common/src/qfw/util/jy/jy.go

@@ -1,14 +1,6 @@
 package jy
 
 import (
-	"encoding/json"
-	"fmt"
-	"log"
-	"regexp"
-	"sort"
-	"strings"
-	"time"
-
 	util "app.yhyue.com/moapp/jybase/common"
 	. "app.yhyue.com/moapp/jybase/date"
 	"app.yhyue.com/moapp/jybase/es"
@@ -20,9 +12,16 @@ import (
 	"app.yhyue.com/moapp/jybase/sms"
 	. "app.yhyue.com/moapp/jypkg/middleground"
 	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+	"encoding/json"
+	"fmt"
+	"log"
+	"regexp"
+	"sort"
+	"strings"
+	"time"
 )
 
-//获取用户合并以前,合并以后的openid
+// 获取用户合并以前,合并以后的openid
 func GetOldOpenid(s_m_openid, a_m_openid, s_phone string, mergeorder interface{}) string {
 	a_mergeorder, _ := mergeorder.([]interface{})
 	openid := ""
@@ -55,19 +54,20 @@ var filterReg_1 = regexp.MustCompile("^([0-9]{1,3}|[零一二三四五六七八
 var filterReg = regexp.MustCompile("^[的人号时元万公告项目地址电话邮编日期联系招标中结果成交项目项目采购采购项目政府采购公告更正公告]+$")
 var PhoneReg = regexp.MustCompile("^[1][3-9][0-9]{9}$")
 var EmailPattern = regexp.MustCompile("^([a-zA-Z0-9_\\-\\.]+)@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\\]?)$")
+var filterReg_4 = regexp.MustCompile("([)>》】\\]\\}}〕。,,;;::'\"“”。\\.\\??、/\\+=\\\\_—\\*&……\\^%$¥@!!`~·(\\(<《【\\[\\{{〔])")
 
-//P279删除通用过滤词,例如“公告”
+// P279删除通用过滤词,例如“公告”
 func FilteKey(k string) string {
 	k = strings.TrimSpace(k)
 	// k = filterReg_3.ReplaceAllString(k, "")
-	k = filterReg_2.ReplaceAllString(k, "")
+	k = filterReg_4.ReplaceAllString(k, " ")
 	// k = filterReg_1.ReplaceAllString(k, "")
 	// k = filterReg.ReplaceAllString(k, "")
 	return k
 }
 
 // InterceptSearchKW 超过20个字,截断
-//返回截取后的字符串和截取掉中的前3个字
+// 返回截取后的字符串和截取掉中的前3个字
 func InterceptSearchKW(word string, keywordsLimit int, isFilter bool) (b_word, a_word, s_word string) {
 	if word == "" {
 		return
@@ -97,7 +97,7 @@ func HttpEs(ques, analyzer, esAddress string) string {
 	return es.Analyze(ques, "bidding", analyzer)
 }
 
-//发送邮箱验证码
+// 发送邮箱验证码
 func SendMailIdentCode(to, code string, auth []*mail.GmailAuth) bool {
 	html := fmt.Sprintf(`<div>
 		<div>
@@ -133,13 +133,12 @@ func SendMailIdentCode(to, code string, auth []*mail.GmailAuth) bool {
 	return false
 }
 
-//
 func SendSMS(address, mobile string, params ...string) {
 	sms.SendSms(address, "01", mobile, params...)
 }
 
-//发送验证码
-//增加sessionKey字段 更换手机号防止绕过身份校验
+// 发送验证码
+// 增加sessionKey字段 更换手机号防止绕过身份校验
 func SendPhoneIdentCode(address, phone string, session *httpsession.Session, sessionKey ...string) bool {
 	sessionKeyFlag := defaultPhoneFlag
 	if len(sessionKey) > 0 && sessionKey[0] != "" {
@@ -164,7 +163,7 @@ func SendPhoneIdentCode(address, phone string, session *httpsession.Session, ses
 
 const defaultPhoneFlag = "identCode"
 
-//短信验证码校验
+// 短信验证码校验
 func CheckPhoneIdent(session *httpsession.Session, code string, sessionKey ...string) string {
 	sessionKeyFlag := defaultPhoneFlag
 	if len(sessionKey) > 0 && sessionKey[0] != "" {
@@ -179,7 +178,7 @@ func CheckPhoneIdent(session *httpsession.Session, code string, sessionKey ...st
 	return ""
 }
 
-//删除短信验证码有关的session
+// 删除短信验证码有关的session
 func ClearPhoneIdentSession(session *httpsession.Session, sessionKey ...string) {
 	sessionKeyFlag := defaultPhoneFlag
 	if len(sessionKey) > 0 && sessionKey[0] != "" {
@@ -190,17 +189,17 @@ func ClearPhoneIdentSession(session *httpsession.Session, sessionKey ...string)
 	session.Del(fmt.Sprintf("%sTime", sessionKeyFlag))
 }
 
-//邮箱校验
+// 邮箱校验
 func IsEmail(value string) bool {
 	return EmailPattern.MatchString(value)
 }
 
-//手机号校验
+// 手机号校验
 func IsPhone(phone string) bool {
 	return PhoneReg.MatchString(phone)
 }
 
-//获取信息行业
+// 获取信息行业
 func Getindustrys(industryname string, mongodb MongodbSim) (industry map[string][]string, sortArray []string) {
 	industry = map[string][]string{}
 	sortArray = []string{}
@@ -243,8 +242,7 @@ func Getindustrys(industryname string, mongodb MongodbSim) (industry map[string]
 	return industry, sortArray
 }
 
-//对应月份
-//
+// 对应月份
 func GetMonth(mon string) int {
 	month := map[string]int{
 		"January":   1,
@@ -263,12 +261,12 @@ func GetMonth(mon string) int {
 	return month[mon]
 }
 
-//value unlimited 并发限制登陆用户
+// value unlimited 并发限制登陆用户
 func LoginRedisKey(userid string) string {
 	return fmt.Sprintf("unlimited_%s", userid)
 }
 
-//获取loginSess
+// 获取loginSess
 func GetLoginSess(userid string) []string {
 	key := LoginRedisKey(userid)
 	if data, ok := redis.Get("other", key).([]interface{}); ok {
@@ -277,7 +275,7 @@ func GetLoginSess(userid string) []string {
 	return []string{}
 }
 
-//判断是否在内
+// 判断是否在内
 func IsInLoginSess(key string, arr []string) bool {
 	for _, v := range arr {
 		if key == v {
@@ -298,7 +296,7 @@ type AppLoginPush struct {
 	PhoneType   string `json:"phoneType"`
 }
 
-//更新存储用户sessionid的队列 【sessionid ttl小于三天的清除】  key:sessionid
+// 更新存储用户sessionid的队列 【sessionid ttl小于三天的清除】  key:sessionid
 func PutLoginSess(mongodb MongodbSim, apppushRpc, key, userid string, limit, max int) bool {
 	value := GetLoginSess(userid)
 	if !IsInLoginSess(key, value) {
@@ -344,7 +342,7 @@ func PutLoginSess(mongodb MongodbSim, apppushRpc, key, userid string, limit, max
 	return redis.Put("other", LoginRedisKey(userid), value, -1)
 }
 
-//清除数组中的s
+// 清除数组中的s
 func removeArr(arr []string, s string) []string {
 	result := []string{}
 	for _, v := range arr {
@@ -356,7 +354,6 @@ func removeArr(arr []string, s string) []string {
 	return result
 }
 
-//
 func LoginOutPush(mongodb MongodbSim, userid, sessid, apppushRpc string) {
 	rediskey := fmt.Sprintf("app_%s", sessid)
 	r := redis.Get("other", rediskey)
@@ -393,7 +390,7 @@ func LoginOutPush(mongodb MongodbSim, userid, sessid, apppushRpc string) {
 	log.Println("ok:", ok)
 }
 
-//session数组清除某个value[针对多账号同时在线的方法、退出登录时调用]
+// session数组清除某个value[针对多账号同时在线的方法、退出登录时调用]
 func DelUnlimitSessionId(sessid, userid string) []string {
 	sessArr := GetLoginSess(userid)
 	newArr := []string{}
@@ -406,7 +403,7 @@ func DelUnlimitSessionId(sessid, userid string) []string {
 	return newArr
 }
 
-//获取当天结束时间 单位秒
+// 获取当天结束时间 单位秒
 func GetExpire() int {
 	t, _ := time.ParseInLocation(Date_Short_Layout, time.Now().AddDate(0, 0, 1).Format(Date_Short_Layout), time.Local)
 	t2, _ := time.ParseInLocation(Date_Full_Layout, time.Now().Format(Date_Full_Layout), time.Local)
@@ -420,10 +417,46 @@ func TimeProcessing(hour interface{}, duration int) time.Time {
 	return t
 }
 
-//清除用户权益缓存、菜单缓存
+// 清除用户权益缓存、菜单缓存
 func ClearUserCache(middleground *Middleground, positionId int64) {
 	middleground.UserCenter.WorkDesktopClearUserInfo(pb.WorkDesktopClearUserInfoReq{
 		PositionId: fmt.Sprint(positionId),
 	})
 	middleground.PowerCheckCenter.DelCheckRedis("10000", positionId)
 }
+
+// 关键词分词处理
+func KeywordsProcessing(keywords, sep string) string {
+	keywords = MatchSpace.ReplaceAllString(keywords, " ")
+	if keywords == "" || len(strings.Split(keywords, sep)) == 1 {
+		return keywords
+	}
+	var newWords = make([]string, 0, 0)
+	if keywords != "" && len(strings.Split(keywords, sep)) > 1 {
+		var words = strings.Split(keywords, sep)
+		for k := 0; k < len(words); k++ {
+			v := words[k]
+			//连续性空格
+			if len([]rune(v)) == 0 {
+				continue
+			}
+			if len([]rune(v)) == 1 {
+				//compare
+				if k == 0 { //first
+					words[k+1] = v + words[k+1]
+				} else if k == len(words)-1 { //last
+					newWords[len(newWords)-1] += v
+				} else {
+					if len(newWords[len(newWords)-1]) < len(words[k+1]) {
+						newWords[len(newWords)-1] += v
+					} else {
+						words[k+1] = v + words[k+1]
+					}
+				}
+			} else {
+				newWords = append(newWords, v)
+			}
+		}
+	}
+	return strings.Join(newWords, sep)
+}

+ 13 - 5
common/src/qfw/util/jy/jySession.go

@@ -1,6 +1,12 @@
 package jy
 
 import (
+	"fmt"
+	"log"
+	"net/http"
+	"strings"
+	"time"
+
 	qutil "app.yhyue.com/moapp/jybase/common"
 	"app.yhyue.com/moapp/jybase/encrypt"
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
@@ -8,17 +14,14 @@ import (
 	"app.yhyue.com/moapp/jybase/redis"
 	"app.yhyue.com/moapp/jypkg/identity"
 	"app.yhyue.com/moapp/jypkg/middleground"
-	"fmt"
 	"go.mongodb.org/mongo-driver/bson/primitive"
-	"net/http"
-	"strings"
-	"time"
 )
 
 // JyAppCreateSession app登陆创建session公共方法
 // copy from app program
 func JyAppCreateSession(mdb mongodb.MongodbSim, s *httpsession.Session, loginId string, loginType int, rw http.ResponseWriter, isSwitchToBestIdentity bool, mgd *middleground.Middleground, appPushServiceRpc string, criticality int) bool {
 	if loginId == "" {
+		log.Println("JyAppCreateSession空的loginId")
 		return false
 	}
 	query := map[string]interface{}{
@@ -38,10 +41,12 @@ func JyAppCreateSession(mdb mongodb.MongodbSim, s *httpsession.Session, loginId
 		query["base_user_id"] = qutil.Int64All(loginId)
 		break
 	default:
+		log.Println("JyAppCreateSession未知的loginType", loginId)
 		return false
 	}
 	data, ok := mdb.FindOneByField("user", query, `{"s_m_openid":1,"s_phone":1,"s_jpushid":1,"s_opushid":1,"s_appponetype":1,"s_headimageurl":1,"s_phone":1,"s_nickname":1,"s_appversion":1,"i_unlimited":1,"s_jyname":1,"base_user_id":1}`)
 	if !ok || data == nil || len(*data) == 0 {
+		log.Println("JyAppCreateSession没有找到该用户", ok, data, query)
 		return false
 	}
 	person := *data
@@ -73,7 +78,10 @@ func JyAppCreateSession(mdb mongodb.MongodbSim, s *httpsession.Session, loginId
 	if qutil.ObjToString(person["s_jyname"]) != "" {
 		sessVal["s_jyname"] = person["s_jyname"]
 	}
-	s.SetMultiple(sessVal)
+	if err := s.SetMultiple(sessVal); err != nil {
+		log.Println("JyAppCreateSession保存redis出错", loginId, err)
+		return false
+	}
 	if isSwitchToBestIdentity && mgd != nil {
 		identity.SwitchToBest(qutil.Int64All(sessVal["base_user_id"]), s, mgd, &mdb, true)
 	}

+ 6 - 4
common/src/qfw/util/jy/nsq.go

@@ -1,10 +1,10 @@
 package jy
 
 import (
+	. "app.yhyue.com/moapp/jybase/mongodb"
 	"encoding/json"
 	"errors"
 	"fmt"
-	. "app.yhyue.com/moapp/jybase/mongodb"
 	"time"
 
 	"app.yhyue.com/moapp/message/model"
@@ -21,6 +21,7 @@ const (
 	Jywx_subscribe_invite  = "jywx_subscribe_invite"  //已邀请并产生了新用户
 	Jywx_subscribe_invited = "jywx_subscribe_invited" //被邀请产生新用户
 	Jywx_report_invited    = "jywx_report_invited"    //年终报告被邀请产生新用户
+	Jywx_exhibition_active = "jywx_exhibition_active" //会展活动福利
 
 	Jywx_node1  = "jywx_node1"  //微信端
 	Jyweb_node2 = "jyweb_node2" //pc端
@@ -28,9 +29,9 @@ const (
 	Jysubscrib  = "jysubscribe" //支付
 )
 
-//e_code 模块
-//e_app 终端
-func Publish(mg MongodbSim, ip, topicName, e_code, e_userid, e_app string) error {
+// e_code 模块
+// e_app 终端
+func Publish(mg MongodbSim, ip, topicName, e_code, e_userid, e_app string, body map[string]interface{}) error {
 	if topicName == "" {
 		return errors.New("未找到topicName,请检查tye参数是否正确")
 	}
@@ -44,6 +45,7 @@ func Publish(mg MongodbSim, ip, topicName, e_code, e_userid, e_app string) error
 		E_userId: e_userid,
 		E_time:   time.Now().Unix(), //1605223065
 		E_app:    e_app,
+		E_body:   body,
 	}
 	b, _ := json.Marshal(msg)
 	err = producer.Publish(topicName, b)

+ 51 - 45
go.mod

@@ -4,7 +4,7 @@ go 1.18
 
 require (
 	app.yhyue.com/moapp/jyMarketing v0.0.2-0.20230304035551-21bb1eedf547
-	app.yhyue.com/moapp/jybase v0.0.0-20230517064222-e0bdfc8ee0e8
+	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-20230222052351-9d6fad062447
@@ -14,8 +14,9 @@ require (
 	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.4.4
-	go.mongodb.org/mongo-driver v1.11.1
+	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-20230630032508-eefb06a4588e
 )
 
 require (
@@ -23,96 +24,101 @@ require (
 	github.com/beorn7/perks v1.0.1 // indirect
 	github.com/cenkalti/backoff/v4 v4.2.1 // indirect
 	github.com/cespare/xxhash/v2 v2.2.0 // indirect
-	github.com/coreos/go-semver v0.3.0 // indirect
-	github.com/coreos/go-systemd/v22 v22.3.2 // indirect
+	github.com/coreos/go-semver v0.3.1 // indirect
+	github.com/coreos/go-systemd/v22 v22.5.0 // indirect
 	github.com/davecgh/go-spew v1.1.1 // indirect
-	github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f // indirect
 	github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
-	github.com/fatih/color v1.13.0 // indirect
-	github.com/felixge/fgprof v0.9.3 // indirect
+	github.com/emicklei/go-restful/v3 v3.9.0 // indirect
+	github.com/fatih/color v1.15.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-redis/redis/v8 v8.11.5 // indirect
-	github.com/go-sql-driver/mysql v1.7.0 // indirect
+	github.com/go-sql-driver/mysql v1.7.1 // indirect
 	github.com/gogo/protobuf v1.3.2 // indirect
 	github.com/golang/mock v1.6.0 // indirect
-	github.com/golang/protobuf v1.5.2 // indirect
+	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/gofuzz v1.2.0 // indirect
-	github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
-	github.com/googleapis/gnostic v0.5.5 // indirect
-	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 // indirect
+	github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.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.11 // indirect
+	github.com/klauspost/compress v1.15.15 // indirect
 	github.com/mailru/easyjson v0.7.7 // indirect
-	github.com/mattn/go-colorable v0.1.9 // indirect
-	github.com/mattn/go-isatty v0.0.14 // indirect
-	github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
+	github.com/mattn/go-colorable v0.1.13 // indirect
+	github.com/mattn/go-isatty v0.0.17 // 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
 	github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect
+	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.6 // indirect
+	github.com/pelletier/go-toml/v2 v2.0.8 // indirect
 	github.com/pkg/errors v0.9.1 // indirect
-	github.com/prometheus/client_golang v1.13.0 // indirect
-	github.com/prometheus/client_model v0.2.0 // indirect
-	github.com/prometheus/common v0.37.0 // indirect
-	github.com/prometheus/procfs v0.8.0 // 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/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/ziutek/blas v0.0.0-20190227122918-da4ca23e90bb // indirect
-	go.etcd.io/etcd/api/v3 v3.5.5 // indirect
-	go.etcd.io/etcd/client/pkg/v3 v3.5.5 // indirect
-	go.etcd.io/etcd/client/v3 v3.5.5 // 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.uber.org/atomic v1.9.0 // indirect
-	go.uber.org/automaxprocs v1.5.1 // indirect
-	go.uber.org/multierr v1.8.0 // indirect
-	go.uber.org/zap v1.21.0 // indirect
-	golang.org/x/crypto v0.0.0-20221010152910-d6f0a8c073c2 // indirect
-	golang.org/x/net v0.8.0 // indirect
-	golang.org/x/oauth2 v0.4.0 // indirect
+	go.uber.org/atomic v1.10.0 // indirect
+	go.uber.org/automaxprocs v1.5.2 // 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.7.0 // indirect
-	golang.org/x/term v0.6.0 // indirect
-	golang.org/x/text v0.8.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-20230110181048-76db0878b65f // indirect
-	google.golang.org/grpc v1.54.0 // indirect
-	google.golang.org/protobuf v1.30.0 // 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
 	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.22.9 // indirect
-	k8s.io/apimachinery v0.22.9 // indirect
-	k8s.io/client-go v0.22.9 // indirect
-	k8s.io/klog/v2 v2.80.1 // indirect
-	k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 // indirect
-	sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
-	sigs.k8s.io/yaml v1.2.0 // 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
+	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
 )

ファイルの差分が大きいため隠しています
+ 81 - 481
go.sum


+ 5 - 0
middleground/middleground.go

@@ -7,6 +7,7 @@ type Middleground struct {
 	PowerCheckCenter     *powerCheckCenter
 	EntManageApplication *entManageApplication
 	ActivityCenter       *activity
+	Publicservice        *publicService
 }
 
 func NewMiddleground(hosts []string) *Middleground {
@@ -34,6 +35,10 @@ func (m *Middleground) RegActivity(key string) *Middleground {
 	m.ActivityCenter = newActivity(m.hosts, key)
 	return m
 }
+func (m *Middleground) RegPublicservice(key string) *Middleground {
+	m.Publicservice = newPublicservice(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")

+ 105 - 0
middleground/publicservice.go

@@ -0,0 +1,105 @@
+package middleground
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"context"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/datasmt"
+	"jygit.jydev.jianyu360.cn/ApplicationCenter/publicService/rpc/pb"
+	"log"
+
+	"github.com/zeromicro/go-zero/core/discov"
+	"github.com/zeromicro/go-zero/zrpc"
+)
+
+type publicService struct {
+	hosts  []string
+	key    string
+	client zrpc.Client
+}
+
+func newPublicservice(hosts []string, key string) *publicService {
+	r := &publicService{
+		hosts: hosts,
+		key:   key,
+	}
+	r.client = r.NewClient()
+	return r
+}
+
+func (u *publicService) NewClient() zrpc.Client {
+	if u.client != nil && u.client.Conn() != nil {
+		return u.client
+	}
+	client, err := zrpc.NewClient(zrpc.RpcClientConf{
+		Etcd: discov.EtcdConf{
+			Hosts: u.hosts,
+			Key:   u.key,
+		},
+	})
+	if err != nil {
+		log.Println(err)
+		return nil
+	}
+	u.client = client
+	return client
+}
+
+//列表数据处理
+func (p *publicService) List(searchValue, dataType string, pageNum, pageSize int64) map[string]interface{} {
+	client := p.NewClient()
+	if client == nil {
+		return nil
+	}
+	resp, err := datasmt.NewDatasmt(client).List(context.Background(), &pb.DatasmtReqList{
+		SearchValue: searchValue,
+		DataType:    dataType,
+		PageNum:     pageNum,
+		PageSize:    pageSize,
+	})
+	if err != nil {
+		log.Println(err)
+		return nil
+	}
+	result := map[string]interface{}{}
+	result["PageCount"] = resp.PageCount
+	arr := []map[string]interface{}{}
+	for _, v := range resp.List {
+		arr = append(arr, map[string]interface{}{
+			"id":             v.Id,
+			"name":           v.Name,
+			"format":         v.Format,
+			"clearStatus":    v.ClearStatus,
+			"clearStatusStr": common.If(v.ClearStatus == "0", "", "人工清洗"),
+			"dataType":       v.DataType,
+		})
+	}
+	result["list"] = arr
+	result["fieldIllustrate"] = resp.FieldIllustrate
+	result["hotKeys"] = resp.HotKeys
+	result["searchValue"] = searchValue
+	result["dataTypeStr"] = resp.DataTypeStr
+	return result
+}
+func (p *publicService) Detail(id string) map[string]interface{} {
+	client := p.NewClient()
+	if client == nil {
+		return nil
+	}
+	resp, err := datasmt.NewDatasmt(client).Detail(context.Background(), &pb.DatasmtReqDetail{
+		Id: id})
+	if err != nil {
+		log.Println(err)
+		return nil
+	}
+	result := map[string]interface{}{}
+	result["name"] = resp.Name
+	result["dataType"] = resp.FieldIllustrate.Name
+	result["describe"] = resp.FieldIllustrate.Describe
+	result["clearStatusStr"] = common.If(resp.ClearStatus == "0", "", "人工清洗")
+	result["clearStatus"] = resp.ClearStatus
+	result["dataExample"] = resp.DataExample
+	result["introduce"] = resp.Introduce
+	result["format"] = resp.Format
+	result["keyword"] = resp.Keyword
+	return result
+}

+ 1 - 1
public/public.go

@@ -23,7 +23,7 @@ var filterReg_3 = regexp.MustCompile("(项目|公告|公示)$")
 var filterReg_2 = regexp.MustCompile("^[)\\)>》】\\]}}〕,,;;::'\"“”。.\\??、/+=\\_—*&……\\^%$¥@!!`~·(\\(<《【\\[{{〔]+$")
 var filterReg_1 = regexp.MustCompile("^([0-9]{1,3}|[零一二三四五六七八九十]{1,2}|联系人?|电话|地址|编号|采购|政府采购|成交|更正|招标|中标|变更|结果)$")
 var filterReg = regexp.MustCompile("^[的人号时元万公告项目地址电话邮编日期联系招标中结果成交项目项目采购采购项目政府采购公告更正公告]+$")
-var MgoBiddingFields = `{"_id":1,"projectname":1,"projectcode":1,"title":1,"s_winner":1,"buyertel":1,"bidstatus":1,"site":1,"bidamount":1,"toptype":1,"winneraddr":1,"winner":1,"agency":1,"buyer":1,"detail":1,"city":1,"subtype":1,"buyerclass":1,"href":1,"comeintime":1,"winnertel":1,"area":1,"publishtime":1,"buyeraddr":1,"agencytel":1,"budget":1,"entidlist":1,"buyerperson":1,"winnerperson":1,"agencyaddr":1,"recommended_service":1,"competehref":1,"owner":1,"total_investment":1,"projectaddr":1,"projectperiod":1,"approvedept":1,"approvecontent":1,"approvecode":1,"approvenumber":1,"approvetime":1,"approvestatus":1,"project_scale":1}`
+var MgoBiddingFields = `{"_id":1,"purchasinglist":1,"projectname":1,"projectcode":1,"title":1,"s_winner":1,"buyertel":1,"bidstatus":1,"site":1,"bidamount":1,"toptype":1,"winneraddr":1,"winner":1,"agency":1,"buyer":1,"detail":1,"city":1,"subtype":1,"buyerclass":1,"href":1,"comeintime":1,"winnertel":1,"area":1,"publishtime":1,"buyeraddr":1,"agencytel":1,"budget":1,"entidlist":1,"buyerperson":1,"winnerperson":1,"agencyaddr":1,"recommended_service":1,"competehref":1,"owner":1,"total_investment":1,"projectaddr":1,"projectperiod":1,"approvedept":1,"approvecontent":1,"approvecode":1,"approvenumber":1,"approvetime":1,"approvestatus":1,"project_scale":1}`
 
 const (
 	INDEX = "bidding"

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません