提交 3cd6891a authored 作者: 屈传平's avatar 屈传平

Merge branch 'master' of http://120.27.146.32:8888/stbz/library

...@@ -165,7 +165,7 @@ func (s *HcwClient) post(ctx context.Context, method string, req interface{}) (r ...@@ -165,7 +165,7 @@ func (s *HcwClient) post(ctx context.Context, method string, req interface{}) (r
Url := s.Config.ApiUrl + method Url := s.Config.ApiUrl + method
Request := g.Client() Request := g.Client()
Request.SetHeader("Content-Type", "text/xml; charset=utf-8") Request.SetHeader("Content-Type", "application/json")
Request.SetHeader("Format", "json") Request.SetHeader("Format", "json")
Request.SetHeader("signature", signature) Request.SetHeader("signature", signature)
......
package hcw
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
type AddressParseReq struct {
// 京东区域ID
AreaID string `json:"area_id"`
// 京东区域名称
AreaName string `json:"area_name"`
// 京东市区ID
CityID string `json:"city_id"`
// 京东市区名称
CityName string `json:"city_name"`
// 京东省份ID
ProvinceID string `json:"province_id"`
// 京东省份名称
ProvinceName string `json:"province_name"`
// 渠道来源(meide美的,aux奥克斯,myx美云销,mb美邦,hair海尔,skyworth创维,konka康佳)
Source string `json:"source"`
}
type AddressParseRes struct {
Id int `json:"id"`
Code string `json:"code"`
Parent string `json:"parent"`
Source string `json:"source"`
Level int `json:"level"`
Name string `json:"name"`
NameRaw string `json:"name_raw"`
FullPath string `json:"full_path"`
}
func (s *HcwClient) AddressParse(ctx context.Context, req *AddressParseReq) (res []*AddressParseRes, err error) {
var method = "/address/match"
result, err := s.post(ctx, method, req)
if nil != err {
return
}
_ = gjson.New(result).Scan(&res)
return
}
...@@ -7,30 +7,39 @@ import ( ...@@ -7,30 +7,39 @@ import (
) )
type OrderCreateReq struct { type OrderCreateReq struct {
Order struct { OrderSn string `json:"order_sn"`
Id int `json:"id"` OrderPrice int `json:"order_price"`
ParentOrderSn string `json:"parent_order_sn"` OrderDiscountPrice int `json:"order_discount_price"`
OrderSn string `json:"order_sn"` OrderFreightPrice int `json:"order_freight_price"`
ThirdOrderSn string `json:"third_order_sn"` OrderPayPrice int `json:"order_pay_price"`
CreatedTime string `json:"created_time"` OrderPayTime string `json:"order_pay_time"`
OrderPayTime string `json:"order_pay_time"` OrderRemark string `json:"order_remark"`
DispatchPrice int `json:"dispatch_price"` Source string `json:"source"`
OrderTotalPrice int `json:"order_total_price"` Address *OrderAddress `json:"address"`
Remark string `json:"remark"` Goods *OrderGoods `json:"goods"`
RealName string `json:"real_name"` }
Mobile string `json:"mobile"`
Provice string `json:"provice"` type OrderGoods struct {
City string `json:"city"` Id int `json:"goods_id"` //商品ID
District string `json:"district"` Num int `json:"goods_num"` //商品购买数量
Street string `json:"street"` BuyPrice int `json:"goods_buy_price"` //商品购买价格
Address string `json:"address"` PayPrice string `json:"goods_pay_price"` //商品支付价格
ProvinceId int `json:"province_id"` GoodsPrice int `json:"goods_goods_price"` //商品单价
CityId int `json:"city_id"` SkuNo string `json:"goods_sku_no"` //商品sku
DistrictId int `json:"district_id"` }
StreetId int `json:"street_id"`
SupplyType string `json:"supply_type"` type OrderAddress struct {
} `json:"order"` Name string `json:"receive_name"` //收货人名称
OrderGoodsDetail []*OrderGoodsDetailList `json:"order_goods_detail"` Mobile string `json:"receive_mobile"` //收货人手机
ProvinceName string `json:"receive_provice_name"` //收货人省份
CityName string `json:"receive_city_name"` //收货人城市
DistrictName string `json:"receive_district_name"` //收货人区
StreetName string `json:"receive_street_name"` //收货人街道
Address string `json:"receive_address"` //收货人具体地址
ProvinceId string `json:"receive_province_id"` //收货人省份ID
CityId string `json:"receive_city_id"` //收货人城市ID
DistrictId string `json:"receive_area_id"` //收货人区ID
StreetId string `json:"receive_street_id"` //收货人街道ID
} }
type OrderGoodsDetailList struct { type OrderGoodsDetailList struct {
...@@ -51,7 +60,7 @@ type OrderCreateRes struct { ...@@ -51,7 +60,7 @@ type OrderCreateRes struct {
Code int `json:"code"` Code int `json:"code"`
Message string `json:"message"` Message string `json:"message"`
Data struct { Data struct {
OrderId int `json:"order_id"` OrderSn string `json:"order_sn"`
} `json:"data"` } `json:"data"`
} }
...@@ -184,17 +193,18 @@ func (s *HcwClient) OrderDetail(ctx context.Context, orderSn string) (res *Order ...@@ -184,17 +193,18 @@ func (s *HcwClient) OrderDetail(ctx context.Context, orderSn string) (res *Order
} }
type OrderCheckReq struct { type OrderCheckReq struct {
GoodsId int `json:"goods_id"` GoodsNo string `json:"goods_no"`
BuyNum int `json:"buy_num"` SkuNo string `json:"sku_no"`
SupplyType string `json:"supply_type"` BuyNum string `json:"buy_num"`
Source string `json:"source"`
ProvinceID string `json:"province_id"`
CityID string `json:"city_id"`
AreaID string `json:"area_id"`
} }
type OrderCheckRes struct { type OrderCheckRes struct {
Code int `json:"code"` Code int `json:"code"`
Message string `json:"message"` Message string `json:"message"`
Data struct {
OrderId int `json:"order_id"`
} `json:"data"`
} }
func (s *HcwClient) OrderCheck(ctx context.Context, req *OrderCheckReq) (res *OrderCheckRes, err error) { func (s *HcwClient) OrderCheck(ctx context.Context, req *OrderCheckReq) (res *OrderCheckRes, err error) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论