Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
Y
yc-sdk-golang
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
赵雪如
yc-sdk-golang
Commits
6589fec4
提交
6589fec4
authored
3月 25, 2022
作者:
husiqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品部分
上级
9e6d00c5
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
419 行增加
和
41 行删除
+419
-41
goods.go
sdk/goods.go
+250
-3
goods_model.go
sdk/goods_model.go
+165
-0
model.go
sdk/model.go
+4
-38
没有找到文件。
sdk/goods.go
浏览文件 @
6589fec4
package
sdk
import
"encoding/json"
//商品
//商品
//商品列表
//
GoodsList
商品列表
func
(
c
*
Client
)
GoodsList
(
req
map
[
string
]
interface
{})
(
res
*
GoodsListRes
,
err
error
)
{
method
:=
"/local/goods"
param
:=
req
...
...
@@ -15,4 +15,251 @@ func (c *Client) GoodsList(req map[string]interface{}) (res *GoodsListRes, err e
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
\ No newline at end of file
}
//GoodsInfo 商品详情
func
(
c
*
Client
)
GoodsInfo
(
req
map
[
string
]
interface
{})
(
res
*
GoodsInfoRes
,
err
error
)
{
method
:=
"/local/goods/:"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Get
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//CreateGoods 添加商品
func
(
c
*
Client
)
CreateGoods
(
req
map
[
string
]
interface
{})
(
res
*
CreateGoodsRes
,
err
error
)
{
method
:=
"/local/goods"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//EditGoods 编辑商品
func
(
c
*
Client
)
EditGoods
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/goods"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
PUT
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//DoShelves 商品上下架
func
(
c
*
Client
)
DoShelves
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/goods"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Patch
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//OnSaleUpdate 不下架编辑
func
(
c
*
Client
)
OnSaleUpdate
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/goods/onsaleUpdate"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//GoodsStock 商品库存 数组性传参
func
(
c
*
Client
)
GoodsStock
(
req
[]
map
[
string
]
interface
{})
(
res
*
GetStockRes
,
err
error
)
{
method
:=
"/local/goods/stock"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Get
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//GoodsOperate 商品操作,上下架
func
(
c
*
Client
)
GoodsOperate
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/GoodsOperate"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//GoodsOperateAll 商品操作,上下架
func
(
c
*
Client
)
GoodsOperateAll
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/GoodsOperateAll"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//GoodsStockUpdate 商品库存修改
func
(
c
*
Client
)
GoodsStockUpdate
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/GoodsStockUpdate"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Get
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//DoGoodsStatus 删除 彻底删除 还原商品
func
(
c
*
Client
)
DoGoodsStatus
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/doGoodsStatus"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//Collect 反向增加商品
func
(
c
*
Client
)
Collect
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCollectRes
,
err
error
)
{
method
:=
"/local/collect"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//CancelOnSale 取消审核
func
(
c
*
Client
)
CancelOnSale
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/CancelOnsale"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//CancelOnSaleAll 批量取消审核
func
(
c
*
Client
)
CancelOnSaleAll
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/CancelOnsaleAll"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//CategoryUpdate 修改商品类目
func
(
c
*
Client
)
CategoryUpdate
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/category/update"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//SysLogSave 保存备注
func
(
c
*
Client
)
SysLogSave
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/sysLog/save"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//Stags 服务标签
func
(
c
*
Client
)
Stags
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/stags"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Get
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//PushGoods 渠道推送商品
func
(
c
*
Client
)
PushGoods
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/pushGoods"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//CancelPush 渠道撤回推送商品
func
(
c
*
Client
)
CancelPush
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/cancelPush"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
//ChannelAudit 渠道推送商品审核操作
func
(
c
*
Client
)
ChannelAudit
(
req
map
[
string
]
interface
{})
(
res
*
GoodsCommonRes
,
err
error
)
{
method
:=
"/local/channelAudit"
param
:=
req
data
,
_
:=
json
.
Marshal
(
param
)
resData
,
err
:=
c
.
Post
(
method
,
string
(
data
))
if
err
!=
nil
{
return
}
err
=
json
.
Unmarshal
(
resData
,
&
res
)
return
}
sdk/goods_model.go
0 → 100644
浏览文件 @
6589fec4
package
sdk
type
GoodsInfoRes
struct
{
commonRes
Data
GoodsInsertReq
`json:"data"`
}
type
GetStockRes
struct
{
commonRes
Data
[]
GetStock
`json:"data"`
}
type
GoodsCommonRes
struct
{
commonRes
Data
string
`json:"data"`
}
type
CreateGoodsRes
struct
{
commonRes
Data
struct
{
GoodsID
int
`json:"goodsId"`
}
`json:"data"`
}
type
GoodsCollectRes
struct
{
commonRes
Data
int
`json:"data"`
}
type
GoodsListRes
struct
{
commonRes
Data
GoodsList
`json:"data"`
}
type
GoodsList
struct
{
Count
int
`json:"count"`
DelCount
int
`json:"del_count"`
DownsaleCount
int
`json:"downsale_count"`
List
[]
Goods
`json:"list"`
}
type
Goods
struct
{
GoodsId
uint
`json:"goods_id"`
// 商品ID
GoodsName
string
`json:"goods_name"`
// 商品名称
CategoryId
uint
`json:"category_id"`
// 商品类别ID
DefaultImage
string
`json:"default_image"`
// 默认商品图片
JsPrice
int
`json:"js_price"`
// 商家平台结算价格
Price
int
`json:"price"`
// 现价
ScPrice
int
`json:"sc_price"`
// 市场价
GoodsNowStock
int
`json:"stock"`
// 当前库存
AddTime
int
`json:"add_time"`
// 添加时间
IsOn
int
`json:"is_on"`
//
SellerId
int
`json:"seller_id"`
// 添加用户ID
UpOnsale
int
`json:"up_onsale"`
// 申请上线 1:申请2:驳回
IsOnsale
int
`json:"is_onsale"`
// 是否上架
ProducingArea
string
`json:"producing_area"`
// 商品产地
Weight
float64
`json:"weight"`
// 商品重量
ProfitRate
float64
`json:"profit_rate"`
// 商品利润率
AftersaleTime
int
`json:"aftersale_time"`
// 售后时长
GoodsBrand
string
`json:"goods_brand"`
// 商品品牌
Unit
string
`json:"unit"`
// 单位, 如: 个/件/包
StoreName
string
`json:"store_name"`
// 店铺名称
LastPerateContent
string
`json:"last_perate_content"`
// 最后审核内容
ChannelName
string
`json:"channel_name"`
ChannelId
int
`json:"channel_id"`
OperateTime
int
`json:"operate_time"`
PushStatus
int
`json:"push_status"`
}
//GoodsInsertReq 商品详情,商品添加
type
GoodsInsertReq
struct
{
GoodsName
string
`p:"goods_name" v:"goods_name@required|length:1,50#请输入商品名称|长度为1到50个字" json:"goods_name"`
GoodsDes
string
`p:"goods_des" json:"goods_des"`
ProducingArea
string
`p:"producing_area" v:"producing_area@required#请输入产地" json:"producing_area"`
DeliverArea
string
`p:"deliver_area" v:"deliver_area@required#请输入发货地" json:"deliver_area"`
Unit
string
`p:"unit" v:"unit@required#请输入单位" json:"unit"`
GoodsBrand
string
`p:"goods_brand" v:"goods_brand@required#请输入品牌" json:"goods_brand"`
BrandId
int
`json:"brand_id"`
WebUrl
string
`json:"web_url"`
OutGoodsId
int
`json:"out_goods_id"`
Price
int
`p:"price" json:"price"`
JsPrice
int
`p:"js_price" json:"js_price"`
ScPrice
int
`p:"sc_price" json:"sc_price"`
GoodsNowStock
int
`json:"stock"`
DefaultImage
string
`json:"default_image"`
Description
string
`p:"description" v:"description@required#请输入商品详情" json:"description"`
CategoryId
int
`p:"category_id" v:"category_id@required|min:1#请输入分类id" json:"category_id"`
CategoryThreeId
int
`json:"category_three_id"`
CategoryThreeName
string
`json:"category_three_name"`
CategorySecondId
int
`json:"category_second_id"`
CategorySecondName
string
`json:"category_second_name"`
CategoryFirstId
int
`json:"category_first_id"`
CategoryFirstName
string
`json:"category_first_name"`
Weight
float64
`json:"weight"`
FreightId
int
`p:"freight_id" v:"freight_id@required|min:1#请选择运费模板" json:"freight_id"`
FreightName
string
`json:"freight_name"`
AftersaleTime
int
`p:"aftersale_time" d:"7" v:"aftersale_time@in:7,15,30#售后时长可选范围 7天,15天,30天" json:"aftersale_time"`
DelayCompensate
int
`p:"delay_compensate" d:"48" v:"delay_compensate@in:24, 48#延期时间可选范围 24,48小时" json:"delay_compensate"`
Stags
string
`json:"stags"`
IsOn
int
`p:"is_on" d:"1" json:"is_on"`
Imgs
[]
string
`json:"imgs"`
Specs
[]
Specs
`json:"specs"`
SpecsGroup
[]
SpecsGroup
`json:"specs_group"`
ProfitRate
float64
`json:"profit_rate"`
SellerId
int
`json:"seller_id"`
ChannelId
int
`json:"channel_id"`
SsoId
int
`json:"sso_id"`
Submit
int
`json:"submit"`
GoodsId
int
`json:"goods_id"`
StoreName
string
`json:"store_name"`
IsOnsale
int
`json:"is_onsale"`
UpOnsale
int
`json:"up_onsale"`
OperationLog
[]
StSysLog
`json:"operation_log"`
IsImport
int
`json:"-"`
Type
int
`json:"type" d:"1"`
//1编辑 2不下架编辑
PushStatus
int
`json:"push_status"`
PlatformCheckStatus
int
`json:"platform_check_status"`
Params
[]
Param
`json:"params"`
Video
string
`json:"video"`
IsOneSpec
int
`json:"is_onespec"`
}
type
StSysLog
struct
{
Id
uint
`orm:"id,primary" json:"id"`
//
SellerId
int
`orm:"seller_id" json:"seller_id"`
// 商户id
GoodsId
int
`orm:"goods_id" json:"goods_id"`
// 商品id
UserId
int
`orm:"user_id" json:"user_id"`
// 管理员id
UserName
string
`orm:"user_name" json:"user_name"`
// 管理员姓名
Type
int
`orm:"type" json:"type"`
// 1备注2审核通过3审核拒绝
Content
string
`orm:"content" json:"content"`
// 内容
CreatedTime
int
`orm:"created_time" json:"created_time"`
// 操作时间
}
//商品参数
type
Param
struct
{
Id
int
`json:"id"`
Title
string
`json:"title"`
Value
string
`json:"value"`
}
//商品规格
type
Specs
struct
{
Id
int
`json:"id"`
SpecName
string
`p:"spec_name" v:"spec_name@required#请输入规格名称" json:"spec_name"`
SpecValue
[]
SpecValue
`json:"spec_value"`
}
type
SpecValue
struct
{
Id
int
`json:"id"`
Img
string
`json:"img"`
Value
string
`p:"value" v:"value@required#请输入规格值" json:"value"`
SpecNameId
int
`json:"spec_name_id"`
}
type
SpecsGroup
struct
{
Id
int
`json:"id"`
SpecValues
[]
string
`json:"spec_values"`
GoodsNowStock
int
`json:"stock"`
JsPrice
int
`p:"js_price" v:"js_price@min:0#请输入sku指导售价" json:"js_price"`
Price
int
`p:"price" v:"price@min:0#请输入sku指导售价" json:"price"`
ScPrice
int
`p:"sc_price" v:"sc_price@min:0#请输入sku市场价" json:"sc_price"`
Weight
float64
`json:"weight"`
OutOptionId
int
`json:"out_option_id"`
Thumb
string
`json:"thumb"`
ProfitRate
float64
`json:"profit_rate"`
}
type
GetStock
struct
{
GoodsId
int
`json:"goods_id"`
SkuId
int
`json:"sku_id"`
Stock
int
`json:"stock"`
}
sdk/model.go
浏览文件 @
6589fec4
package
sdk
type
commonRes
struct
{
Code
int
`json:"code"`
Code
int
`json:"code"`
Message
string
`json:"message"`
}
type
GoodsListRes
struct
{
commonRes
Data
GoodsList
`json:"data"`
}
type
GoodsList
struct
{
GoodsId
uint
`json:"goods_id"`
// 商品ID
GoodsName
string
`json:"goods_name"`
// 商品名称
CategoryId
uint
`json:"category_id"`
// 商品类别ID
DefaultImage
string
`json:"default_image"`
// 默认商品图片
JsPrice
int
`json:"js_price"`
// 商家平台结算价格
Price
int
`json:"price"`
// 现价
ScPrice
int
`json:"sc_price"`
// 市场价
GoodsNowStock
int
`json:"stock"`
// 当前库存
AddTime
int
`json:"add_time"`
// 添加时间
IsOn
int
`json:"is_on"`
//
SellerId
int
`json:"seller_id"`
// 添加用户ID
UpOnsale
int
`json:"up_onsale"`
// 申请上线 1:申请2:驳回
IsOnsale
int
`json:"is_onsale"`
// 是否上架
ProducingArea
string
`json:"producing_area"`
// 商品产地
Weight
float64
`json:"weight"`
// 商品重量
ProfitRate
float64
`json:"profit_rate"`
// 商品利润率
AftersaleTime
int
`json:"aftersale_time"`
// 售后时长
GoodsBrand
string
`json:"goods_brand"`
// 商品品牌
Unit
string
`json:"unit"`
// 单位, 如: 个/件/包
StoreName
string
`json:"store_name"`
// 店铺名称
LastPerateContent
string
`json:"last_perate_content"`
// 最后审核内容
ChannelName
string
`json:"channel_name"`
ChannelId
int
`json:"channel_id"`
OperateTime
int
`json:"operate_time"`
PushStatus
int
`json:"push_status"`
}
type
BrandListRes
struct
{
commonRes
Data
struct
{
Count
int
`json:"count"`
Data
struct
{
Count
int
`json:"count"`
Data
[]
BrandListInfo
`json:"data"`
}
`json:"data"`
}
...
...
@@ -64,8 +31,7 @@ type BrandListInfo struct {
UpdatedTime
int
`json:"updated_time"`
BrandStartTime
int
`json:"brand_start_time"`
BrandEndTime
int
`json:"brand_end_time"`
IsDel
int
`json:"is_del"`
IsDel
int
`json:"is_del"`
LastCheckTime
int
`json:"last_check_time"`
LastCheckContent
string
`json:"last_check_content"`
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论