Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录
切换导航
L
library
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
stbz
library
Commits
9277c04d
提交
9277c04d
authored
2 年前
作者:
zhanglibo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
商品
上级
7c5ff93b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
148 行增加
和
28 行删除
+148
-28
ali_goods.go
upstream/ali/ali_goods.go
+44
-26
jingdong_goods.go
upstream/jingdong/jingdong_goods.go
+51
-2
tm_goods.go
upstream/tm/tm_goods.go
+53
-0
没有找到文件。
upstream/ali/ali_goods.go
浏览文件 @
9277c04d
...
...
@@ -13,15 +13,18 @@ type goodsAli struct {
var
Goods
=
goodsAli
{}
type
GoodsListReq
struct
{
Biztype
string
`json:"biztype"`
//经营模式 【1:生产加工,2:经销批发,3:招商代理,4:商业服务】
BuyerProtection
string
`json:"buyerProtection"`
//买家保障,多个值用逗号分割;【qtbh:7天包换;swtbh:15天包换】
City
string
`json:"city"`
//所在地区- 市 示例:杭州
DeliveryTimeType
string
`json:"deliveryTimeType"`
//发货时间;【1:24小时发货;2:48小时发货;3:72小时发货】
DescendOrder
bool
`json:"descendOrder"`
//是否倒序;【正序: false;倒序:true】
HolidayTagId
string
`json:"holidayTagId"`
//商品售卖类型筛选;枚举,多个值用分号分割;免费赊账:50000114
KeyWords
string
`json:"keyWords"`
//搜索关键词
Page
int
`json:"page"`
//页码
PageSize
int
`json:"pageSize"`
//页面数量;最大20
Biztype
string
`json:"biztype,omitempty"`
//经营模式 【1:生产加工,2:经销批发,3:招商代理,4:商业服务】
BuyerProtection
string
`json:"buyerProtection,omitempty"`
//买家保障,多个值用逗号分割;【qtbh:7天包换;swtbh:15天包换】
City
string
`json:"city,omitempty"`
//所在地区- 市 示例:杭州
DeliveryTimeType
string
`json:"deliveryTimeType,omitempty"`
//发货时间;【1:24小时发货;2:48小时发货;3:72小时发货】
DescendOrder
bool
`json:"descendOrder,omitempty"`
//是否倒序;【正序: false;倒序:true】
HolidayTagId
string
`json:"holidayTagId,omitempty"`
//商品售卖类型筛选;枚举,多个值用分号分割;免费赊账:50000114
KeyWords
string
`json:"keyWords,omitempty"`
//搜索关键词
Page
int
`json:"page"`
//页码
PageSize
int
`json:"pageSize"`
//页面数量;最大20
OfferIds
string
`json:"offerIds,omitempty"`
//ID
CategoryId
string
`json:"postCategoryId,omitempty"`
//分类ID
SortType
string
`json:"sortType,omitempty"`
//排序字段
AccessToken
string
`json:"access_token"`
}
...
...
@@ -42,13 +45,6 @@ type GoodsListRes struct {
}
`json:"result"`
}
type
GoodsInfoReq
struct
{
GoodsID
int64
`json:"offerId"`
//1688商品ID,等同于productId
NeedCpsSuggestPrice
bool
`json:"needCpsSuggestPrice"`
//是否需要CPS建议价
NeedIntelligentInfo
bool
`json:"needIntelligentInfo"`
//是否返回算法改写的信息,包括标题、图片和详情图片
AccessToken
string
`json:"access_token"`
}
type
GoodsInfoRes
struct
{
CommonRes
BizGroupInfos
[]
struct
{
...
...
@@ -57,12 +53,15 @@ type GoodsInfoRes struct {
Code
string
`json:"code"`
}
`json:"bizGroupInfos"`
ProductInfo
struct
{
ProductID
int64
`json:"productID"`
CategoryID
int
`json:"categoryID"`
Subject
string
`json:"subject"`
Description
string
`json:"description"`
PictureAuth
bool
`json:"pictureAuth"`
Image
struct
{
ProductID
int64
`json:"productID"`
SupplierLoginId
string
`json:"SupplierLoginId"`
MainVedio
string
`json:"MainVedio"`
CategoryID
int
`json:"categoryID"`
Subject
string
`json:"subject"`
Description
string
`json:"description"`
PictureAuth
bool
`json:"pictureAuth"`
IntelligentInfo
IntelligentInfo
`json:"intelligentInfo"`
//商品算法智能改写信息,包含算法优化后的商品标题和图片信息,未改写的则直接返回原标题和原图片
Image
struct
{
Images
[]
string
`json:"images"`
}
`json:"image"`
SkuInfos
[]
struct
{
...
...
@@ -78,6 +77,7 @@ type GoodsInfoRes struct {
SkuID
int64
`json:"skuId"`
SpecID
string
`json:"specId"`
ConsignPrice
float64
`json:"consignPrice"`
Retailprice
float64
`json:"retailprice"`
ChannelPrice
float64
`json:"channelPrice"`
}
`json:"skuInfos"`
SaleInfo
struct
{
...
...
@@ -92,6 +92,9 @@ type GoodsInfoRes struct {
Unit
string
`json:"unit"`
MinOrderQuantity
int
`json:"minOrderQuantity"`
QuoteType
int
`json:"quoteType"`
Retailprice
float64
`json:"retailprice"`
ConsignPrice
float64
`json:"consignPrice"`
ChannelPrice
float64
`json:"channelPrice"`
}
`json:"saleInfo"`
ShippingInfo
struct
{
FreightTemplateID
int
`json:"freightTemplateID"`
...
...
@@ -149,6 +152,16 @@ type GoodsInfoRes struct {
}
`json:"productInfo"`
}
type
IntelligentInfo
struct
{
Title
string
`json:"title"`
//算法优化后的商品标题
Images
[]
string
`json:"images"`
//主图列表,使用相对路径,需要增加域名:https://cbu01.alicdn.com/
SkuImages
[]
struct
{
//算法优化后的规格图片
SkuId
int64
`json:"skuId"`
//规格ID
ImageUrl
string
`json:"imageUrl"`
//图片
}
`json:"skuImages"`
DescriptionImages
[]
string
`json:"descriptionImages"`
//算法优化后的详情图片
}
type
GoodsFollowRes
struct
{
Code
int
`json:"code"`
Message
int
`json:"message"`
...
...
@@ -178,7 +191,7 @@ type GoodsCategoryReq struct {
}
type
GoodsCategoryRes
struct
{
CommonRes
Succes
string
`json:"succes"`
CategoryInfo
[]
struct
{
CategoryID
int
`json:"categoryID"`
Name
string
`json:"name"`
...
...
@@ -206,11 +219,16 @@ func (goodsAli) List(ctx context.Context, req *GoodsListReq) (res *GoodsListRes,
return
}
func
(
goodsAli
)
Info
(
ctx
context
.
Context
,
req
*
GoodsInfoReq
)
(
res
*
GoodsInfoRes
,
err
error
)
{
func
(
goodsAli
)
Info
(
ctx
context
.
Context
,
req
interface
{}
)
(
res
*
GoodsInfoRes
,
err
error
)
{
method
:=
"com.alibaba.product/alibaba.cpsMedia.productInfo"
request
:=
g
.
Map
{
"offerId"
:
gconv
.
Int64
(
req
),
"needCpsSuggestPrice"
:
true
,
"needIntelligentInfo"
:
true
,
"access_token"
:
server
.
AccessToken
,
}
req
.
AccessToken
=
server
.
AccessToken
result
,
err
:=
server
.
Post
(
ctx
,
method
,
gconv
.
Map
(
req
))
result
,
err
:=
server
.
Post
(
ctx
,
method
,
request
)
_
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
...
...
This diff is collapsed.
Click to expand it.
upstream/jingdong/jingdong_goods.go
浏览文件 @
9277c04d
...
...
@@ -234,10 +234,10 @@ func (*goodsJD) GetProductsPrice(ctx context.Context, skus *garray.Array) (res *
}
//GetDetail 查询商品详情
func
(
*
goodsJD
)
GetDetail
(
ctx
context
.
Context
,
skus
*
garray
.
Array
)
(
res
*
GetDetailRes
,
err
error
)
{
func
(
*
goodsJD
)
GetDetail
(
ctx
context
.
Context
,
skus
interface
{}
)
(
res
*
GetDetailRes
,
err
error
)
{
method
:=
"product/getDetail"
param
:=
g
.
Map
{
"sku"
:
skus
.
Join
(
","
),
"sku"
:
gconv
.
String
(
skus
),
"queryExts"
:
"spuId,pName,isFactoryShip,isSelf,LowestBuy,wxintroduction"
,
}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
...
...
@@ -290,3 +290,52 @@ func (*goodsJD) GetSimilarSku(ctx context.Context, skus interface{}) (res *GetSi
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
type
GetPageNumRes
struct
{
Success
bool
`json:"success"`
ResultCode
string
`json:"resultCode"`
ResultMessage
string
`json:"resultMessage"`
Result
[]
struct
{
Name
string
`json:"name"`
PageNum
string
`json:"page_num"`
}
`json:"result"`
}
//GetPageNum 查询商品池编号
func
(
*
goodsJD
)
GetPageNum
(
ctx
context
.
Context
)
(
res
*
GetPageNumRes
,
err
error
)
{
method
:=
"product/getPageNum"
param
:=
g
.
Map
{}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
type
QueryByPageRes
struct
{
Success
bool
`json:"success"`
ResultMessage
string
`json:"resultMessage"`
ResultCode
string
`json:"resultCode"`
Result
struct
{
RemainPage
int
`json:"remainPage"`
Skus
[]
int
`json:"skus"`
Offset
int
`json:"offset"`
}
`json:"result"`
}
//QueryByPage 查询池内商品编号
func
(
*
goodsJD
)
QueryByPage
(
ctx
context
.
Context
,
pageNum
,
pageNo
,
offset
interface
{})
(
res
*
QueryByPageRes
,
err
error
)
{
method
:=
"product/querySkuByPage"
param
:=
g
.
Map
{
"pageNum"
:
pageNum
,
"pageSize"
:
pageNo
,
"offset"
:
offset
,
}
result
,
err
:=
server
.
requestApi
(
ctx
,
method
,
param
)
if
err
!=
nil
{
return
}
err
=
gjson
.
New
(
result
)
.
Scan
(
&
res
)
return
}
This diff is collapsed.
Click to expand it.
upstream/tm/tm_goods.go
浏览文件 @
9277c04d
...
...
@@ -3,6 +3,7 @@ package tm
import
(
"context"
"encoding/json"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
...
...
@@ -46,3 +47,55 @@ func (s *goodsTm) Inventory(ctx context.Context, DivisionCode string, req []Good
_
=
json
.
Unmarshal
([]
byte
(
result
),
&
res
)
return
}
type
GoodsDetailRes
struct
{
Code
string
`json:"Code"`
Success
bool
`json:"Success"`
Message
string
`json:"Message"`
RequestId
string
`json:"RequestId"`
Item
struct
{
ItemId
int
`json:"ItemId"`
ItemTitle
string
`json:"ItemTitle"`
CanSell
bool
`json:"IsCanSell"`
ReservePrice
int
`json:"ReservePrice"`
//
Quantity
int
`json:"Quantity"`
MinPrice
int
`json:"MinPrice"`
TotalSoldQuantity
int
`json:"TotalSoldQuantity"`
//销量
DescOption
string
`json:"DescOption"`
SellerId
int
`json:"SellerId"`
CategoryId
int
`json:"CategoryId"`
MainPicUrl
string
`json:"MainPicUrl"`
TbShopName
string
`json:"TbShopName"`
SellerPayPostfee
bool
`json:"SellerPayPostfee"`
//是否包邮
PropertiesJson
string
`json:"PropertiesJson"`
//属性
Properties
map
[
string
][]
string
`json:"Properties"`
//属性
Skus
struct
{
Sku
[]
struct
{
ItemId
int
`json:"ItemId"`
Quantity
int
`json:"Quantity"`
ReservePrice
int
`json:"ReservePrice"`
CanSell
bool
`json:"CanSell"`
SkuId
int
`json:"SkuId"`
PriceCent
int
`json:"PriceCent"`
//售价
SkuProperties
map
[
string
]
string
`json:"SkuProperties"`
SkuPropertiesJson
string
`json:"SkuPropertiesJson"`
SkuPicUrl
string
`json:"SkuPicUrl"`
}
`json:"Sku"`
}
`json:"Skus"`
ItemImages
struct
{
ItemImage
[]
string
`json:"ItemImage"`
}
`json:"ItemImages"`
}
`json:"Item"`
}
//Detail 详情
func
(
*
goodsTm
)
Detail
(
ctx
context
.
Context
,
req
interface
{})
(
res
*
GoodsDetailRes
,
err
error
)
{
method
:=
"QueryItemDetail"
request
:=
g
.
MapStrStr
{
"ItemId"
:
gconv
.
String
(
req
),
}
result
,
err
:=
post
(
ctx
,
method
,
request
)
_
=
json
.
Unmarshal
([]
byte
(
result
),
&
res
)
return
}
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论