From 0fb3adbb73e1132260401030d2cf883460abd030 Mon Sep 17 00:00:00 2001 From: guzeng Date: Tue, 14 Sep 2021 10:09:22 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=B7=E6=B1=82=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- getinfo.go | 8 ++++---- getskuinfo.go | 8 ++++---- product.pb.go | 34 +++++++++++++++++++++++++--------- product.proto | 14 ++++++++------ 4 files changed, 41 insertions(+), 23 deletions(-) diff --git a/getinfo.go b/getinfo.go index b6c5f3b..bfb0b27 100644 --- a/getinfo.go +++ b/getinfo.go @@ -12,7 +12,7 @@ import ( * 2021/08/20 * GZ */ -func Get(dbname, id string, field string, url ...string) (map[string]string, error) { +func Get(site_id, dbname, id string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -20,7 +20,7 @@ func Get(dbname, id string, field string, url ...string) (map[string]string, err } defer conn.Close() - req := &GetRequest{proto.String(dbname), proto.String(id), proto.String(field), nil} + req := &GetRequest{proto.String(site_id), proto.String(dbname), proto.String(id), proto.String(field), nil} res := &GetResponse{} @@ -45,7 +45,7 @@ func Get(dbname, id string, field string, url ...string) (map[string]string, err * 2021/08/20 * GZ */ -func GetByUuid(dbname, uuid string, field string, url ...string) (map[string]string, error) { +func GetByUuid(site_id, dbname, uuid string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -53,7 +53,7 @@ func GetByUuid(dbname, uuid string, field string, url ...string) (map[string]str } defer conn.Close() - req := &GetUuidRequest{proto.String(dbname), proto.String(uuid), proto.String(field), nil} + req := &GetUuidRequest{proto.String(site_id), proto.String(dbname), proto.String(uuid), proto.String(field), nil} res := &GetResponse{} diff --git a/getskuinfo.go b/getskuinfo.go index 5850199..3797db9 100644 --- a/getskuinfo.go +++ b/getskuinfo.go @@ -12,7 +12,7 @@ import ( * 2021/08/20 * GZ */ -func GetSku(dbname, id string, field string, url ...string) (map[string]string, error) { +func GetSku(site_id, dbname, id string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -20,7 +20,7 @@ func GetSku(dbname, id string, field string, url ...string) (map[string]string, } defer conn.Close() - req := &GetRequest{proto.String(dbname), proto.String(id), proto.String(field), nil} + req := &GetRequest{proto.String(site_id), proto.String(dbname), proto.String(id), proto.String(field), nil} res := &GetResponse{} @@ -45,7 +45,7 @@ func GetSku(dbname, id string, field string, url ...string) (map[string]string, * 2021/08/20 * GZ */ -func GetSkuByUuid(dbname, uuid string, field string, url ...string) (map[string]string, error) { +func GetSkuByUuid(site_id, dbname, uuid string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { @@ -53,7 +53,7 @@ func GetSkuByUuid(dbname, uuid string, field string, url ...string) (map[string] } defer conn.Close() - req := &GetUuidRequest{proto.String(dbname), proto.String(uuid), proto.String(field), nil} + req := &GetUuidRequest{proto.String(site_id), proto.String(dbname), proto.String(uuid), proto.String(field), nil} res := &GetResponse{} diff --git a/product.pb.go b/product.pb.go index 316df0c..727b876 100644 --- a/product.pb.go +++ b/product.pb.go @@ -31,9 +31,10 @@ var _ = math.Inf // 使用key查询 type GetRequest struct { - Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"` - Id *string `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"` - Field *string `protobuf:"bytes,3,opt,name=field" json:"field,omitempty"` + SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"` + Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"` + Id *string `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"` + Field *string `protobuf:"bytes,4,opt,name=field" json:"field,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -41,6 +42,13 @@ func (m *GetRequest) Reset() { *m = GetRequest{} } func (m *GetRequest) String() string { return proto.CompactTextString(m) } func (*GetRequest) ProtoMessage() {} +func (m *GetRequest) GetSiteId() string { + if m != nil && m.SiteId != nil { + return *m.SiteId + } + return "" +} + func (m *GetRequest) GetDbname() string { if m != nil && m.Dbname != nil { return *m.Dbname @@ -63,9 +71,10 @@ func (m *GetRequest) GetField() string { } type GetUuidRequest struct { - Dbname *string `protobuf:"bytes,1,opt,name=dbname" json:"dbname,omitempty"` - Uuid *string `protobuf:"bytes,2,opt,name=uuid" json:"uuid,omitempty"` - Field *string `protobuf:"bytes,3,opt,name=field" json:"field,omitempty"` + SiteId *string `protobuf:"bytes,1,opt,name=site_id" json:"site_id,omitempty"` + Dbname *string `protobuf:"bytes,2,opt,name=dbname" json:"dbname,omitempty"` + Id *string `protobuf:"bytes,3,opt,name=id" json:"id,omitempty"` + Field *string `protobuf:"bytes,4,opt,name=field" json:"field,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -73,6 +82,13 @@ func (m *GetUuidRequest) Reset() { *m = GetUuidRequest{} } func (m *GetUuidRequest) String() string { return proto.CompactTextString(m) } func (*GetUuidRequest) ProtoMessage() {} +func (m *GetUuidRequest) GetSiteId() string { + if m != nil && m.SiteId != nil { + return *m.SiteId + } + return "" +} + func (m *GetUuidRequest) GetDbname() string { if m != nil && m.Dbname != nil { return *m.Dbname @@ -80,9 +96,9 @@ func (m *GetUuidRequest) GetDbname() string { return "" } -func (m *GetUuidRequest) GetUuid() string { - if m != nil && m.Uuid != nil { - return *m.Uuid +func (m *GetUuidRequest) GetId() string { + if m != nil && m.Id != nil { + return *m.Id } return "" } diff --git a/product.proto b/product.proto index 1f7dd53..5ae3fcf 100644 --- a/product.proto +++ b/product.proto @@ -3,15 +3,17 @@ package productrpc; // 使用key查询 message GetRequest { - string dbname = 1; - string id = 2; - string field = 3; + string site_id = 1; + string dbname = 2; + string id = 3; + string field = 4; } message GetUuidRequest { - string dbname = 1; - string uuid = 2; - string field = 3; + string site_id = 1; + string dbname = 2; + string id = 3; + string field = 4; } // 使用key查询响应结构