merchant

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExpress

func AddExpress(clt *core.Client, express *Express) (err error)

增加邮费模板

func AddGroup

func AddGroup(clt *core.Client, name string, productIds []string) (groupId int, err error)

添加分组

func AddStock

func AddStock(clt *core.Client, productId string, skuInfo string, count int) (err error)

增加库存 @param productId 商品ID @param skuInfo sku信息,格式"id1:vid1;id2:vid2",如商品为统一规格,则此处赋值为空字符串即可 @param count 增加的库存数量

func Create

func Create(clt *core.Client, product *Product) (err error)

创建商品.

func Delete

func Delete(clt *core.Client, productId string) (err error)

删除商品.

func DeleteExpress

func DeleteExpress(clt *core.Client, templateId int) (err error)

删除邮费模板

func DeleteGroup

func DeleteGroup(clt *core.Client, groupId int) (err error)

删除分组信息

func ReduceStock

func ReduceStock(clt *core.Client, productId string, skuInfo string, count int) (err error)

减少库存 @param productId 商品ID @param skuInfo sku信息,格式"id1:vid1;id2:vid2",如商品为统一规格,则此处赋值为空字符串即可 @param count 增加的库存数量

func Update

func Update(clt *core.Client, product *Product) (err error)

更新商品信息

func UpdateExpress

func UpdateExpress(clt *core.Client, express *Express) (err error)

更新邮费模板

func UpdateGroup

func UpdateGroup(clt *core.Client, groupId int, name string) (err error)

修改分组明成功

func UpdateGroupProucts

func UpdateGroupProucts(clt *core.Client, groupId int, addList []string, removeList []string) (err error)

编辑分组商品信息

func UpdateStatus

func UpdateStatus(clt *core.Client, productId string, status int) (err error)

商品上下架接口 @param status

func UploadImage

func UploadImage(clt *core.Client, imgFilePath string) (url string, err error)

UploadImage 上传图片到微信服务器, 返回的图片url给其他场景使用, 比如图文消息, 卡卷, POI.

func UploadImageFromReader

func UploadImageFromReader(clt *core.Client, filename string, reader io.Reader) (url string, err error)

UploadImageFromReader 上传图片到微信服务器, 返回的图片url给其他场景使用, 比如图文消息, 卡卷, POI.

NOTE: 参数 filename 不是文件路径, 是 multipart/form-data 里面 filename 的值.

Types

type AttrExt

type AttrExt struct {
	Location         *AttrExtLocation `json:"location"`
	IsPostFree       int              `json:"isPostFree"`
	IsHasReceipt     int              `json:"isHasReceipt"`
	IsUnderGuaranty  int              `json:"isUnderGuaranty"`
	IsSupportReplace int              `json:"isSupportReplace"`
}

type AttrExtLocation

type AttrExtLocation struct {
	Country  string `json:"country"`
	Province string `json:"province"`
	City     string `json:"city"`
	Address  string `json:"address"`
}

type CateInfo

type CateInfo struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

func GetSubCate

func GetSubCate(clt *core.Client, cateId string) (list []*CateInfo, err error)

获取分类的所有子分类接口 @param cateId: 大分类ID(根节点分类id为1) 微信上所有的商品类目分为四级,估计是要拉四级类目

type CateProperty

type CateProperty struct {
	Id            string          `json:"id"`
	Name          string          `json:"name"`
	PropertyValue []*CateProperty `json:"property_value"`
}

func GetCateProperties

func GetCateProperties(clt *core.Client, cateId string) (list []*CateProperty, err error)

获取分类属性信息

type DeliveryInfo

type DeliveryInfo struct {
	DeliveryType int                    `json:"delivery_type"` // 运费类型(0-使用下面express字段的默认模板, 1-使用template_id代表的邮费模板, 详见邮费模板相关API)
	TemplateId   int                    `json:"template_id"`
	Express      []*DeliveryInfoExpress `json:"express"`
}

type DeliveryInfoExpress

type DeliveryInfoExpress struct {
	Id    int64 `json:"id"`
	Price int64 `json:"price"`
}

type Express

type Express struct {
	TemplateId int           `json:"Id"`
	Name       string        `json:"Name"`      // 邮费模板名称
	Assumer    int           `json:"Assumer"`   // 支付方式(0-买家承担运费, 1-卖家承担运费)
	Valuation  int           `json:"Valuation"` // 计费单位(0-按件计费, 1-按重量计费, 2-按体积计费,目前只支持按件计费,默认为0)
	TopFee     []*TopFeeItem `json:"TopFee"`    // 具体运费计算
}

