提交 806dad2d authored 作者: 张立波's avatar 张立波

tm v3

上级 bd552da5
...@@ -15,46 +15,83 @@ type GoodsDetailReq struct { ...@@ -15,46 +15,83 @@ type GoodsDetailReq struct {
} }
type GoodsDetailRes struct { type GoodsDetailRes struct {
CanSell bool `json:"canSell"`
FuzzyQuantity string `json:"fuzzyQuantity"`
LmItemId string `json:"lmItemId"`
ProductId string `json:"productId"`
ProductStatus string `json:"productStatus"`
Quantity int `json:"quantity"`
RequestId string `json:"requestId"` RequestId string `json:"requestId"`
ShopId string `json:"shopId"`
Skus []struct {
CanSell bool `json:"canSell"`
FuzzyQuantity string `json:"fuzzyQuantity"`
MarkPrice int `json:"markPrice"`
Price int `json:"price"`
ProductId string `json:"productId"` ProductId string `json:"productId"`
Quantity int `json:"quantity"` Title string `json:"title"`
PicUrl string `json:"picUrl"`
DescPath string `json:"descPath"`
CategoryLeafId int `json:"categoryLeafId"`
Images []string `json:"images"`
Properties []struct {
Text string `json:"text"`
Values []string `json:"values"`
} `json:"properties"`
ProductSpecs []struct {
KeyId int `json:"keyId"`
Key string `json:"key"`
Values []struct {
ValueId int `json:"valueId"`
Value string `json:"value"`
} `json:"values"`
} `json:"productSpecs"`
Skus []struct {
ShopId string `json:"shopId"` ShopId string `json:"shopId"`
ProductId string `json:"productId"`
SkuId string `json:"skuId"` SkuId string `json:"skuId"`
SkuStatus string `json:"skuStatus"`
Title string `json:"title"` Title string `json:"title"`
PicUrl string `json:"picUrl"`
SkuSpecs []struct {
KeyId int `json:"keyId"`
Key string `json:"key"`
ValueId int `json:"valueId"`
Value string `json:"value"`
} `json:"skuSpecs"`
SkuSpecsCode string `json:"skuSpecsCode"`
SkuStatus string `json:"skuStatus"`
CanSell bool `json:"canSell"`
Quantity int `json:"quantity"`
FuzzyQuantity string `json:"fuzzyQuantity"`
Price int `json:"price"`
MarkPrice int `json:"markPrice"`
PlatformPrice int `json:"platformPrice"`
DivisionCode string `json:"divisionCode"`
} `json:"skus"` } `json:"skus"`
Title string `json:"title"` CanSell bool `json:"canSell"`
ProductType string `json:"productType"`
ProductStatus string `json:"productStatus"`
ShopId string `json:"shopId"`
Quantity int `json:"quantity"`
FuzzyQuantity string `json:"fuzzyQuantity"`
TaxRate interface{} `json:"taxRate"`
TaxCode interface{} `json:"taxCode"`
CategoryChain []struct {
CategoryId int `json:"categoryId"`
Name string `json:"name"`
ParentId int `json:"parentId"`
Level int `json:"level"`
IsLeaf bool `json:"isLeaf"`
} `json:"categoryChain"`
SoldQuantity string `json:"soldQuantity"`
DivisionCode string `json:"divisionCode"`
} }
// Detail 查询选品池商品详情 // Detail 查询选品池商品详情
func (s goodsTm) Detail(ctx context.Context, req GoodsDetailReq) (res *GoodsDetailRes, err error) { func (s goodsTm) Detail(ctx context.Context, req GoodsDetailReq) (res *GoodsDetailRes, err error) {
Start := gtime.TimestampMilli() Start := gtime.TimestampMilli()
ctx = context.WithValue(ctx, "URI", "GetSelectionProductSaleInfo") ctx = context.WithValue(ctx, "URI", "GetSelectionProduct")
defer func() { defer func() {
Log(ctx, req, res, err, Start) Log(ctx, req, res, err, Start)
}() }()
if req.PurchaserId == "" { if req.PurchaserId == "" {
req.PurchaserId = PurchaserId req.PurchaserId = PurchaserId
} }
Request := &client.GetSelectionProductSaleInfoRequest{ Request := &client.GetSelectionProductRequest{
PurchaserId: tea.String(req.PurchaserId), PurchaserId: tea.String(req.PurchaserId),
} }
if req.DivisionCode != "" { if req.DivisionCode != "" {
Request.SetDivisionCode(req.DivisionCode) Request.SetDivisionCode(req.DivisionCode)
} }
r, err := server.GetSelectionProductSaleInfo(tea.String(req.ProductId), Request) r, err := server.GetSelectionProduct(tea.String(req.ProductId), Request)
if err != nil { if err != nil {
return return
} }
......
package tmv3
import (
"context"
"github.com/alibabacloud-go/linkedmall-20230930/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/os/gtime"
)
type SpuSaleInfoReq struct {
ProductId string
PurchaserId string
DivisionCode string
}
type SpuSaleInfoRes struct {
CanSell bool `json:"canSell"`
FuzzyQuantity string `json:"fuzzyQuantity"`
LmItemId string `json:"lmItemId"`
ProductId string `json:"productId"`
ProductStatus string `json:"productStatus"`
Quantity int `json:"quantity"`
RequestId string `json:"requestId"`
ShopId string `json:"shopId"`
Skus []struct {
CanSell bool `json:"canSell"`
FuzzyQuantity string `json:"fuzzyQuantity"`
MarkPrice int `json:"markPrice"`
Price int `json:"price"`
ProductId string `json:"productId"`
Quantity int `json:"quantity"`
ShopId string `json:"shopId"`
SkuId string `json:"skuId"`
SkuStatus string `json:"skuStatus"`
Title string `json:"title"`
} `json:"skus"`
Title string `json:"title"`
}
// SpuSaleInfo 查询选品池商品销售信息
func (s goodsTm) SpuSaleInfo(ctx context.Context, req SpuSaleInfoReq) (res *SpuSaleInfoRes, err error) {
Start := gtime.TimestampMilli()
ctx = context.WithValue(ctx, "URI", "GetSelectionProductSaleInfo")
defer func() {
Log(ctx, req, res, err, Start)
}()
if req.PurchaserId == "" {
req.PurchaserId = PurchaserId
}
Request := &client.GetSelectionProductSaleInfoRequest{
PurchaserId: tea.String(req.PurchaserId),
}
if req.DivisionCode != "" {
Request.SetDivisionCode(req.DivisionCode)
}
r, err := server.GetSelectionProductSaleInfo(tea.String(req.ProductId), Request)
if err != nil {
return
}
err = gjson.New(r.Body).Scan(&res)
return
}
package tmv3
import (
"context"
"github.com/alibabacloud-go/linkedmall-20230930/v2/client"
"github.com/alibabacloud-go/tea/tea"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
)
type SpuSaleInfosReq struct {
DivisionCode string
PurchaserId string
ProductIds []string
}
type SpuSaleInfosRes struct {
RequestId string `json:"requestId"`
ProductSaleInfos []struct {
RequestId interface{} `json:"requestId"`
ShopId string `json:"shopId"`
DivisionCode string `json:"divisionCode"`
ProductId string `json:"productId"`
Title string `json:"title"`
Skus []struct {
ShopId string `json:"shopId"`
DivisionCode string `json:"divisionCode"`
ProductId string `json:"productId"`
SkuId string `json:"skuId"`
Title string `json:"title"`
SkuStatus string `json:"skuStatus"`
CanSell bool `json:"canSell"`
Quantity int `json:"quantity"`
FuzzyQuantity string `json:"fuzzyQuantity"`
Price int `json:"price"`
MarkPrice int `json:"markPrice"`
} `json:"skus"`
CanSell bool `json:"canSell"`
ProductStatus string `json:"productStatus"`
Quantity int `json:"quantity"`
FuzzyQuantity string `json:"fuzzyQuantity"`
} `json:"productSaleInfos"`
}
// SpuSaleInfos 查询选品池商品销售信息
func (s goodsTm) SpuSaleInfos(ctx context.Context, req SpuSaleInfosReq) (res *SpuSaleInfosRes, err error) {
Start := gtime.TimestampMilli()
ctx = context.WithValue(ctx, "URI", "ListSelectionProductSaleInfos")
defer func() {
Log(ctx, req, res, err, Start)
}()
if req.PurchaserId == "" {
req.PurchaserId = PurchaserId
}
Request := &client.ListSelectionProductSaleInfosRequest{}
var Body = new(client.ProductSaleInfoListQuery)
Body.SetPurchaserId(req.PurchaserId)
if req.DivisionCode != "" {
Body.SetDivisionCode(req.DivisionCode)
}
var list []*string
for _, item := range req.ProductIds {
list = append(list, tea.String(item))
}
Body.SetProductIds(list)
Request.SetBody(Body)
r, err := server.ListSelectionProductSaleInfos(Request)
if err != nil {
return
}
g.Log().Info(r.Body)
err = gjson.New(r.Body).Scan(&res)
return
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论