Browse Source

增加请求参数

master v0.4.0
guzeng 2 years ago
parent
commit
0fb3adbb73
4 changed files with 41 additions and 23 deletions
  1. +4
    -4
      getinfo.go
  2. +4
    -4
      getskuinfo.go
  3. +25
    -9
      product.pb.go
  4. +8
    -6
      product.proto

+ 4
- 4
getinfo.go View File

@ -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{}


+ 4
- 4
getskuinfo.go View File

@ -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{}


+ 25
- 9
product.pb.go View File

@ -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 ""
}


+ 8
- 6
product.proto View File

@ -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查询响应结构


Loading…
Cancel
Save