添加eleme平台的api对接

This commit is contained in:
wukesheng 2024-05-04 21:12:15 +08:00
parent 001d22bbb7
commit 1f87727813
2 changed files with 16 additions and 4 deletions

View File

@ -5,14 +5,15 @@ import (
"gitee.com/chengdu-lenntc/third-platform-sdk/sdk/topsdk/defaultability/request"
"gitee.com/chengdu-lenntc/third-platform-sdk/sdk/topsdk/defaultability/response"
"gitee.com/chengdu-lenntc/third-platform-sdk/sdk/topsdk/util"
sdkutil "gitee.com/chengdu-lenntc/third-platform-sdk/sdk/topsdk/util"
"gitee.com/chengdu-lenntc/third-platform-sdk/util"
)
// ElemeUnionApi 调用第三方平台的api
// Api defines the interface of eleme_union api
type ElemeUnionApi interface {
// Sign 签名
Sign(publicParam map[string]interface{}, data map[string]interface{}) string
Sign(publicParam PublicParam, data map[string]interface{}) string
// GetLink 获取推广链接
GetLink(req *request.AlibabaAlscUnionKbItemPromotionShareCreateRequest) (*response.AlibabaAlscUnionKbItemPromotionShareCreateResponse, error)
// GetOrders 获取推广订单
@ -34,8 +35,8 @@ func newElemeUnionApiImpl(log logx.Logger, client *Client) ElemeUnionApi {
// Sign 签名
// @param publicParam 公共参数
// @param data 业务参数
func (a *elemeUnionApiImpl) Sign(publicParam map[string]interface{}, data map[string]interface{}) string {
return util.GetSign(publicParam, data, a.client.authConfig.AppSecret)
func (a *elemeUnionApiImpl) Sign(publicParam PublicParam, data map[string]interface{}) string {
return sdkutil.GetSign(util.StructToMap(publicParam), data, a.client.authConfig.AppSecret)
}
// GetLink 获取推广链接

View File

@ -1 +1,12 @@
package eleme_union
type PublicParam struct {
Method string // 必传 API接口名称具体参见各平台API接口文档taobao.item.seller.get
AppKey string // 必传 TOP分配给应用的AppKey。例12345678
Session string // 可选 用户授权成功后平台颁发给应用的授权session详细介绍请点击这里。当此API文档的标签上注明“需要授权”则此参数必传“不需要授权”则此参数不需要传。
Timestamp string // 必传 时间戳格式为yyyy-MM-dd HH:mm:ss时区为GMT+8例如2016-01-01 12:00:00。淘宝API服务端允许客户端请求最大时间误差为10分钟。
V string // 必传 API协议版本可选值2.0
SignMethod string // 必传 签名的摘要算法可选值为hmacmd5hmac-sha256。
Format string // 否 返回内容响应格式。不传默认为xml格式可选值xmljson。
Simplify bool // 否 是否采用精简JSON返回格式仅当format=json时有效可选值falsetrue不传为false。
}