Express 快递模板

func GetExpress

func GetExpress(clt *core.Client, templateId int) (express *Express, err error)

获取邮费模板详情 @param templateId 模板ID

func GetExpressList

func GetExpressList(clt *core.Client) (list []*Express, err error)

获取邮费模板列表

type GroupInfo

type GroupInfo struct {
	GroupId     string   `json:"group_id"`
	GroupName   string   `json:"group_name"`
	ProductList []string `json:"product_list"`
}

func GetGroup

func GetGroup(clt *core.Client, groupId int) (group *GroupInfo, err error)

获取邮费模板 @param templateId 模板ID

func GetGroupList

func GetGroupList(clt *core.Client) (list []*GroupInfo, err error)

获取邮费模板列表

type Product

type Product struct {
	ProductId    string        `json:"product_id"`
	ProductBase  *ProductBase  `json:"product_base"`
	SkuList      []*SkuItem    `json:"sku_list"`
	AttrExt      *AttrExt      `json:"attrext"`
	DeliveryInfo *DeliveryInfo `json:"delivery_info"`
}

商品

func Get

func Get(clt *core.Client, productId string) (product *Product, err error)

查询商品.

func GetByStatus

func GetByStatus(clt *core.Client, status int) (list []*Product, err error)

获取指定状态的所有商品 @param status 商品状态(0-全部, 1-上架, 2-下架)

type ProductBase

type ProductBase struct {
	CategoryId []int `json:"category_id"`
	Property   []*struct {
		Id  string `json:"id"`
		Vid string `json:"vid"`
	} `json:"property"`
	Name       string           `json:"name"`
	SkuInfo    []*SkuInfo       `json:"sku_info"`
	MainImg    string           `json:"main_img"`
	Img        []string         `json:"img"`
	Detail     []*ProductDetail `json:"detail"`
	DetailHtml string           `json:"detail_html"`
	BuyLimit   int              `json:"buy_limit"`
}

type ProductDetail

type ProductDetail struct {
	Text string `json:"text"`
	Img  string `json:"img`
}

type PropertyValue

type PropertyValue struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type SkuInfo

type SkuInfo struct {
	Id  string   `json:"id"`
	Vid []string `json:"vid"`
}

type SkuItem

type SkuItem struct {
	SkuId       string `json:"sku_id"`
	Price       int64  `json:"price"`
	IconUrl     string `json:"icon_url"`
	ProductCode string `json:"product_code"`
	OriPrice    int64  `json:"ori_price"`
	Quantity    int    `json:"quantity"`
}

SkuItem 库存

type SkuListItem

type SkuListItem struct {
	SkuId       string `json:"sku_id"`
	Price       int64  `json:"price"`
	IconUrl     string `json:"icon_url"`
	ProductCode string `json:"product_code"`
	OriPrice    int64  `json:"ori_price"`
	Quantity    int    `json:"quantity"`
}

type SkuTable

type SkuTable struct {
	Id        string         `json:"id"`
	Name      string         `json:"name"`
	ValueList []SkuValueList `json:"value_list"`
}

func GetCateSku

func GetCateSku(clt *core.Client, cateId string) (list []*SkuTable, err error)

获取分类sku信息

type SkuValueList

type SkuValueList struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type StockSkuInfo

type StockSkuInfo struct {
	Id  string
	Vid string
}

type TopFeeItem

type TopFeeItem struct {
	Type   int `json:"Type"` // 快递类型ID(参见增加商品/快递列表)
	Normal struct {
		StartStandards int `json:"StartStandards"` // 起始计费数量(比如计费单位是按件, 填2代表起始计费为2件)
		StartFees      int `json:"StartFees"`      // 起始计费金额(单位: 分)
		AddStandards   int `json:"AddStandards"`   // 递增计费数量
		AddFees        int `json:"AddFees"`        // 递增计费金额(单位 : 分)
	} `json:"Normal"`
	Custom []struct {
		StartStandards int    `json:"StartStandards"`
		StartFees      int    `json:"StartFees"`
		AddStandards   int    `json:"AddStandards"`
		AddFees        int    `json:"AddFees"`
		DestCountry    string `json:"DestCountry"`  // 指定国家(详见《地区列表》说明)
		DestProvince   string `json:"DestProvince"` // 指定省份(详见《地区列表》说明)
		DestCity       string `json:"DestCity"`     // 指定城市(详见《地区列表》说明)
	} `json:"Custom"`
}

Express 快递费用模板

Jump to

Keyboard shortcuts

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