唯品尚特卖商品接口
This commit is contained in:
@@ -105,3 +105,31 @@ func (c *WeiPinShangClient) GetGoodsStock(req GetGoodsStockReq) (*[]GoodsStock,
|
|||||||
res := out.Data
|
res := out.Data
|
||||||
return &res, err
|
return &res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *WeiPinShangClient) GetSaleVenue(req GetSaleVenueReq) (*SaleVenueList, error) {
|
||||||
|
param := StructToMapString(req)
|
||||||
|
out := GetSaleVenueRes{}
|
||||||
|
err := c.PostAndParse(GetSaleVenueURL, param, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if out.Code != 0 {
|
||||||
|
return nil, fmt.Errorf(out.Msg)
|
||||||
|
}
|
||||||
|
res := out.Data
|
||||||
|
return &res, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *WeiPinShangClient) GetSaleVenueGoods(req GetSaleVenueGoodsReq) (*SaleVenueGoodsList, error) {
|
||||||
|
param := StructToMapString(req)
|
||||||
|
out := GetSaleVenueGoodsRes{}
|
||||||
|
err := c.PostAndParse(GetSaleVenueGoodsURL, param, &out)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if out.Code != 0 {
|
||||||
|
return nil, fmt.Errorf(out.Msg)
|
||||||
|
}
|
||||||
|
res := out.Data
|
||||||
|
return &res, err
|
||||||
|
}
|
||||||
|
@@ -113,3 +113,31 @@ func TestGetGoodsStock(t *testing.T) {
|
|||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assert.NotNil(t, res)
|
assert.NotNil(t, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGetSaleVenue(t *testing.T) {
|
||||||
|
ts := setupMockServer(wps.GetSaleVenueURL, http.MethodPost, `{"code":200,"data":{"stocks":[]}}`, t)
|
||||||
|
defer ts.Close()
|
||||||
|
|
||||||
|
client := newClientWithServer(ts)
|
||||||
|
res, err := client.GetSaleVenue(wps.GetSaleVenueReq{
|
||||||
|
PageNo: "1",
|
||||||
|
PageSize: "100",
|
||||||
|
Sort: 0,
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotNil(t, res)
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestGetSaleVenueGoods(t *testing.T) {
|
||||||
|
ts := setupMockServer(wps.GetSaleVenueGoodsURL, http.MethodPost, `{"code":200,"data":{"stocks":[]}}`, t)
|
||||||
|
defer ts.Close()
|
||||||
|
|
||||||
|
client := newClientWithServer(ts)
|
||||||
|
res, err := client.GetSaleVenueGoods(wps.GetSaleVenueGoodsReq{
|
||||||
|
PageNo: "1",
|
||||||
|
PageSize: "100",
|
||||||
|
ExhibitionID: "1829399501611053057",
|
||||||
|
})
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.NotNil(t, res)
|
||||||
|
}
|
||||||
|
@@ -199,3 +199,66 @@ type GoodsStock struct {
|
|||||||
CGoodsId string `json:"c_goods_id"`
|
CGoodsId string `json:"c_goods_id"`
|
||||||
CStock int `json:"c_stock"`
|
CStock int `json:"c_stock"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetSaleVenueReq struct {
|
||||||
|
PageNo string `json:"pageNo"` //页码
|
||||||
|
PageSize string `json:"pageSize"` //条数
|
||||||
|
Sort int `json:"sort"` //传1为c_id desc ,不传或者传0为c_start_datetime asc
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetSaleVenueRes struct {
|
||||||
|
Code int64 `json:"code"` //返回编码[0为成功,其它为失败]
|
||||||
|
Msg string `json:"msg"` //返回信息[请求接口消息]
|
||||||
|
Data SaleVenueList `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SaleVenueList struct {
|
||||||
|
PageIndex string `json:"pageIndex"`
|
||||||
|
PageCount int `json:"pageCount"`
|
||||||
|
DataCount int `json:"dataCount"`
|
||||||
|
List []SaleVenue `json:"list"` // 会场列表
|
||||||
|
}
|
||||||
|
|
||||||
|
type SaleVenue struct {
|
||||||
|
CID int `json:"c_id"` // 序号
|
||||||
|
CExhibitionID string `json:"c_exhibition_id"` // 会场ID
|
||||||
|
CBrandID int `json:"c_brand_id"` // 品牌ID
|
||||||
|
CExhibitionName string `json:"c_exhibition_name"` // 会场名称
|
||||||
|
CIconImageURL string `json:"c_icon_image_url"` // 会场列表图片
|
||||||
|
CBannerImageURL string `json:"c_banner_image_url"` // 会场Banner图
|
||||||
|
CDescription string `json:"c_description"` // 会场描述(可选)
|
||||||
|
CStartDatetime string `json:"c_start_datetime"` // 会场开始时间
|
||||||
|
CEndDatetime string `json:"c_end_datetime"` // 会场结束时间
|
||||||
|
CCompanyCode string `json:"c_company_code"` //供应商编号
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetSaleVenueGoodsReq struct {
|
||||||
|
PageNo string `json:"pageNo"` //页码
|
||||||
|
PageSize string `json:"pageSize"` //条数
|
||||||
|
ExhibitionID string `json:"exhibition_id"` //会场id
|
||||||
|
}
|
||||||
|
|
||||||
|
type GetSaleVenueGoodsRes struct {
|
||||||
|
Code int64 `json:"code"` //返回编码[0为成功,其它为失败]
|
||||||
|
Msg string `json:"msg"` //返回信息[请求接口消息]
|
||||||
|
Data SaleVenueGoodsList `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type SaleVenueGoodsList struct {
|
||||||
|
PageIndex string `json:"pageIndex"`
|
||||||
|
PageCount int `json:"pageCount"`
|
||||||
|
DataCount int `json:"dataCount"`
|
||||||
|
List []SaleVenueGoods `json:"list"` // 会场列表
|
||||||
|
}
|
||||||
|
|
||||||
|
type SaleVenueGoods struct {
|
||||||
|
CID int `json:"c_id"` // 序号
|
||||||
|
CExhibitionID string `json:"c_exhibition_id"` // 商品所属会场 ID
|
||||||
|
CFatherGoodsID string `json:"c_father_goods_id"` // 商品编码
|
||||||
|
CGoodsName string `json:"c_goods_name"` // 商品名称
|
||||||
|
CGoodsImage string `json:"c_goods_image"` // 商品主图
|
||||||
|
CGoodsDescription string `json:"c_goods_description"` // 商品描述
|
||||||
|
CGoodsContent string `json:"c_goods_content"` // 商品详情图(可选)
|
||||||
|
CInPrice string `json:"c_in_price"` // 商品进价
|
||||||
|
COriginalPrice string `json:"c_original_price"` // 商品市场价(吊牌价)
|
||||||
|
}
|
||||||
|
@@ -22,13 +22,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
GetGoodBrandURL = "mcang/Mcang/goodBrand" //查询商品的品牌
|
GetGoodBrandURL = "mcang/Mcang/goodBrand" //查询商品的品牌
|
||||||
GetGoodsClassifyURL = "mcang/Mcang/getGoodsClassify" //查询商品分类
|
GetGoodsClassifyURL = "mcang/Mcang/getGoodsClassify" //查询商品分类
|
||||||
GetGoodsListURL = "mcang/Mcang/getGoodsList" //获取全部商品列表接口
|
GetGoodsListURL = "mcang/Mcang/getGoodsList" //获取全部商品列表接口
|
||||||
GetGoodsdeptURL = "mcang/Mcang/getGoodsdept" //(推荐使用)获取后台已选商品列表接口
|
GetGoodsdeptURL = "mcang/Mcang/getGoodsdept" //(推荐使用)获取后台已选商品列表接口
|
||||||
GetDetailsGoodsUrl = "mcang/Mcang/getDetailsGoods" //获取批量商品详情接口
|
GetDetailsGoodsUrl = "mcang/Mcang/getDetailsGoods" //获取批量商品详情接口
|
||||||
GetGoodsDetailsURL = "mcang/Mcang/getGoodsDetails" //获取单个商品详情接口
|
GetGoodsDetailsURL = "mcang/Mcang/getGoodsDetails" //获取单个商品详情接口
|
||||||
GetGoodsStockURL = "mcang/Mcang/getGoodsStock" //获取单个商品详情接口
|
GetGoodsStockURL = "mcang/Mcang/getGoodsStock" //获取单个商品详情接口
|
||||||
|
GetSaleVenueURL = "mcang/Mcang/getSaleVenue" //获取会场列表接口
|
||||||
|
GetSaleVenueGoodsURL = "mcang/Mcang/getSaleVenueGoods" //获取会场商品列表接口
|
||||||
)
|
)
|
||||||
|
|
||||||
// Config 客户端配置
|
// Config 客户端配置
|
||||||
|
Reference in New Issue
Block a user