mall

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

微信好物圈 SDK

Documentation

Overview

微信好物圈 SDK

Index

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 DeleteAllShoppingList(clt *core.Client, openId string) (err error)

删除用户的所有收藏 开发者可以删除用户在好物圈中指定商家的所有收藏物品

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 SetCanBeSearch(clt *core.Client, canBeSearch bool) (err error)

小程序的物品是否可被搜索 接入好物圈的小程序默认打开物品搜索,开发者可通过此接口进行调整。当“小程序打开物品搜索”且“物品的状态为可以被搜索”的情况下,小程序的物品可被搜索。

func UpdateOrder

func UpdateOrder(clt *core.Client, req *ImportOrderRequest, isHistory uint) (err error)

更新订单信息 开发者对订单信息进行更新,如订单状态改变等

Types

type AddShoppingListRequest

type AddShoppingListRequest struct {
	OpenId      string    `json:"user_open_id"`
	ProductList []Product `json:"sku_product_list"`
}

type Attr

type Attr struct {
	Name  string `json:"name"`  // 属性名称
	Value string `json:"value"` // 属性内容
}

type BarCode

type BarCode struct {
	Type string `json:"barcode_type"` // 条形码类型, 目前支持"ean8", "ean13", 前者对应的barcode为8位纯数字字符串,后者为13位纯数字字符串
	Code string `json:"barcode"`      // 条形码数字字符串
}

type Brand

type Brand struct {
	Name  string      `json:"name,omitempty"`                // 商家名称,不填的话,默认取小程序名字
	Phone string      `json:"phone,omitempty"`               // 用于售后场景的商家联系电话,便于用户咨询和问题解决
	Page  *DetailPage `json:"contact_detail_page,omitempty"` // 联系商家页面
}

type Category

type Category struct {
	Id   uint   `json:"category_id"`   // 平台类目ID
	Name string `json:"category_name"` // 平台类目名称
}

type DeleteOrderRequest

type DeleteOrderRequest struct {
	OrderId string `json:"order_id"`
	OpenId  string `json:"user_open_id"`
}

type DeleteShoppingListRequest

type DeleteShoppingListRequest struct {
	OpenId         string       `json:"user_open_id"`
	SkuProductList []SkuProduct `json:"sku_product_list"`
}

type DetailPage

type DetailPage struct {
	Path   string `json:"path,omitempty"`        // 小程序物品详情页跳转链接
	H5Path string `json:"src_h5_path,omitempty"` // h5物品详情页跳转链接
	KfType uint   `json:"kf_type,omitempty"`     // 在线客服类型 1 没有在线客服; 2 微信客服消息; 3 小程序自有客服; 4 公众号h5自有客服
}

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 ExpressGood struct {
	ItemCode string `json:"item_code"` // 物品id
	SkuId    string `json:"sku_id"`    // SkuID
}

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 MediaInfo

type MediaInfo struct {
	Type    int    `json:"type"`     // 区分视频还是音乐, 1代表音频类, 2代表视频类
	PlayUrl string `json:"play_url"` // 媒体的播放url
}

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 Promotion

type Promotion struct {
	Discount int `json:"discount"` // 优惠金额
}

type QueryKey

type QueryKey struct {
	ItemCode string `json:"item_code"`
}

type QueryProductRequest

type QueryProductRequest struct {
	KeyList []QueryKey `json:"key_list"`
}

type QueryProductResponse

type QueryProductResponse struct {
	core.Error
	ProductList []Product `json:"product_list"`
}

func QueryProduct

func QueryProduct(clt *core.Client, req *QueryProductRequest) (resp QueryProductResponse, err error)

查询物品信息 开发者可以对导入到好物圈中的物品信息进行查询,接口说明如下

type QueryShoppingListRequest

type QueryShoppingListRequest struct {
	OpenId  string     `json:"user_open_id"`       // 用户的openid
	KeyList []QueryKey `json:"key_list,omitempty"` // batchquery模式下必填, 单次请求物品数量不可超过20个
	Offset  int        `json:"offset,omitempty"`   // 按页查询时起始位置偏移,默认0
	Count   int        `json:"count,omitempty"`    // 按页查询时单次最大返回数量,默认20
}

type QueryShoppingListResponse

type QueryShoppingListResponse struct {
	core.Error
	GoodsList []Good `json:"goods_list"`
}

func QueryShoppingList

func QueryShoppingList(clt *core.Client, req *QueryShoppingListRequest, queryType QueryType) (resp QueryShoppingListResponse, err error)

查询用户收藏信息 开发者可以查询用户在好物圈中指定商家的收藏物品

type QueryType

type QueryType = string
const (
	BatchQuery QueryType = "batchquery"
	GetByPage  QueryType = "getbypage"
)

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"`  // 物品的条形码信息
}

type SkuProduct

type SkuProduct struct {
	ItemCode string `json:"item_code"` // 物品ID(SPU ID),要求appid下全局唯一
	SkuId    string `json:"sku_id"`    // 物品sku_id,特殊情况下可以填入与item_code一致
}

type StockAttr

type StockAttr struct {
	Name struct {
		Name string `json:"name"` // 属性名称
	} `json:"attr_name"` // 属性名称
	Value struct {
		Name string `json:"name"` // 属性值
	} `json:"attr_value"` // 属性内容
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL