Documentation
¶
Overview ¶
微信好物圈 SDK
Index ¶
- func AddOrder(clt *core.Client, req *ImportOrderRequest, isHistory uint) (err error)
- func AddShoppingList(clt *core.Client, req *AddShoppingListRequest) (err error)
- func DeleteAllShoppingList(clt *core.Client, openId string) (err error)
- func DeleteOrder(clt *core.Client, req *DeleteOrderRequest) (err error)
- func DeleteShoppingList(clt *core.Client, req *DeleteShoppingListRequest) (err error)
- func ImportMedia(clt *core.Client, req *ImportMediaRequest) (err error)
- func ImportProduct(clt *core.Client, req *ImportProductRequest) (err error)
- func SetCanBeSearch(clt *core.Client, canBeSearch bool) (err error)
- func UpdateOrder(clt *core.Client, req *ImportOrderRequest, isHistory uint) (err error)
- type AddShoppingListRequest
- type Attr
- type BarCode
- type Brand
- type Category
- type DeleteOrderRequest
- type DeleteShoppingListRequest
- type DetailPage
- type Express
- type ExpressGood
- type ExpressPackage
- type Good
- type ImportMediaRequest
- type ImportOrderRequest
- type ImportProductRequest
- type Invoice
- type Media
- type MediaInfo
- type Order
- type OrderExt
- type OrderProduct
- type OrderProductList
- type Poi
- type Product
- type Promotion
- type QueryKey
- type QueryProductRequest
- type QueryProductResponse
- type QueryShoppingListRequest
- type QueryShoppingListResponse
- type QueryType
- type Sku
- type SkuProduct
- type StockAttr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOrder ¶
func AddOrder(clt *core.Client, req *ImportOrderRequest, isHistory uint) (err error)
导入订单 开发者可以在用户支付完成后,同步小程序/H5/APP订单数据至好物圈(H5/APP订单需保证调用支付接口的H5/APP与导入数据的小程序绑定在同一个微信开放平台帐号下)。 历史订单导入:在首次接入时,开发者需导入最近三个月的”历史订单“数据,导入数据有助于物品在搜索中获得更好的曝光,帮助新接入的商家在搜索中实现冷启动。
func AddShoppingList ¶
func AddShoppingList(clt *core.Client, req *AddShoppingListRequest) (err error)
导入收藏 开发者可以在用户添加物品到购物车时,同步物品数据至好物圈的收藏列表。在首次接入时,开发者需导入用户购物车中的所有物品。导入数据有助于物品在搜索中获得更好的曝光,同时也保障用户侧获得一致的体验
func DeleteAllShoppingList ¶
删除用户的所有收藏 开发者可以删除用户在好物圈中指定商家的所有收藏物品
func DeleteOrder ¶
func DeleteOrder(clt *core.Client, req *DeleteOrderRequest) (err error)
删除订单 用户可以对订单进行删除
func DeleteShoppingList ¶
func DeleteShoppingList(clt *core.Client, req *DeleteShoppingListRequest) (err error)
删除收藏 开发者可以在用户从购物车删除物品时,同步将物品数据从好物圈的收藏中删除
func ImportMedia ¶
func ImportMedia(clt *core.Client, req *ImportMediaRequest) (err error)
更新或导入媒体信息 开发者可以对好物圈收藏/搜索场景下媒体(音频、视频)信息进行导入或更新
func ImportProduct ¶
func ImportProduct(clt *core.Client, req *ImportProductRequest) (err error)
更新或导入物品信息 开发者可以对好物圈收藏/搜索场景下物品信息进行导入或更新,如上架状态改变、物品售罄、价格更新等。如果物品仅支持到店提货或到家送货,poi_list必填;如果物品同时支持线上物流配送,该字段应为空。
func SetCanBeSearch ¶
小程序的物品是否可被搜索 接入好物圈的小程序默认打开物品搜索,开发者可通过此接口进行调整。当“小程序打开物品搜索”且“物品的状态为可以被搜索”的情况下,小程序的物品可被搜索。
func UpdateOrder ¶
func UpdateOrder(clt *core.Client, req *ImportOrderRequest, isHistory uint) (err error)
更新订单信息 开发者对订单信息进行更新,如订单状态改变等
Types ¶
type AddShoppingListRequest ¶
type Brand ¶
type Brand struct {
Logo string `json:"logo,omitempty"` // 商家logo,不填的话,默认取小程序头像
Name string `json:"name,omitempty"` // 商家名称,不填的话,默认取小程序名字
Phone string `json:"phone,omitempty"` // 用于售后场景的商家联系电话,便于用户咨询和问题解决
Page *DetailPage `json:"contact_detail_page,omitempty"` // 联系商家页面
}
type DeleteOrderRequest ¶
type DeleteShoppingListRequest ¶
type DeleteShoppingListRequest struct {
OpenId string `json:"user_open_id"`
SkuProductList []SkuProduct `json:"sku_product_list"`
}
type DetailPage ¶
type Express ¶
type Express struct {
Name string `json:"name,omitempty"` // 收件人姓名
Phone string `json:"phone,omitempty"` // 收件人联系电话
Address string `json:"address,omitempty"` // 收件人地址
Price int `json:"price"` // 运费,单位:分
NationalCode string `json:"national_code,omitempty"` // 行政区划代码
Country string `json:"country,omitempty"` // 国家
Province string `json:"province,omitempty"` // 省份
City string `json:"city,omitempty"` // 城市
District string `json:"district,omitempty"` // 区
PackageList []ExpressPackage `json:"express_package_info_list,omitepty"` // 包裹中的物品信息
}
type ExpressGood ¶
type ExpressPackage ¶
type ExpressPackage struct {
CompanyId int `json:"express_company_id"` // 快递公司编号,参见快递公司信息
CompanyName string `json:"express_company_name"` // 快递公司名
Code string `json:"express_code"` // 快递单号
ShipTime int64 `json:"ship_time"` // 发货时间,unix时间戳
Page DetailPage `json:"express_page"` // 快递详情页(小程序页面)
GoodsList []ExpressGood `json:"express_goods_info_list"` // 包裹物品信息
}
type Good ¶
type Good struct {
BizUin uint64 `json:"biz_uin"`
ItemCode string `json:"item_code"`
SkuId string `json:"sku_id"`
Title string `json:"title"`
Quantity uint `json:"quantity"`
CreateTime int64 `json:"create_time"`
UpdateTime int64 `json:"update_time"`
Source int `json:"source"`
Status int `json:"status"`
FromScene int `json:"from_scene"`
}
type ImportMediaRequest ¶
type ImportMediaRequest struct {
MediaList []Media `json:"media_list"`
}
type ImportOrderRequest ¶
type ImportOrderRequest struct {
OrderList []Order `json:"order_list"`
}
type ImportProductRequest ¶
type ImportProductRequest struct {
ProductList []Product `json:"product_list"`
}
type Invoice ¶
type Invoice struct {
Type uint `json:"type"` // 抬头类型,0:单位,1:个人
Title string `json:"title"` // 发票抬头
TaxNumber string `json:"tax_number,omitempty"` // 发票税号
CompanyAddress string `json:"company_address,omitempty"` // 单位地址
Telephone string `json:"telephone,omitempty"` // 手机号码
BankName string `json:"bank_name,omitempty"` // 银行名称
BankAccount string `json:"bank_account,omitempty"` // 银行账号
Page DetailPage `json:"invoice_detail_page,omitempty"` // 发票详情页(小程序页面)
}
type Media ¶
type Media struct {
ItemCode string `json:"item_code"` // 媒体ID,需要保证唯一性
Title string `json:"title"` // 媒体名称,如歌曲名、视频标题
Desc string `json:"desc,omitempty"` // 媒体描述,如歌手名、视频描述
ImageList []string `json:"image_list"` // 物品图片链接列表,图片宽度必须大于750px,宽高比建议4:3 - 1:1之间
AppPath string `json:"src_wxapp_path"` // 媒体来源小程序路径
Info MediaInfo `json:"media_info,omitempty"` // 媒体的播放信息
}
type Order ¶
type Order struct {
Id string `json:"order_id"` // 订单id,需要保证唯一性
CreateTime int64 `json:"create_time,omitempty"` // 订单创建时间,unix时间戳
PayFinishTime int64 `json:"pay_finish_time,omitempty"` // 支付完成时间,unix时间戳
Desc string `json:"desc,omitempty"` // 订单备注
Fee int `json:"fee,omitempty"` // 订单金额,单位:分
TransId string `json:"trans_id,omitempty"` // 微信支付订单id,对于使用微信支付的订单,该字段必填
Status uint `json:"status"` // 订单状态,3:支付完成 4:已发货 5:已退款 100: 已完成
Ext OrderExt `json:"ext_info"` // 订单扩展信息
}
type OrderExt ¶
type OrderExt struct {
Product *OrderProductList `json:"product_info,omitempty"` // 物品相关信息
Express *Express `json:"express_info,omitempty"` // 快递信息
Promotion *Promotion `json:"promotion_info,omitempty"` // 订单优惠信息
Brand *Brand `json:"brand_info,omitempty"` // 商家信息
Invoice *Invoice `json:"invoce_info,omitempty"` // 发票信息,对于开发票订单,该字段必填
PaymentMethod uint `json:"payment_method,omitempty"` // 订单支付方式,0:未知方式 1:微信支付 2:其他支付方式
OpenId string `json:"user_open_id"` // 用户的openid
Page *DetailPage `json:"order_detail_page,omitempty"` // 订单详情页(小程序页面)
TotalFee int `json:"total_fee,omitempty"` // 订单物品合计金额(优惠前金额,不填写的话,平台默认用物品的total fee累加)
}
type OrderProduct ¶
type OrderProduct struct {
ItemCode string `json:"item_code"` // 物品ID(SPU ID),要求appid下全局唯一
SkuId string `json:"sku_id"` // sku_id
Amount uint `json:"amount"` // 物品数量
TotalFee int `json:"total_fee"` // 物品总价,单位:分
ThumbUrl string `json:"thumb_url"` // 物品图片,图片宽度必须大于750px,宽高比建议4:3 - 1:1之间
Title string `json:"title"` // 物品名称
Desc string `json:"desc,omitempty"` // 物品详细描述
UnitPrice int `json:"unit_price"` // 物品单价(实际售价),单位:分
OriginalPrice int `json:"original_price"` // 物品原价,单位:分
StockAttrInfo []StockAttr `json:"stock_attr_info,omitempty"` // 物品属性列表
CategoryList []string `json:"category_list"` // 物品类目列表
Page DetailPage `json:"item_detail_page"` // 物品详情页(小程序页面)
CanBeSearch bool `json:"can_be_search"` // 物品能否被搜索(默认true可以被搜索)
BarCodeInfo *BarCode `json:"bar_code_info,omitempty"` // 物品的条形码信息
PlatformCategoryList []Category `json:"platform_category_list,omitempty"` // 物品平台类目列表,填写的每个类目必须在好物圈物品类目表列出,多级类目只填最后一级(如完整类目为"运动户外-运动服饰-运动裤",只需要填"运动裤"的类目ID与类目名)
}
type OrderProductList ¶
type OrderProductList struct {
ItemList []OrderProduct `json:"item_list"` // 包含订单中所有物品的信息
}
type Poi ¶
type Poi struct {
Lng float64 `json:"longitude"` // 门店的经度,WGS84标准
Lat float64 `json:"latitude"` // 门店的纬度,WGS84标准
Radius float64 `json:"radius"` // 门店可送达半径,单位km
BusinessName string `json:"business_name"` // 门店名称(仅为商户名,如:国美、麦当劳,不应包含地区、地址、分店名等信息,错误示例:北京国美),20个字符以内
BranchName string `json:"branch_name"` // 分店名称(不应包含地区信息,不应与门店名有重复,错误示例:北京王府井店),20个字符以内
Address string `json:"address"` // 门店地址(不包含省市区信息,如:新港中路123号)
}
type Product ¶
type Product struct {
ItemCode string `json:"item_code"` // 物品ID(SPU ID),要求appid下全局唯一
Title string `json:"title"` // 物品名称
Desc string `json:"desc,omitempty"` // 物品描述
CategoryList []string `json:"category_list"` // 物品类目列表,用于搜索排序
ImageList []string `json:"image_list"` // 物品图片链接列表,图片宽度必须大于750px,宽高比建议4:3 - 1:1之间
AppPath string `json:"src_wxapp_path"` // 物品来源小程序路径
SkuList []Sku `json:"sku_list,omitempty"` // 物品SKU列表,单次导入不超过16个SKU,微信后台会合并多次导入的SKU
SkuInfo *Sku `json:"sku_info,omitempty"` // 物品SKU信息,微信后台会合并多次导入的SKU
AttrList []Attr `json:"attr_list,omitempty"` // 物品SPU属性
Version int `json:"version,omitempty"` // 非高并发更新数据的场景不建议填写此字段。数据版本号,需按照更新递增
CanBeSearch bool `json:"can_be_search"` // 物品能否被搜索(默认true可以被搜索)
BrandInfo *Brand `json:"brand_info,omitempty"` // 商家信息
PlatformCategoryList []Category `json:"platform_category_list,omitempty"` // 物品平台类目列表,填写的每个类目必须在好物圈物品类目表列出,多级类目只填最后一级(如完整类目为"运动户外-运动服饰-运动裤",只需要填"运动裤"的类目ID与类目名)
UpdateTime int64 `json:"update_time,omitempty"` // 加入购物车的时间,unix 秒级时间戳,不填默认为当前时间
}
type QueryProductRequest ¶
type QueryProductRequest struct {
KeyList []QueryKey `json:"key_list"`
}
type QueryProductResponse ¶
func QueryProduct ¶
func QueryProduct(clt *core.Client, req *QueryProductRequest) (resp QueryProductResponse, err error)
查询物品信息 开发者可以对导入到好物圈中的物品信息进行查询,接口说明如下
type QueryShoppingListResponse ¶
func QueryShoppingList ¶
func QueryShoppingList(clt *core.Client, req *QueryShoppingListRequest, queryType QueryType) (resp QueryShoppingListResponse, err error)
查询用户收藏信息 开发者可以查询用户在好物圈中指定商家的收藏物品
type Sku ¶
type Sku struct {
Id string `json:"sku_id"` // 物品sku_id,特殊情况下可以填入与item_code一致
Price int64 `json:"price"` // 物品价格,分为单位
OriginalPrice int64 `json:"original_price,omitempty"` // 物品原价,分为单位
Status uint `json:"status"` // 物品状态,1:在售,2:停售,3:售罄
AttrList []Attr `json:"sku_attr_list,omitempty"` // sku属性列表,参考attr_list
PoiList []Poi `json:"poi_list,omitempty"` // 物品所在门店的列表。如果物品仅支持到店提货或到家送货,该字段必填;如果物品同时支持线上物流配送,该字段应为空。
Version int `json:"version,omitempty"` // 非高并发更新数据的场景不建议填写此字段。数据版本号,需按照更新递增
BarCodeInfo *BarCode `json:"bar_code_info,omitempty"` // 物品的条形码信息
}