package productrpc import ( "encoding/json" // "strconv" // "time" "github.com/golang/protobuf/proto" ) /** * id获取商品sku信息 * 2021/08/20 * GZ */ func GetSku(site_id, dbname, id string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { return nil, err } defer conn.Close() req := &GetRequest{proto.String(site_id), proto.String(dbname), proto.String(id), proto.String(field), nil} res := &GetResponse{} err = conn.GetSku(req, res) if err != nil { return nil, err } value := res.GetValue() var data map[string]string err = json.Unmarshal(value, &data) return data, err } /** * uuid获取商品sku信息 * 2021/08/20 * GZ */ func GetSkuByUuid(site_id, dbname, uuid string, field string, url ...string) (map[string]string, error) { conn, err := rpc_server_conn(url...) if err != nil { return nil, err } defer conn.Close() req := &GetUuidRequest{proto.String(site_id), proto.String(dbname), proto.String(uuid), proto.String(field), nil} res := &GetResponse{} err = conn.GetSkuByUuid(req, res) if err != nil { return nil, err } value := res.GetValue() var data map[string]string err = json.Unmarshal(value, &data) return data, err }