瀏覽代碼

fix:str转int

duxin 3 年之前
父節點
當前提交
93513b13be

+ 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 {

+ 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;
 }
 
 //供应信息检索框查询

+ 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