1 Star 0 Fork 0

danlansky/go-library

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Ability371.go 3.30 KB
一键复制 编辑 原始数据 按行查看 历史
zhangminghua 提交于 2024-08-20 14:32 . feat:基础工具包
package ability371
import (
"errors"
"gitee.com/danlansky/go-library/union/topsdk"
"gitee.com/danlansky/go-library/union/topsdk/ability371/request"
"gitee.com/danlansky/go-library/union/topsdk/ability371/response"
"gitee.com/danlansky/go-library/union/topsdk/util"
"log"
)
type Ability371 struct {
Client *topsdk.TopClient
}
func NewAbility371(client *topsdk.TopClient) *Ability371 {
return &Ability371{client}
}
/*
淘宝客-公用-阿里妈妈推广券详情查询
*/
func (ability *Ability371) TaobaoTbkCouponGet(req *request.TaobaoTbkCouponGetRequest) (*response.TaobaoTbkCouponGetResponse, error) {
if ability.Client == nil {
return nil, errors.New("Ability371 topClient is nil")
}
var jsonStr, err = ability.Client.Execute("taobao.tbk.coupon.get", req.ToMap(), req.ToFileMap())
var respStruct = response.TaobaoTbkCouponGetResponse{}
if err != nil {
log.Println("taobaoTbkCouponGet error", err)
return &respStruct, err
}
err = util.HandleJsonResponse(jsonStr, &respStruct)
if respStruct.Body == "" || len(respStruct.Body) == 0 {
respStruct.Body = jsonStr
}
return &respStruct, err
}
/*
淘宝客-公用-淘宝客商品详情查询(简版)
*/
func (ability *Ability371) TaobaoTbkItemInfoGet(req *request.TaobaoTbkItemInfoGetRequest) (*response.TaobaoTbkItemInfoGetResponse, error) {
if ability.Client == nil {
return nil, errors.New("Ability371 topClient is nil")
}
var jsonStr, err = ability.Client.Execute("taobao.tbk.item.info.get", req.ToMap(), req.ToFileMap())
var respStruct = response.TaobaoTbkItemInfoGetResponse{}
if err != nil {
log.Println("taobaoTbkItemInfoGet error", err)
return &respStruct, err
}
err = util.HandleJsonResponse(jsonStr, &respStruct)
if respStruct.Body == "" || len(respStruct.Body) == 0 {
respStruct.Body = jsonStr
}
return &respStruct, err
}
/*
淘宝客商品详情查询(简版)(临时接口)
*/
func (ability *Ability371) TaobaoTbkItemInfoTemporaryGet(req *request.TaobaoTbkItemInfoTemporaryGetRequest) (*response.TaobaoTbkItemInfoTemporaryGetResponse, error) {
if ability.Client == nil {
return nil, errors.New("Ability371 topClient is nil")
}
var jsonStr, err = ability.Client.Execute("taobao.tbk.item.info.temporary.get", req.ToMap(), req.ToFileMap())
var respStruct = response.TaobaoTbkItemInfoTemporaryGetResponse{}
if err != nil {
log.Println("taobaoTbkItemInfoTemporaryGet error", err)
return &respStruct, err
}
err = util.HandleJsonResponse(jsonStr, &respStruct)
if respStruct.Body == "" || len(respStruct.Body) == 0 {
respStruct.Body = jsonStr
}
return &respStruct, err
}
/*
淘宝客-公用-淘宝客商品详情查询升级版(简易版)
*/
func (ability *Ability371) TaobaoTbkItemInfoUpgradeGet(req *request.TaobaoTbkItemInfoUpgradeGetRequest) (*response.TaobaoTbkItemInfoUpgradeGetResponse, error) {
if ability.Client == nil {
return nil, errors.New("Ability371 topClient is nil")
}
var jsonStr, err = ability.Client.Execute("taobao.tbk.item.info.upgrade.get", req.ToMap(), req.ToFileMap())
var respStruct = response.TaobaoTbkItemInfoUpgradeGetResponse{}
if err != nil {
log.Println("taobaoTbkItemInfoUpgradeGet error", err)
return &respStruct, err
}
err = util.HandleJsonResponse(jsonStr, &respStruct)
if respStruct.Body == "" || len(respStruct.Body) == 0 {
respStruct.Body = jsonStr
}
return &respStruct, err
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/danlansky/go-library.git
git@gitee.com:danlansky/go-library.git
danlansky
go-library
go-library
v1.0.0

搜索帮助

0d507c66 1850385 C8b1a773 1850385