商品相关接口

This commit is contained in:
lzh
2025-05-28 09:59:12 +08:00
parent 58cf9d920d
commit 20a3b65f01
6 changed files with 659 additions and 0 deletions

201
weipinshang/model.go Normal file
View File

@@ -0,0 +1,201 @@
package wps
//type BaseRes struct {
// Code int64 `json:"code"` //返回编码[0为成功其它为失败]
// Msg string `json:"msg"` //返回信息[请求接口消息]
// Data interface{} `json:"data"` //返回数据
//}
// GoodBrandReq 查询商品的品牌
type GoodBrandReq struct {
PageNo string `json:"pageNo"` //页码
PageSize string `json:"pageSize"` //条数
CBrandName string `json:"c_brand_name"` //品牌名称 模糊查询
}
type GoodBrandRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data GoodBrandList `json:"data"` //返回数据
}
type GoodBrandList struct {
PageIndex interface{} `json:"pageIndex"` //有时是字符串有时是int
PageCount int `json:"pageCount"`
DataCount int `json:"dataCount"`
List []GoodBrand `json:"list"`
}
type GoodBrand struct {
CId int `json:"c_id"` //自增id
CBrandName string `json:"c_brand_name"` //名称
CBrandLogoUrl string `json:"c_brand_logo_url"` //logo地址
CCreateTime string `json:"c_create_time"`
CUpdateTime string `json:"c_update_time"`
}
// GetGoodsClassifyReq 查询商品分类
type GetGoodsClassifyReq struct {
CLevel string `json:"c_level"` //分类层级1为一级分类 2为二级分类 3为三级分类不传默认为1
CParentCode string `json:"c_parent_code"` //上级分类code
}
type GetGoodsClassifyRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data []GoodsClassify `json:"data"` //返回数据
}
type GoodsClassify struct {
CId int `json:"c_id"` //自增id
CName string `json:"c_name"` //名称
CCode string `json:"c_code"` //分类code
CLevel int `json:"c_level"` //层级
CParentCode string `json:"c_parent_code"` //上级code
}
// GetGoodsListReq 获取全部商品列表接口(若使用该接口 需跟对接人说明,开启商品消息全推)
type GetGoodsListReq struct {
PageNo string `json:"pageNo"` //页码 [默认查询第1页]
PageSize string `json:"pageSize"` //显示条数 [默认显示10条 最大值100]
IsSort int `json:"is_sort"` //排序 [不传默认为正序传1为倒序]
ProfitSpace int `json:"profitSpace"` //利润空间 [1=>5%以下,2=>5%-10%,3=>10%-20%,4=>20%-50%,5=>50%-100%,6=>100%-200%,7=>200%-500%,8=>500%-700%,9=>700%-900%,10=>900%以上]
}
type GetGoodsListRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data GetGoodsList `json:"data"` //返回数据
}
type GetGoodsList struct {
PageIndex string `json:"pageIndex"`
PageCount int `json:"pageCount"`
DataCount int `json:"dataCount"`
List []Goods `json:"list"`
}
type Goods struct {
CId int `json:"c_id"` // 序号商品ID
CFatherGoodsId string `json:"c_father_goods_id"` // 商品父类ID
CGoodsName string `json:"c_goods_name"` // 商品名称
CGoodsImage string `json:"c_goods_image"` // 商品图片1张商品主图
CClassId int `json:"c_class_id"` // 分类ID一级
CClassDesc string `json:"c_class_desc"` // 分类描述(一级)
CClass2Id int `json:"c_class2_id"` // 二级分类ID
CClass2Desc string `json:"c_class2_desc"` // 二级分类描述
CBrandId int `json:"c_brand_id"` // 品牌ID
CBrandName string `json:"c_brand_name"` // 品牌名称
CNoDeliveryArea string `json:"c_no_delivery_area"` // 不发货地区,为 "0" 或 "" 表示不限
CStartDatetime string `json:"c_start_datetime"` // 上架时间格式yyyy-MM-dd HH:mm:ss
CStopDatetime string `json:"c_stop_datetime"` // 下架时间格式yyyy-MM-dd HH:mm:ss
COriginalPrice string `json:"c_original_price"` // 商品原价(吊牌价)
CSalePrice string `json:"c_sale_price"` // 建议售价
CInPrice string `json:"c_in_price"` // 进货价格
CGoodsStockValid int `json:"c_goods_stock_valid"` // 当前有效库存(下单库存,不足时下单失败)
CGoodsStockStart int `json:"c_goods_stock_start"` // 原始库存(商品录入时库存)
CSpecifications string `json:"c_specifications"` // 商品详细规格(商品属性描述)
CCompanyCode string `json:"c_company_code"` // 供应商编码
}
// GetGoodsdeptReq (推荐使用)获取后台已选商品列表接口
type GetGoodsdeptReq struct {
PageNo string `json:"pageNo"` //页码 [默认查询第1页]
PageSize string `json:"pageSize"` //显示条数 [默认显示10条 最大值100]
ProfitSpace int `json:"profitSpace"` //利润空间 [1=>5%以下,2=>5%-10%,3=>10%-20%,4=>20%-50%,5=>50%-100%,6=>100%-200%,7=>200%-500%,8=>500%-700%,9=>700%-900%,10=>900%以上]
}
type GetGoodsdeptRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data Goodsdept `json:"data"` //返回数据
}
type Goodsdept struct {
PageIndex string `json:"pageIndex"`
PageCount int `json:"pageCount"`
DataCount int `json:"dataCount"`
List []Goods `json:"list"`
}
// GetDetailsGoodsReq 获取批量商品详情接口
type GetDetailsGoodsReq struct {
FatherId string `json:"father_id"` //商品父级ID Spu编码
}
type GetDetailsGoodsRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data []GoodsItem `json:"data"` //返回数据
}
type GoodsItem struct {
CExhibitionID string `json:"c_exhibition_id"` // 会场ID特卖商品时有值
CFatherGoodsID string `json:"c_father_goods_id"` // 父级商品ID
CGoodsName string `json:"c_goods_name"` // 商品名称
CGoodsDescription string `json:"c_goods_description"` // 商品描述
CNoDeliveryArea string `json:"c_no_delivery_area"` // 不发货地区,为"0"或""表示不限
COriginalPrice string `json:"c_original_price"` // 商品原价(吊牌价)
CInPrice string `json:"c_in_price"` // 商品进价
CSalePrice string `json:"c_sale_price"` // 商品建议售价
CGoodsImage string `json:"c_goods_image"` // 商品主图
CDetailsImages string `json:"c_details_images"` // 商品详情图(多图用“;”分隔)
CBannerImages string `json:"c_banner_images"` // 商品banner图多图用“;”分隔)
CBrandID int `json:"c_brand_id"` // 品牌ID
CBrandIcon string `json:"c_brand_icon"` // 品牌图标
CBrandName string `json:"c_brand_name"` // 品牌名称
CClassID int `json:"c_class_id"` // 一级分类ID
CClassDesc string `json:"c_class_desc"` // 一级分类描述
CClass2ID int `json:"c_class2_id"` // 二级分类ID
CClass2Desc string `json:"c_class2_desc"` // 二级分类描述
CClass3ID int `json:"c_class3_id"` // 三级分类ID
CClass3Desc string `json:"c_class3_desc"` // 三级分类描述
CIsShow int `json:"c_is_show"` // 商品状态0下架1上架
CStartDatetime string `json:"c_start_datetime"` // 上架时间
CStopDatetime string `json:"c_stop_datetime"` // 下架时间
CSpecifications string `json:"c_specifications"` // 商品详细规格(商品属性描述)
CCompanyCode string `json:"c_company_code"` // 供应商编码
GoodsSku []GoodsSkuItem `json:"goods_sku"` // 商品SKU列表
}
// 商品SKU信息
type GoodsSkuItem struct {
CFatherGoodsID string `json:"c_father_goods_id"` // 父级商品ID
CGoodsID string `json:"c_goods_id"` // 商品ID
CGoodsName string `json:"c_goods_name"` // 商品规格名称
COriginalPrice string `json:"c_original_price"` // 商品市场价
CInPrice string `json:"c_in_price"` // 商品进价
CSalePrice string `json:"c_sale_price"` // 商品建议售价
CGoodsColor string `json:"c_goods_color"` // 商品颜色
CGoodsSize string `json:"c_goods_size"` // 商品尺寸
CGoodsImage string `json:"c_goods_image"` // 商品列表图片
CGoodsStockStart int `json:"c_goods_stock_start"` // 初始总库存
CGoodsStockValid int `json:"c_goods_stock_valid"` // 有效库存(下单库存参考)
CBuyMinNum int `json:"c_buy_min_num"` // 最小购买数量
CBuyMaxNum int `json:"c_buy_max_num"` // 最大购买数量
}
type GetGoodsDetailsReq struct {
FatherId string `json:"father_id"` //商品父级ID Spu编码
}
type GetGoodsDetailsRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data GoodsItem `json:"data"` //返回数据
}
type GetGoodsStockReq struct {
FatherId string `json:"father_id"` //商品父级ID Spu编码
}
type GetGoodsStockRes struct {
Code int64 `json:"code"` //返回编码[0为成功其它为失败]
Msg string `json:"msg"` //返回信息[请求接口消息]
Data []GoodsStock `json:"data"` //返回数据
}
type GoodsStock struct {
CGoodsId string `json:"c_goods_id"`
CStock int `json:"c_stock"`
}