提交 16157917 authored 作者: zhanglibo's avatar zhanglibo

天猫sdk

上级 7b94255e
......@@ -11,13 +11,12 @@ import (
"github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/util/grand"
"net/url"
"reflect"
"sort"
"strings"
"time"
)
const Source = 7
type Config struct {
AppKey string
AppSecret string
......@@ -26,7 +25,7 @@ type Config struct {
var server *Config
const Name = "tm"
const PkgName = "tm"
const (
apiUrl string = "http://linkedmall.aliyuncs.com/"
......@@ -113,7 +112,7 @@ func post(ctx context.Context, method string, params map[string]string) (str str
if err != nil {
g.Log().Ctx(ctx).Infof("参数【%v】错误【%v】响应时间【%v】", paramStr, err.Error(), gtime.TimestampMilli()-Start)
} else {
g.Log().Ctx(ctx).Cat(Name).Infof("参数【%v】响应【%v】响应时间【%v】", paramStr, str, gtime.TimestampMilli()-Start)
g.Log().Ctx(ctx).Cat(PkgName).Infof("参数【%v】响应【%v】响应时间【%v】", paramStr, str, gtime.TimestampMilli()-Start)
}
}()
str = resp.ReadAllString()
......@@ -125,9 +124,15 @@ func convert(pre string, req []map[string]interface{}) (res map[string]string) {
res = make(map[string]string)
for k, v := range req {
for key, val := range v {
if reflect.TypeOf(val).String() == "[]string" {
for key2, val2 := range gconv.Strings(val) {
res[pre+"."+gconv.String(k+1)+"."+key+"."+gconv.String(key2+1)] = gconv.String(val2)
}
} else {
res[pre+"."+gconv.String(k+1)+"."+key] = gconv.String(val)
}
}
}
return
}
......
......@@ -12,8 +12,8 @@ type goodsTm struct {
var Goods = goodsTm{}
type GoodsInventoryReq struct {
ItemId string `json:"itemId"`
SkuIdList []string `json:"skuIdList"`
ItemId string `json:"ItemId"`
SkuIdList []string `json:"SkuIdList"`
}
type GoodsInventoryRes struct {
......
......@@ -15,15 +15,15 @@ var Order = orderTm{}
type OrderGoodsItem struct {
ItemId string `json:"ItemId"`
SkuId string `json:"SkuId"`
Quantity string `json:"Quantity"`
SkuId string `json:"SkuId"`
}
type OrderAddress struct {
AddressDetail string `json:"AddressDetail"`
DivisionCode string `json:"DivisionCode"`
FullName string `json:"FullName"`
Mobile string `json:"Mobile"`
AddressDetail string `json:"AddressDetail"`
}
type OrderBeforeRes struct {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论