Эх сурвалжийг харах

Merge branch 'dev1.0.0' of https://app.yhyue.com/moapp/jyInfo into dev1.0.0

wangshan 3 жил өмнө
parent
commit
eb6404d775

+ 1 - 1
api/internal/handler/infolisthandler.go

@@ -3,10 +3,10 @@ package handler
 import (
 	"net/http"
 
-	"github.com/zeromicro/go-zero/rest/httpx"
 	"app.yhyue.com/moapp/jyInfo/api/internal/logic"
 	"app.yhyue.com/moapp/jyInfo/api/internal/svc"
 	"app.yhyue.com/moapp/jyInfo/api/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
 )
 
 func infoListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

+ 19 - 19
api/internal/types/types.go

@@ -16,12 +16,12 @@ type PubInfoReq struct {
 	Detail       string                 `json:"detail"`
 	Attach       map[string]interface{} `json:"attach,optional"`
 	Contact      Contact                `json:"contact"`
-	AppId        string                 `json:"appId"`
-	EntId        int64                  `json:"entId"`
-	UserId       string                 `json:"userId"`
+	AppId        string                 `header:"appId"`
+	EntId        int64                  `header:"entId"`
+	UserId       string                 `header:"userId"`
 	ValidityTime string                 `json:"validityTime,optional"`
-	Phone        string                 `json:"phone"`
-	EntName      string                 `json:"entName,optional"`
+	Phone        string                 `header:"phone"`
+	EntName      string                 `header:"entName,optional"`
 }
 
 type Contact struct {
@@ -31,32 +31,32 @@ type Contact struct {
 }
 
 type MyPublishListReq struct {
-	UserId       string `json:"userId"`
-	AppId        string `json:"appId"`
+	UserId       string `header:"userId"`
+	AppId        string `header:"appId"`
 	Match        string `json:"match,optional"`
 	MsgType      int64  `json:"msgType,optional"`
 	ReviewStatus string `json:"reviewStatus,optional"`
 	PageSize     int    `json:"pageSize,optional,default=10"`
 	PageIndex    int    `json:"pageIndex,optional,default=1"`
-	EntId        int64  `json:"entId"`
+	EntId        int64  `header:"entId"`
 }
 
 type MyPublishCommonReq struct {
 	MsgId   string `json:"msgId"`
-	UserId  string `json:"userId"`
+	UserId  string `header:"userId"`
 	Type    int64  `json:"type"` //处理信息类型:([前端用户:]0:获取发布信息详情(默认);1:删除发布的信息;)
 	MsgType int64  `json:"msgType,optional"`
-	AppId   string `json:"appId"`
+	AppId   string `header:"appId"`
 }
 
 type ReviewCommonReq struct {
-	AppId string `json:"appId"`
+	AppId string `header:"appId"`
 	MsgId string `json:"msgId"`
 	Type  int64  `json:"type"`
 }
 
 type InfoListReq struct {
-	AppId          string `json:"appId"`
+	AppId          string `header:"appId"`
 	MsgType        int    `json:"msgType,optional"`
 	PhoneType      int    `json:"phoneType,optional"`
 	Phone          string `json:"phone,optional"`
@@ -71,7 +71,7 @@ type InfoListReq struct {
 
 type InfoExamineReq struct {
 	MsgId        string `json:"msgId"`
-	AppId        string `json:"appId"`
+	AppId        string `header:"appId"`
 	ReviewStatus int64  `json:"reviewStatus"`
 	ReviewDetail string `json:"reviewDetail,optional"`
 	MsgType      int64  `json:"msgType"`
@@ -79,11 +79,11 @@ type InfoExamineReq struct {
 }
 
 type AssProjecctReq struct {
-	UserId  string `json:"userId"`
-	AppId   string `json:"appId"`
+	UserId  string `header:"userId"`
+	AppId   string `header:"appId"`
 	Match   string `json:"match"`
 	MsgType int64  `json:"msgType"`
-	EntId   int64  `json:"entId"`
+	EntId   int64  `header:"entId"`
 	Type    int64  `json:"type"`
 }
 
@@ -113,9 +113,9 @@ type InfoFileDelReq struct {
 }
 
 type CommonReq struct {
-	UserId  string `json:"userId,optional"`
-	EntId   int64  `json:"entId,optional"`
-	AppId   string `json:"appId"`
+	UserId  string `header:"userId,optional"`
+	EntId   int64  `header:"entId,optional"`
+	AppId   string `header:"appId"`
 	Match   string `json:"match,optional"`
 	MsgType int64  `json:"msgType,optional"`
 }

+ 19 - 19
api/jyinfo.api

@@ -15,12 +15,12 @@ type (
 		Detail       string                 `json:"detail"`
 		Attach       map[string]interface{} `json:"attach,optional"`
 		Contact      Contact                `json:"contact"`
-		AppId        string                 `json:"appId"`
-		EntId        int64                  `json:"entId"`
-		UserId       string                 `json:"userId"`
+		AppId        string                 `header:"appId"`
+		EntId        int64                  `header:"entId"`
+		UserId       string                 `header:"userId"`
 		ValidityTime string                 `json:"validityTime,optional"`
-		Phone        string                 `json:"phone"`
-		EntName      string                 `json:"entName,optional"`
+		Phone        string                 `header:"phone"`
+		EntName      string                 `header:"entName,optional"`
 	}
 	Contact {
 		Person string `json:"person"`
@@ -28,29 +28,29 @@ type (
 		Overt  int64  `json:"overt"`
 	}
 	myPublishListReq {
-		UserId       string `json:"userId"`
-		AppId        string `json:"appId"`
+		UserId       string `header:"userId"`
+		AppId        string `header:"appId"`
 		Match        string `json:"match,optional"`
 		MsgType      int64  `json:"msgType,optional"`
 		ReviewStatus string `json:"reviewStatus,optional"`
 		PageSize     int    `json:"pageSize,optional,default=10"`
 		PageIndex    int    `json:"pageIndex,optional,default=1"`
-		EntId        int64  `json:"entId"`
+		EntId        int64  `header:"entId"`
 	}
 	myPublishCommonReq {
 		MsgId   string `json:"msgId"`
-		UserId  string `json:"userId"`
+		UserId  string `header:"userId"`
 		Type    int64  `json:"type"` //处理信息类型:([前端用户:]0:获取发布信息详情(默认);1:删除发布的信息;)
 		MsgType int64  `json:"msgType,optional"`
-		AppId   string `json:"appId"`
+		AppId   string `header:"appId"`
 	}
 	reviewCommonReq {
-		AppId string `json:"appId"`
+		AppId string `header:"appId"`
 		MsgId string `json:"msgId"`
 		Type  int64  `json:"type"`
 	}
 	infoListReq {
-		AppId          string `json:"appId"`
+		AppId          string `header:"appId"`
 		MsgType        int    `json:"msgType,optional"`
 		PhoneType      int    `json:"phoneType,optional"`
 		Phone          string `json:"phone,optional"`
@@ -64,18 +64,18 @@ type (
 	}
 	infoExamineReq {
 		MsgId        string `json:"msgId"`
-		AppId        string `json:"appId"`
+		AppId        string `header:"appId"`
 		ReviewStatus int64  `json:"reviewStatus"`
 		ReviewDetail string `json:"reviewDetail,optional"`
 		MsgType      int64  `json:"msgType"`
 		Auditor      string `json:"auditor"`
 	}
 	assProjecctReq {
-		UserId  string `json:"userId"`
-		AppId   string `json:"appId"`
+		UserId  string `header:"userId"`
+		AppId   string `header:"appId"`
 		Match   string `json:"match"`
 		MsgType int64  `json:"msgType"`
-		EntId   int64  `json:"entId"`
+		EntId   int64  `header:"entId"`
 		Type    int64  `json:"type"`
 	}
 	pubSupplyInfoReq {
@@ -102,9 +102,9 @@ type (
 		FileId   string `json:"fileId,optional"`   //附件key
 	}
 	commonReq {
-		UserId  string `json:"userId,optional"`
-		EntId   int64  `json:"entId,optional"`
-		AppId   string `json:"appId"`
+		UserId  string `header:"userId,optional"`
+		EntId   int64  `header:"entId,optional"`
+		AppId   string `header:"appId"`
 		Match   string `json:"match,optional"`
 		MsgType int64  `json:"msgType,optional"`
 	}

+ 1 - 1
rpc/common/internal/logic/sensitivemethodlogic.go

@@ -149,7 +149,7 @@ func (l *SensitiveMethodLogic) SensitiveMethod(in *commoninfo.SensitiveRequest)
 					validity, _ := time.ParseInLocation("2006-01-02 15:04:05", mc.InterfaceToStr((*data)["validity_time"]), time.Local)
 					validityTime = validity.Unix()
 				}
-				supInfo["validityTime"] = validityTime
+				supInfo["validity_time"] = validityTime
 				if !model.SaveSupplyInfo(entName, supInfo) {
 					log.Println("调用信息发布成功,更新信息失败", entName, supInfo)
 					resp.ErrCode = -3

+ 2 - 2
rpc/consumer/consumer.proto

@@ -219,8 +219,8 @@ message StatusResp {
 	StatusData  data = 3;
 }
 message StatusData {
-	string status = 1;
-	string published = 2;
+	int64 status = 1;
+	int64 published = 2;
 }
 
 //供应信息检索框查询

+ 10 - 1
rpc/consumer/etc/consumer.yaml

@@ -29,4 +29,13 @@ Oss:
   ossAccessKeyId: LTAI4G5x9aoZx8dDamQ7vfZi
   ossAccessKeySecret: Bk98FsbPYXcJe72n1bG3Ssf73acuNh
   ossBucketName: jytest2022
-  ossUrl: https://jytest2022.oss-cn-beijing.aliyuncs.com
+  ossUrl: https://jytest2022.oss-cn-beijing.aliyuncs.com
+PublishCity:  {
+  北京: 北京市,
+  上海: 上海市,
+  天津: 天津市,
+  重庆: 重庆市,
+  香港: 香港市,
+  澳门: 澳门市,
+  台湾: 台湾市,
+}

+ 5 - 0
rpc/consumer/init/init.go

@@ -31,6 +31,11 @@ func init() {
 	//初始SupplyTotal
 	sm := C.SupplyTotal
 	model.SupplyTotalConfig(sm)
+
+	//初始特别行政地区
+	pc := C.PublishCity
+	model.PublishCityInfo(pc)
+
 	//初始es
 	es := C.Es
 	model.InitEs(&es)

+ 1 - 0
rpc/consumer/internal/config/config.go

@@ -15,4 +15,5 @@ type Config struct {
 	SupplyTotal int
 	Es          entity.EsStruct
 	Oss         entity.OssStruct
+	PublishCity map[string]string
 }

+ 1 - 1
rpc/consumer/internal/logic/mypublishlistlogic.go

@@ -95,7 +95,7 @@ func (l *MyPublishListLogic) MyPublishList(in *consumerinfo.MyPublishListReq) (*
 	}
 	allData := model.Mysql.SelectBySql(`SELECT a.id,a.type,a.title,a.create_time,a.published,a.publish_id,a.status  from (SELECT id,type,title,create_time,status,published,publish_id  from information WHERE is_del = 1 and user_id= "`+in.UserId+`" `+queryName+`
 			union all
-			SELECT id,type,title,create_time,status,published  from supply_info WHERE is_del = 1 and user_id= "`+in.UserId+`" `+queryName+` ) a  order by a.create_time desc limit ?,?`, offset, in.PageSize)
+			SELECT id,type,title,create_time,status,published,id as publish_id from supply_info WHERE is_del = 1 and user_id= "`+in.UserId+`" `+queryName+` ) a  order by a.create_time desc limit ?,?`, offset, in.PageSize)
 	if allData != nil && len(*allData) > 0 {
 		for _, v := range *allData {
 			var vs = consumerinfo.ListResp{}

+ 1 - 8
rpc/consumer/internal/logic/publishinfologic.go

@@ -33,13 +33,6 @@ func NewPublishInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Publi
 	}
 }
 
-var PublishCity = map[string]string{
-	"北京": "北京市",
-	"上海": "上海市",
-	"天津": "天津市",
-	"重庆": "重庆市",
-}
-
 // 发布信息
 func (l *PublishInfoLogic) PublishInfo(in *consumerinfo.PublishInfoReq) (*consumerinfo.PublishInfoResp, error) {
 	res := consumerinfo.PublishInfoResp{}
@@ -51,7 +44,7 @@ func (l *PublishInfoLogic) PublishInfo(in *consumerinfo.PublishInfoReq) (*consum
 	publishData["phone"] = in.Phone       //注册手机号
 	publishData["title"] = in.Title       //信息标题
 	publishData["province"] = in.Province //项目省份
-	if v, ok := PublishCity[in.Province]; ok && v != "" {
+	if v, ok := (*model.PublishCity)[in.Province]; ok && v != "" {
 		publishData["city"] = v
 	} else {
 		publishData["city"] = in.City

+ 8 - 8
rpc/consumer/internal/logic/statusquerylogic.go

@@ -35,14 +35,14 @@ func (l *StatusQueryLogic) StatusQuery(in *consumerinfo.StatusReq) (*consumerinf
 			status := mc.IntAll((*data)["status"])
 			published := mc.IntAll((*data)["published"])
 			var statusData consumerinfo.StatusData
-			statusData.Status = "1"
+			statusData.Status = 1
 			if published == 2 {
-				statusData.Status = "2"
+				statusData.Status = 2
 			} else if status == -2 || status == -1 {
-				statusData.Status = "3"
+				statusData.Status = 3
 			}
 
-			statusData.Published = mc.InterfaceToStr((*data)["published"])
+			statusData.Published = mc.Int64All((*data)["published"])
 			return &consumerinfo.StatusResp{
 				ErrCode: 0,
 				ErrMsg:  "",
@@ -55,13 +55,13 @@ func (l *StatusQueryLogic) StatusQuery(in *consumerinfo.StatusReq) (*consumerinf
 			status := mc.IntAll((*data)["status"])
 			published := mc.IntAll((*data)["published"])
 			var statusData consumerinfo.StatusData
-			statusData.Status = "1"
+			statusData.Status = 1
 			if published == 2 {
-				statusData.Status = "2"
+				statusData.Status = 2
 			} else if status == -2 || status == -1 {
-				statusData.Status = "3"
+				statusData.Status = 3
 			}
-			statusData.Published = mc.InterfaceToStr((*data)["published"])
+			statusData.Published = mc.Int64All((*data)["published"])
 			return &consumerinfo.StatusResp{
 				ErrCode: 0,
 				ErrMsg:  "",

+ 10 - 15
rpc/consumer/type/consumer/consumer.pb.go

@@ -1,13 +1,12 @@
 // Code generated by protoc-gen-go. DO NOT EDIT.
 // versions:
-// 	protoc-gen-go v1.23.0
-// 	protoc        v3.15.5
+// 	protoc-gen-go v1.28.0
+// 	protoc        v3.19.4
 // source: consumer.proto
 
 package consumer
 
 import (
-	proto "github.com/golang/protobuf/proto"
 	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
 	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
 	reflect "reflect"
@@ -21,10 +20,6 @@ const (
 	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
 )
 
-// This is a compile-time assertion that a sufficiently up-to-date version
-// of the legacy proto package is being used.
-const _ = proto.ProtoPackageIsVersion4
-
 //信息发布Req
 type PublishInfoReq struct {
 	state         protoimpl.MessageState
@@ -2012,8 +2007,8 @@ type StatusData struct {
 	sizeCache     protoimpl.SizeCache
 	unknownFields protoimpl.UnknownFields
 
-	Status    string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"`
-	Published string `protobuf:"bytes,2,opt,name=published,proto3" json:"published,omitempty"`
+	Status    int64 `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
+	Published int64 `protobuf:"varint,2,opt,name=published,proto3" json:"published,omitempty"`
 }
 
 func (x *StatusData) Reset() {
@@ -2048,18 +2043,18 @@ func (*StatusData) Descriptor() ([]byte, []int) {
 	return file_consumer_proto_rawDescGZIP(), []int{24}
 }
 
-func (x *StatusData) GetStatus() string {
+func (x *StatusData) GetStatus() int64 {
 	if x != nil {
 		return x.Status
 	}
-	return ""
+	return 0
 }
 
-func (x *StatusData) GetPublished() string {
+func (x *StatusData) GetPublished() int64 {
 	if x != nil {
 		return x.Published
 	}
-	return ""
+	return 0
 }
 
 //供应信息检索框查询
@@ -3249,8 +3244,8 @@ var file_consumer_proto_rawDesc = []byte{
 	0x65, 0x72, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x64,
 	0x61, 0x74, 0x61, 0x22, 0x42, 0x0a, 0x0a, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x44, 0x61, 0x74,
 	0x61, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62,
-	0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x75,
+	0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x70, 0x75, 0x62,
+	0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x70, 0x75,
 	0x62, 0x6c, 0x69, 0x73, 0x68, 0x65, 0x64, 0x22, 0xe7, 0x01, 0x0a, 0x13, 0x53, 0x75, 0x70, 0x70,
 	0x6c, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x12,
 	0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28,

+ 1 - 1
rpc/consumer/type/consumer/consumer_grpc.pb.go

@@ -1,7 +1,7 @@
 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
 // versions:
 // - protoc-gen-go-grpc v1.2.0
-// - protoc             v3.15.5
+// - protoc             v3.19.4
 // source: consumer.proto
 
 package consumer

+ 1 - 1
rpc/manager/internal/logic/infoexaminelogic.go

@@ -115,7 +115,7 @@ func (l *InfoExamineLogic) InfoExamine(in *manager.InfoExamineReq) (*manager.Inf
 					validity, _ := time.ParseInLocation("2006-01-02 15:04:05", common.InterfaceToStr((*data)["validity_time"]), time.Local)
 					validityTime = validity.Unix()
 				}
-				supInfo["validityTime"] = validityTime
+				supInfo["validity_time"] = validityTime
 				if !model.SaveSupplyInfo(entName, supInfo) {
 					resp.ErrCode = -1
 					resp.ErrMsg = "人工审核通过,信息发布调用失败"

+ 1 - 1
rpc/manager/internal/logic/infoonekeyactionlogic.go

@@ -86,7 +86,7 @@ func (l *InfoOneKeyActionLogic) InfoOneKeyAction(in *manager.OneKeyActionReq) (*
 						validity, _ := time.ParseInLocation("2006-01-02 15:04:05", mc.InterfaceToStr(res["validity_time"]), time.Local)
 						validityTime = validity.Unix()
 					}
-					supInfo["validityTime"] = validityTime
+					supInfo["validity_time"] = validityTime
 					if ok := es.SaveSupplyInfo(in.EntName, supInfo); ok {
 						if !model.Mysql.Update(tname, query, map[string]interface{}{
 							"published": 1,

+ 12 - 4
rpc/model/db.go

@@ -14,15 +14,23 @@ import (
 	"app.yhyue.com/moapp/jybase/redis"
 )
 
-var Mysql *mysql.Mysql
-var NsqConfig *entity.NsqStruct
-var SupplyTotal int
-var Sensitive *entity.Sensitive
+var (
+	Mysql       *mysql.Mysql
+	NsqConfig   *entity.NsqStruct
+	SupplyTotal int
+	Sensitive   *entity.Sensitive
+	PublishCity *map[string]string
+)
 
 func SupplyTotalConfig(mm int) {
 	SupplyTotal = mm
 }
 
+func PublishCityInfo(pb map[string]string) {
+	log.Println("--初始化 特别行政地区--")
+	PublishCity = &pb
+}
+
 func InitNsqConfig(mm *entity.NsqStruct) {
 	if mm.Ip != "" {
 		log.Println("--初始化 nsq--")