提交 1a97c8e2 authored 作者: zhanglibo's avatar zhanglibo

淘特

上级 d2a8f3a4
...@@ -65,9 +65,7 @@ func (s *Config) sign(method string, param g.Map) g.Map { ...@@ -65,9 +65,7 @@ func (s *Config) sign(method string, param g.Map) g.Map {
} }
//拼接参数 //拼接参数
signStr = "param2/1/" + method + "/" + s.AppKey + signStr signStr = "param2/1/" + method + "/" + s.AppKey + signStr
g.Dump(signStr)
param["_aop_signature"] = s.CreateSign(signStr) param["_aop_signature"] = s.CreateSign(signStr)
//param["_aop_signature"] = "A4D5F82A89A7515CB66A1AF3AC97C02AF6223C90"
return param return param
} }
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"context" "context"
"github.com/gogf/gf/encoding/gjson" "github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g" "github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
) )
type orderItao struct { type orderItao struct {
...@@ -66,12 +67,12 @@ type OrderBeforeRes struct { ...@@ -66,12 +67,12 @@ type OrderBeforeRes struct {
Image string `json:"image"` Image string `json:"image"`
OrderLineRenders []struct { OrderLineRenders []struct {
ItemInfo struct { ItemInfo struct {
ItemId int64 `json:"itemId"` ItemId string `json:"itemId"`
SkuId int `json:"skuId"` SkuId string `json:"skuId"`
} `json:"itemInfo"` } `json:"itemInfo"`
ItemPayPrice int `json:"itemPayPrice"` ItemPayPrice int `json:"itemPayPrice"`
OrderLineId int `json:"orderLineId"` OrderLineId string `json:"orderLineId"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`
} `json:"orderLineRenders"` } `json:"orderLineRenders"`
OrderPayPrice int `json:"orderPayPrice"` OrderPayPrice int `json:"orderPayPrice"`
Quantity int `json:"quantity"` Quantity int `json:"quantity"`
...@@ -97,7 +98,7 @@ type OrderPromotion struct { ...@@ -97,7 +98,7 @@ type OrderPromotion struct {
HasPromotion bool `json:"hasPromotion"` HasPromotion bool `json:"hasPromotion"`
IdValues []interface { IdValues []interface {
} `json:"idValues"` } `json:"idValues"`
OrderLineId int `json:"orderLineId"` OrderLineId string `json:"orderLineId"`
PromotionPriceMap struct { PromotionPriceMap struct {
LtaoMonthPkCard int `json:"ltaoMonthPkCard"` LtaoMonthPkCard int `json:"ltaoMonthPkCard"`
} `json:"promotionPriceMap"` } `json:"promotionPriceMap"`
...@@ -120,7 +121,9 @@ func (s orderItao) Before(ctx context.Context, req OrderBeforeReq) (res *OrderBe ...@@ -120,7 +121,9 @@ func (s orderItao) Before(ctx context.Context, req OrderBeforeReq) (res *OrderBe
result, err := server.Post(ctx, method, g.Map{ result, err := server.Post(ctx, method, g.Map{
"request": req, "request": req,
}) })
_ = gjson.New(result).Scan(&res) _ = gjson.NewWithOptions(result, gjson.Options{
StrNumber: true,
}).Scan(&res)
return return
} }
...@@ -149,7 +152,7 @@ type OrderCreateRes struct { ...@@ -149,7 +152,7 @@ type OrderCreateRes struct {
EnablingOrdersResult struct { EnablingOrdersResult struct {
Model struct { Model struct {
AlipayTradeIds []string `json:"alipayTradeIds"` AlipayTradeIds []string `json:"alipayTradeIds"`
OrderIds []int64 `json:"orderIds"` OrderIds []string `json:"orderIds"`
RedirectUrl string `json:"redirectUrl"` RedirectUrl string `json:"redirectUrl"`
} `json:"model"` } `json:"model"`
} `json:"enablingOrdersResult"` } `json:"enablingOrdersResult"`
...@@ -172,7 +175,9 @@ func (s orderItao) Create(ctx context.Context, req OrderCreateReq) (res *OrderCr ...@@ -172,7 +175,9 @@ func (s orderItao) Create(ctx context.Context, req OrderCreateReq) (res *OrderCr
result, err := server.Post(ctx, method, g.Map{ result, err := server.Post(ctx, method, g.Map{
"request": req, "request": req,
}) })
_ = gjson.New(result).Scan(&res) _ = gjson.NewWithOptions(result, gjson.Options{
StrNumber: true,
}).Scan(&res)
return return
} }
...@@ -184,16 +189,16 @@ type OrderDetailRes struct { ...@@ -184,16 +189,16 @@ type OrderDetailRes struct {
BuyerToken string `json:"buyerToken"` BuyerToken string `json:"buyerToken"`
Detail int `json:"detail"` Detail int `json:"detail"`
DetailOrderList []struct { DetailOrderList []struct {
BizOrderId int64 `json:"bizOrderId"` BizOrderId string `json:"bizOrderId"`
BuyAmount int `json:"buyAmount"` BuyAmount int `json:"buyAmount"`
BuyerToken string `json:"buyerToken"` BuyerToken string `json:"buyerToken"`
Detail int `json:"detail"` Detail int `json:"detail"`
GmtCreate string `json:"gmtCreate"` GmtCreate string `json:"gmtCreate"`
ItemInfo struct { ItemInfo struct {
ItemId int64 `json:"itemId"` ItemId string `json:"itemId"`
Pic string `json:"pic"` Pic string `json:"pic"`
Price string `json:"price"` Price string `json:"price"`
SkuId int `json:"skuId"` SkuId string `json:"skuId"`
Title string `json:"title"` Title string `json:"title"`
} `json:"itemInfo"` } `json:"itemInfo"`
LogisticsOrderId int64 `json:"logisticsOrderId"` LogisticsOrderId int64 `json:"logisticsOrderId"`
...@@ -210,10 +215,10 @@ type OrderDetailRes struct { ...@@ -210,10 +215,10 @@ type OrderDetailRes struct {
} `json:"detailOrderList"` } `json:"detailOrderList"`
GmtCreate string `json:"gmtCreate"` GmtCreate string `json:"gmtCreate"`
ItemInfo struct { ItemInfo struct {
ItemId int64 `json:"itemId"` ItemId string `json:"itemId"`
Pic string `json:"pic"` Pic string `json:"pic"`
Price string `json:"price"` Price string `json:"price"`
SkuId int `json:"skuId"` SkuId string `json:"skuId"`
Title string `json:"title"` Title string `json:"title"`
} `json:"itemInfo"` } `json:"itemInfo"`
LogisticsOrderId int64 `json:"logisticsOrderId"` LogisticsOrderId int64 `json:"logisticsOrderId"`
...@@ -249,36 +254,38 @@ type OrderDetailRes struct { ...@@ -249,36 +254,38 @@ type OrderDetailRes struct {
} }
//Detail 详情 //Detail 详情
func (s orderItao) Detail(ctx context.Context, req string) (res *OrderDetailRes, err error) { func (s orderItao) Detail(ctx context.Context, req interface{}) (res *OrderDetailRes, err error) {
method := "com.alibaba.c2m/ltao.trade.queryOrder" method := "com.alibaba.c2m/ltao.trade.queryOrder"
result, err := server.Post(ctx, method, g.Map{ result, err := server.Post(ctx, method, g.Map{
"request": g.Map{ "request": g.Map{
"bizOrderId": req, "bizOrderId": gconv.Int64(req),
}, },
}) })
_ = gjson.New(result).Scan(&res) _ = gjson.NewWithOptions(result, gjson.Options{
StrNumber: true,
}).Scan(&res)
return return
} }
type OrderReflectRes struct { type OrderReflectRes struct {
Result struct { Result struct {
Result struct { Result struct {
BizOrderId int64 `json:"bizOrderId"` BizOrderId string `json:"bizOrderId"`
BuyAmount int `json:"buyAmount"` BuyAmount int `json:"buyAmount"`
BuyerToken string `json:"buyerToken"` BuyerToken string `json:"buyerToken"`
Detail int `json:"detail"` Detail int `json:"detail"`
DetailOrderList []struct { DetailOrderList []struct {
BizOrderId int64 `json:"bizOrderId"` BizOrderId string `json:"bizOrderId"`
BuyAmount int `json:"buyAmount"` BuyAmount int `json:"buyAmount"`
BuyerToken string `json:"buyerToken"` BuyerToken string `json:"buyerToken"`
Detail int `json:"detail"` Detail int `json:"detail"`
GmtCreate string `json:"gmtCreate"` GmtCreate string `json:"gmtCreate"`
ItemInfo struct { ItemInfo struct {
ItemId int64 `json:"itemId"` ItemId string `json:"itemId"`
Pic string `json:"pic"` Pic string `json:"pic"`
Price string `json:"price"` Price string `json:"price"`
SkuId int `json:"skuId"` SkuId string `json:"skuId"`
SkuInfoList []interface{} `json:"skuInfoList"` SkuInfoList []interface{} `json:"skuInfoList"`
Title string `json:"title"` Title string `json:"title"`
} `json:"itemInfo"` } `json:"itemInfo"`
...@@ -296,19 +303,19 @@ type OrderReflectRes struct { ...@@ -296,19 +303,19 @@ type OrderReflectRes struct {
} `json:"detailOrderList"` } `json:"detailOrderList"`
GmtCreate string `json:"gmtCreate"` GmtCreate string `json:"gmtCreate"`
ItemInfo struct { ItemInfo struct {
ItemId int64 `json:"itemId"` ItemId string `json:"itemId"`
Pic string `json:"pic"` Pic string `json:"pic"`
Price string `json:"price"` Price string `json:"price"`
SkuId int `json:"skuId"` SkuId string `json:"skuId"`
SkuInfoList []interface{} `json:"skuInfoList"` SkuInfoList []interface{} `json:"skuInfoList"`
Title string `json:"title"` Title string `json:"title"`
} `json:"itemInfo"` } `json:"itemInfo"`
LogisticsOrderId int64 `json:"logisticsOrderId"` LogisticsOrderId int64 `json:"logisticsOrderId"`
LogisticsStatus int `json:"logisticsStatus"` LogisticsStatus int `json:"logisticsStatus"`
Main int `json:"main"` Main int `json:"main"`
ParentId int64 `json:"parentId"` ParentId string `json:"parentId"`
PayFee int `json:"payFee"` PayFee int `json:"payFee"`
PayOrderId int64 `json:"payOrderId"` PayOrderId string `json:"payOrderId"`
PayStatus int `json:"payStatus"` PayStatus int `json:"payStatus"`
PostFee int `json:"postFee"` PostFee int `json:"postFee"`
RefundStatus int `json:"refundStatus"` RefundStatus int `json:"refundStatus"`
...@@ -330,6 +337,8 @@ func (s orderItao) Reflect(ctx context.Context, req string) (res *OrderReflectRe ...@@ -330,6 +337,8 @@ func (s orderItao) Reflect(ctx context.Context, req string) (res *OrderReflectRe
"outOrderId": req, "outOrderId": req,
}, },
}) })
_ = gjson.New(result).Scan(&res) _ = gjson.NewWithOptions(result, gjson.Options{
StrNumber: true,
}).Scan(&res)
return return
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论