|
@ -72,3 +72,69 @@ func GetSkuByUuid(site_id, dbname, uuid string, field string, url ...string) (ma |
|
|
return data, err |
|
|
return data, err |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* product uuid获取商品sku信息 |
|
|
|
|
|
* 2021/11/29 |
|
|
|
|
|
* GZ |
|
|
|
|
|
*/ |
|
|
|
|
|
func GetSkuInfo(site_id, dbname, product_uuid string, sku_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 := &GetSkuRequest{proto.String(site_id), proto.String(dbname), proto.String(product_uuid), proto.String(sku_id), proto.String(field), nil} |
|
|
|
|
|
|
|
|
|
|
|
res := &GetResponse{} |
|
|
|
|
|
|
|
|
|
|
|
err = conn.GetSkuInfo(req, res) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
value := res.GetValue() |
|
|
|
|
|
|
|
|
|
|
|
var data map[string]string |
|
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(value, &data) |
|
|
|
|
|
|
|
|
|
|
|
return data, err |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* product uuid获取商品sku信息 |
|
|
|
|
|
* 2021/11/29 |
|
|
|
|
|
* GZ |
|
|
|
|
|
*/ |
|
|
|
|
|
func GetSkuList(site_id, dbname, product_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 := &GetSkuRequest{proto.String(site_id), proto.String(dbname), proto.String(product_uuid), proto.String(""), proto.String(field), nil} |
|
|
|
|
|
|
|
|
|
|
|
res := &GetResponse{} |
|
|
|
|
|
|
|
|
|
|
|
err = conn.GetSkuList(req, res) |
|
|
|
|
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
value := res.GetValue() |
|
|
|
|
|
|
|
|
|
|
|
var data []map[string]string |
|
|
|
|
|
|
|
|
|
|
|
err = json.Unmarshal(value, &data) |
|
|
|
|
|
|
|
|
|
|
|
return data, err |
|
|
|
|
|
|
|
|
|
|
|
} |