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

yonghui

上级 5b9691e0
......@@ -29,24 +29,6 @@ func New(req *Config) {
return
}
/**
//let date = pm.request.headers.get("AppRequestTime");
let date = moment().format('YYYY-MM-DD HH:mm:ss');
let app_key = pm.request.headers.get("AppKey");
let api_version = pm.request.headers.get("VersionNo");
console.log(pm.request.body.raw);
let post_field = CryptoJS.enc.Base64.stringify( CryptoJS.enc.Utf8.parse(pm.request.body.raw));
//let post_field = CryptoJS.enc.Base64.stringify(pm.request.body.raw);
console.log(post_field);
var stringSignTemp = secret_key + method + date + app_key + api_version + post_field;
console.log(stringSignTemp);
let sign = CryptoJS.MD5(stringSignTemp).toString();
console.log(sign)
pm.request.headers.upsert({"key":"signInfo","value":sign});
*/
func sign(method string, date string, req string) string {
signString := server.AppSecret + method + date + server.AppKey + server.VersionNo + base64.StdEncoding.EncodeToString([]byte(req))
res := gmd5.MustEncryptString(signString)
......
......@@ -22,6 +22,7 @@ const (
Yunzmall = 19
Tmv3 = 20 //天猫优选
Suning = 21 //苏宁有货
Yonghui = 22 //永辉
)
var (
......@@ -111,6 +112,10 @@ func GetUpstreamList() (res interface{}, err error) {
"key": Suning,
"name": GetUpstreamName(Suning),
},
g.Map{
"key": Yonghui,
"name": GetUpstreamName(Yonghui),
},
}
return
}
......@@ -151,6 +156,8 @@ func GetUpstreamName(source int) string {
return "天猫优选"
case Suning:
return "苏宁有货"
case Yonghui:
return "永辉"
default:
return "未知来源"
}
......
package yonghui
import (
"github.com/gogf/gf/crypto/gmd5"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
"time"
)
import (
"context"
)
var server *Config
//永辉
const pkgName = "yonghui"
type Config struct {
Auth string
SignKey string
ApiUrl string
}
func New(req *Config) {
server = req
return
}
func sign(data string) string {
signString := data + server.SignKey
res := gmd5.MustEncryptString(signString)
return res
}
func post(ctx context.Context, method string, req interface{}) (res string, err error) {
Start := gtime.TimestampMilli()
param := gjson.New(req)
formData := g.Map{
"auth": server.Auth,
"method": method,
"data": param.MustToJsonString(),
"sign": sign(param.MustToJsonString()),
}
Url := server.ApiUrl
Request := g.Client()
Request.SetHeader("Content-Type", "application/x-www-form-urlencoded")
resp, err := Request.Timeout(time.Second*10).Post(Url, formData)
defer func() {
_ = resp.Close()
ctx = context.WithValue(ctx, "Method", "POST")
ctx = context.WithValue(ctx, "URI", Url)
if err != nil {
g.Log().Ctx(ctx).Cat(pkgName).Cat("error").Infof("参数【%v】错误【%v】响应时间【%v ms】", param.MustToJsonString(), err.Error(), gtime.TimestampMilli()-Start)
} else {
g.Log().Ctx(ctx).Cat(pkgName).Infof("参数【%v】响应【%v】响应时间【%v ms】", param.MustToJsonString(), res, gtime.TimestampMilli()-Start)
}
}()
res = resp.ReadAllString()
return
}
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
var Believe = new(believe)
type believe struct {
}
type BelieveRechargeReq struct {
BatchCode string `json:"batch_code"`
RechargeInfo []struct {
CreditBalance string `json:"credit_balance"`
CreditType string `json:"credit_type"`
Remark string `json:"remark"`
Telephone string `json:"telephone"`
UserName string `json:"user_name"`
} `json:"recharge_info"`
}
type BelieveRechargeRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
/**
授信充值
*/
func (s *believe) Recharge(ctx context.Context, req *BelieveRechargeReq) (res *BelieveRechargeRes, err error) {
result, err := post(ctx, "com.csx.credit-recharge.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type BelieveBalanceReq struct {
CreditType string `json:"credit_type"`
Telephones []string `json:"telephones"`
}
type BelieveBalanceRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data g.Map `json:"data"`
}
/**
查询授信
*/
func (s *believe) Balance(ctx context.Context, req *BelieveBalanceReq) (res *BelieveBalanceRes, err error) {
result, err := post(ctx, "com.csx.credit-balance-search.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type BelieveRechargeRollbackReq struct {
BatchCode string `json:"batch_code"`
Telephone string `json:"telephone"`
CreditType string `json:"credit_type"`
CreditBalance string `json:"credit_balance"`
Remark string `json:"remark"`
}
type BelieveRechargeRollbackRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
/**
撤销充值
*/
func (s *believe) RechargeRollback(ctx context.Context, req *BelieveRechargeRollbackReq) (res *BelieveRechargeRollbackRes, err error) {
result, err := post(ctx, "com.csx.credit-recharge-rollback.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Coupons = new(coupons)
type coupons struct {
}
type ExchangeCouponsReq struct {
RequestId string `json:"request_id"`
CouponCode string `json:"coupon_code"`
Telephone string `json:"telephone"`
}
type ExchangeCouponsRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data string `json:"data"`
}
/**
优惠券兑换
*/
func (s *coupons) Exchange(ctx context.Context, req *ExchangeCouponsReq) (res *ExchangeCouponsRes, err error) {
result, err := post(ctx, "com.csx.voucher-exchange-coupons.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type CouponsDetailReq struct {
CouponId string `json:"coupon_id"`
}
type CouponsDetailRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
CouponsId string `json:"couponsId"`
Telephone string `json:"telephone"`
CouponStatus int `json:"couponStatus"`
ExpireDate string `json:"expireDate"`
} `json:"data"`
}
/**
优惠券使用明细查询
*/
func (s *coupons) Detail(ctx context.Context, req *CouponsDetailReq) (res *CouponsDetailRes, err error) {
result, err := post(ctx, "com.csx.voucher-coupons-detail-search.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Goods = new(goods)
type goods struct {
}
type GoodsListReq struct {
GoodsCode string `json:"goodsCode"`
StartNum int `json:"startNum"`
PageSize int `json:"pageSize"`
}
type GoodsListRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
LineNo int `json:"lineNo"`
GoodsCode string `json:"goodsCode"`
GoodsName string `json:"goodsName"`
GoodsUnit string `json:"goodsUnit"`
GoodsSpec string `json:"goodsSpec"`
GoodsClass struct {
FirstClass string `json:"firstClass"`
FirstClassId string `json:"firstClassId"`
SecondClass string `json:"secondClass"`
SecondClassId string `json:"secondClassId"`
} `json:"goodsClass"`
GoodsPic struct {
SmallPicUrl string `json:"smallPicUrl"`
MiddlePicUrl string `json:"middlePicUrl"`
MainPicUrl string `json:"mainPicUrl"`
DetailPicUrl string `json:"detailPicUrl"`
} `json:"goodsPic"`
GoodsTaxRate string `json:"goodsTaxRate"`
GoodsTaxCode string `json:"goodsTaxCode"`
MinLimit string `json:"minLimit"`
ComposeGoodsTaxInfo []interface{} `json:"composeGoodsTaxInfo"`
BrandName string `json:"brandName"`
DeliveryType int `json:"deliveryType"`
DeliveryAreas string `json:"deliveryAreas"`
SalesStatus int `json:"salesStatus"`
GoodsFreightType string `json:"goodsFreightType"`
GoodsStatus int `json:"goodsStatus"`
} `json:"data"`
}
/**
商品列表
*/
func (s *goods) List(ctx context.Context, req *GoodsListReq) (res *GoodsListRes, err error) {
result, err := post(ctx, "com.csx.goods-detail.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type GoodsBaseReq struct {
GoodsCode string `json:"goodsCode"`
}
type GoodsPriceRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
GoodsCode string `json:"goodsCode"`
GoodsPrice int `json:"goodsPrice"`
} `json:"data"`
}
/**
商品价格
*/
func (s *goods) Price(ctx context.Context, req *GoodsBaseReq) (res *GoodsPriceRes, err error) {
result, err := post(ctx, "com.csx.goods-detail.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type GoodsQtyReq struct {
Province string `json:"province"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
GoodsCode string `json:"goodsCode"`
DeliveryType string `json:"deliveryType"`
}
type GoodsQtyRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
} `json:"data"`
}
/**
商品库存
*/
func (s *goods) GoodsQty(ctx context.Context, req *GoodsQtyReq) (res *GoodsQtyRes, err error) {
result, err := post(ctx, "com.csx.inventory-search.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type GoodsQtyQtyAreaReq struct {
Type string `json:"type"`
Area string `json:"area"`
GoodsCodes string `json:"goodsCodes"`
}
type GoodsQtyQtyAreaRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
GoodsCode string `json:"goodsCode"`
SalesStatus int `json:"salesStatus"`
GoodsStatus int `json:"goodsStatus"`
} `json:"data"`
}
/**
商品库存接口(地址映射)
*/
func (s *goods) GoodsQtyQtyArea(ctx context.Context, req *GoodsQtyQtyAreaReq) (res *GoodsQtyQtyAreaRes, err error) {
result, err := post(ctx, "com.csx.inventory-search-area.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type GoodsShelvesRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
GoodsCode string `json:"goodsCode"`
SalesStatus int `json:"salesStatus"`
GoodsStatus int `json:"goodsStatus"`
} `json:"data"`
}
/**
商品上下架
*/
func (s *goods) GoodsShelves(ctx context.Context, req *GoodsBaseReq) (res *GoodsShelvesRes, err error) {
result, err := post(ctx, "com.csx.goods-shelves.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Msg = new(msg)
type msg struct {
}
type msgPullReq struct {
MessageType string `json:"messageType"`
PageNo string `json:"pageNo"`
PageSize string `json:"pageSize"`
}
type msgPullRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
Id string `json:"id"`
Type string `json:"type"`
CreateTime string `json:"createTime"`
MessageInfo string `json:"messageInfo"`
} `json:"data"`
}
/**
正向订单
*/
type MsgOrder struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
OrderStatus string `json:"orderStatus"`
}
/**
售后订单
*/
type MsgOrderRefund struct {
AfterSalesOrderCode string `json:"afterSalesOrderCode"`
ThirdAfterSalesCode string `json:"thirdAfterSalesCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
CsxOrderCode string `json:"csxOrderCode"`
AfterSalesStatus string `json:"afterSalesStatus"`
RefundStatus string `json:"refundStatus"`
IsOffline bool `json:"isOffline"`
}
/**
物流发货
*/
type MsgLogistic struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
LogisticCode string `json:"logisticCode"`
ShipperCode string `json:"shipperCode"`
LogisticStatus string `json:"logisticStatus"`
}
/**
商品变更
*/
type MsgGoodsChange struct {
GoodsCode string `json:"goodsCode"`
}
/**
商品上下架
*/
type MsgGoodsShelves struct {
GoodsCode string `json:"goodsCode"`
GoodsStatus string `json:"goodsStatus"`
}
/**
商品价格变更
*/
type MsgGoodsPrice struct {
GoodsCode string `json:"goodsCode"`
GoodsPrice string `json:"goodsPrice"`
}
/**
消息拉取
*/
func (s *msg) pull(ctx context.Context, req *msgPullReq) (res *msgPullRes, err error) {
result, err := post(ctx, "com.csx.message-pull.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type MsgRemoveReq struct {
MessageIds string `json:"messageIds"`
}
type MsgRemoveRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data string `json:"data"`
}
/**
删除消息
*/
func (s *msg) Remove(ctx context.Context, req *MsgRemoveReq) (res *MsgRemoveRes, err error) {
result, err := post(ctx, "com.csx.message-remove.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var Order = new(order)
type order struct {
}
type OrderCreateReq struct {
DeliveryType int `json:"deliveryType"`
ThirdOrderCode string `json:"thirdOrderCode"`
CreateMode int `json:"createMode"`
ReceiveDate string `json:"receiveDate"`
OrderAmount string `json:"orderAmount"`
GoodsAmount string `json:"goodsAmount"`
FreightAmount string `json:"freightAmount"`
OrderRemark string `json:"orderRemark"`
UseCreditPay int `json:"useCreditPay"`
UserTelephone string `json:"userTelephone"`
GoodsInfos []struct {
GoodsCode string `json:"goodsCode"`
GoodsPrice string `json:"goodsPrice"`
GoodsQty int `json:"goodsQty"`
} `json:"goodsInfos"`
ReceiverInfo struct {
Name string `json:"name"`
Prov string `json:"prov"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
Telephone string `json:"telephone"`
} `json:"receiverInfo"`
}
type OrderCreateRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
/**
创建订单
*/
func (s *order) Create(ctx context.Context, req *OrderCreateReq) (res *OrderCreateRes, err error) {
result, err := post(ctx, "com.csx.order-save.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderConfirmReq struct {
OrderCode string `json:"orderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
UseCreditPay string `json:"useCreditPay"`
}
type OrderConfirmRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data string `json:"data"`
}
/**
确认订单
*/
func (s *order) Confirm(ctx context.Context, req *OrderConfirmReq) (res *OrderConfirmRes, err error) {
result, err := post(ctx, "com.csx.order-confirm.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderDetailReq struct {
OrderCode string `json:"orderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderDetailRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
CreateTime string `json:"createTime"`
Freight int `json:"freight"`
GoodsDetails []struct {
ClassCode string `json:"classCode"`
ClassName string `json:"className"`
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
GoodsImage string `json:"goodsImage"`
GoodsName string `json:"goodsName"`
GoodsPrice int `json:"goodsPrice"`
GoodsSpec string `json:"goodsSpec"`
GoodsUnit string `json:"goodsUnit"`
NetPrice float64 `json:"netPrice"`
TaxPrice int `json:"taxPrice"`
TaxRate int `json:"taxRate"`
TotalPrice int `json:"totalPrice"`
} `json:"goodsDetails"`
CsxOrderCode string `json:"csxOrderCode"`
OrderPrice int `json:"orderPrice"`
OrderStatus string `json:"orderStatus"`
OrderType int `json:"orderType"`
PayDetails []struct {
PayAmount int `json:"payAmount"`
PayCode string `json:"payCode"`
PayType string `json:"payType"`
} `json:"payDetails"`
PayTime string `json:"payTime"`
PushType string `json:"pushType"`
ReceiverAddress string `json:"receiverAddress"`
ReceiverName string `json:"receiverName"`
ReceiverPhone string `json:"receiverPhone"`
ShipTime string `json:"shipTime"`
UserName string `json:"userName"`
UserTelephone string `json:"userTelephone"`
SubOrderDetails []struct {
CsxSubOrderCode string `json:"csxSubOrderCode"`
OrderStatus string `json:"orderStatus"`
GoodsDetails []struct {
ClassCode string `json:"classCode"`
ClassName string `json:"className"`
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
GoodsImage string `json:"goodsImage"`
GoodsName string `json:"goodsName"`
GoodsPrice float64 `json:"goodsPrice"`
GoodsSpec string `json:"goodsSpec"`
GoodsUnit string `json:"goodsUnit"`
NetPrice float64 `json:"netPrice"`
TaxPrice float64 `json:"taxPrice"`
TaxRate int `json:"taxRate"`
TotalPrice float64 `json:"totalPrice"`
} `json:"goodsDetails"`
} `json:"subOrderDetails"`
} `json:"data"`
}
/**
订单详情
*/
func (s *order) Detail(ctx context.Context, req *OrderDetailReq) (res *OrderDetailRes, err error) {
result, err := post(ctx, "com.csx.order-detail.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderQueryReq struct {
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderQueryRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data int64 `json:"data"`
}
/**
反查订单
*/
func (s *order) Query(ctx context.Context, req *OrderQueryReq) (res *OrderQueryRes, err error) {
result, err := post(ctx, "com.csx.order-query.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderReceiveReq struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderReceiveRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
/**
签收订单
*/
func (s *order) Receive(ctx context.Context, req *OrderReceiveReq) (res *OrderReceiveRes, err error) {
result, err := post(ctx, "com.csx.order-sign.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderCancelReq struct {
ThirdOrderCode string `json:"thirdOrderCode "`
CsxOrderCode string `json:"csxOrderCode"`
CsxSubOrderCode string `json:"csxSubOrderCode "`
}
type OrderCancelRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
ThirdOrderCode string `json:"thirdOrderCode"`
OrderCode string `json:"orderCode"`
SubOrderCode string `json:"subOrderCode"`
GoodsInfo []struct {
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
} `json:"goodsInfo"`
} `json:"data"`
}
/**
取消订单
*/
func (s *order) Cancel(ctx context.Context, req *OrderCancelReq) (res *OrderCancelRes, err error) {
result, err := post(ctx, "com.csx.order-cancel.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderLogisticsReq struct {
ThirdOrderCode string `json:"thirdOrderCode"`
CsxOrderCode string `json:"csxOrderCode"`
LogisticCode string `json:"logisticCode"`
}
type OrderLogisticsRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
ThirdOrderCode string `json:"thirdOrderCode"`
CsxOrderCode string `json:"csxOrderCode"`
LogisticCode string `json:"logisticCode"`
ItemList []struct {
LogisticsCompany string `json:"logisticsCompany"`
LogisticsCode string `json:"logisticsCode"`
State string `json:"state"`
StateEx string `json:"stateEx"`
Location string `json:"location"`
Traces []struct {
AcceptTime string `json:"acceptTime"`
AcceptStation string `json:"acceptStation"`
Location string `json:"location"`
Action string `json:"action"`
Remark string `json:"remark,omitempty"`
} `json:"traces"`
GoodsInfos []struct {
GoodsCode string `json:"goodsCode"`
GoodsName string `json:"goodsName"`
OutCount string `json:"outCount"`
} `json:"goodsInfos"`
} `json:"itemList"`
} `json:"data"`
}
/**
查询物流
*/
func (s *order) Logistics(ctx context.Context, req *OrderLogisticsReq) (res *OrderLogisticsRes, err error) {
result, err := post(ctx, "com.csx.logistics-query.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderFreightReq struct {
DeliveryType int `json:"deliveryType"`
GoodsInfos []struct {
GoodsCode string `json:"goodsCode"`
GoodsQty int `json:"goodsQty"`
} `json:"goodsInfos"`
ReceiverAddress struct {
Prov string `json:"prov"`
City string `json:"city"`
Area string `json:"area"`
Address string `json:"address"`
} `json:"receiverAddress"`
}
type OrderFreightRes struct {
Success bool `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
Freight string `json:"freight"`
Weight int `json:"weight"`
FreightInfoDetail struct {
Field1 []struct {
GoodsFreightType string `json:"goodsFreightType"`
FreightInfo struct {
FreightStandard string `json:"freightStandard"`
FreeShipPrice string `json:"freeShipPrice"`
FreightNeedAddOn bool `json:"freightNeedAddOn"`
FreightAddOnMsg string `json:"freightAddOnMsg"`
GoodsAmount string `json:"goodsAmount"`
AddOnAmount string `json:"addOnAmount"`
FreightAmount string `json:"freightAmount"`
} `json:"freightInfo"`
GoodsInfo []struct {
GoodsCode string `json:"goodsCode"`
GoodsWight string `json:"goodsWight"`
} `json:"goodsInfo"`
} `json:"0"`
} `json:"freightInfoDetail"`
} `json:"data"`
}
/**
订单运费
*/
func (s *order) Freight(ctx context.Context, req *OrderFreightRes) (res *OrderFreightReq, err error) {
result, err := post(ctx, "com.csx.order-freight-compute.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package yonghui
import (
"context"
"github.com/gogf/gf/encoding/gjson"
)
var OrderRefund = new(orderRefund)
type orderRefund struct {
}
type OrderRefundApplyReq struct {
ThirdAfterSalesCode string `json:"thirdAfterSalesCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
CsxOrderCode string `json:"csxOrderCode"`
ReasonCode int `json:"reasonCode"`
ReasonMsg string `json:"reasonMsg"`
Images []string `json:"images"`
GoodsList []struct {
GoodsQty int `json:"goodsQty"`
GoodsCode string `json:"goodsCode"`
} `json:"goodsList"`
}
type OrderRefundApplyRes struct {
Success string `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
AftersalesInfos []struct {
AfterSalesCode string `json:"afterSalesCode"`
AfterSalesGoodsInfos []struct {
AssembleGoodsCode string `json:"assembleGoodsCode"`
GoodsCode string `json:"goodsCode"`
GoodsName string `json:"goodsName"`
} `json:"afterSalesGoodsInfos"`
} `json:"aftersalesInfos"`
} `json:"data"`
}
/**
申请售后
*/
func (s *orderRefund) Apply(ctx context.Context, req *OrderRefundApplyReq) (res *OrderRefundApplyRes, err error) {
result, err := post(ctx, "com.csx.order-aftersales-apply.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderRefundSubmitLogisticsReq struct {
AfterSalesCode string `json:"afterSalesCode"`
ShipperCode string `json:"shipperCode"`
LogisticsCode string `json:"logisticsCode"`
}
type OrderRefundSubmitLogisticsRes struct {
Success string `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data string `json:"data"`
}
/**
更新物流
*/
func (s *orderRefund) SubmitLogistics(ctx context.Context, req *OrderRefundSubmitLogisticsReq) (res *OrderRefundSubmitLogisticsRes, err error) {
result, err := post(ctx, "com.csx.order-aftersales-submit-logistics.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderRefundCancelReq struct {
ThirdAfterSalesCode string `json:"thirdAfterSalesCode"`
AfterSalesCode string `json:"afterSalesCode"`
}
type OrderRefundCancelRes struct {
Success string `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data string `json:"data"`
}
/**
取消售后
*/
func (s *orderRefund) Cancel(ctx context.Context, req *OrderRefundCancelReq) (res *OrderRefundCancelRes, err error) {
result, err := post(ctx, "com.csx.order-cancelAftersales.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderRefundQueryReq struct {
ThirdAfterSalesCode string `json:"thirdAfterSalesCode"`
AfterSalesCode string `json:"afterSalesCode"`
}
type OrderRefundQueryRes struct {
Success string `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data []struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
AfterSalesCode string `json:"afterSalesCode"`
ThirdAfterSalesCode string `json:"thirdAfterSalesCode"`
RefundFreight string `json:"refundFreight"`
RefundTotalAmt string `json:"refundTotalAmt"`
RefundGoodsAmt string `json:"refundGoodsAmt"`
NeedReturnGoods int `json:"needReturnGoods"`
AfterSalesType int `json:"afterSalesType"`
ReasonCode int `json:"reasonCode"`
ReasonMsg string `json:"reasonMsg"`
AfterSalesImages string `json:"afterSalesImages"`
Remark string `json:"remark"`
ReturnGoodsStatus int `json:"returnGoodsStatus"`
RefundStatus int `json:"refundStatus"`
AuditType int `json:"auditType"`
AfterSalesStatus int `json:"afterSalesStatus"`
RecipientName string `json:"recipientName"`
RecipientPhone string `json:"recipientPhone"`
RecipientAddress string `json:"recipientAddress"`
CreateTime string `json:"createTime"`
EndTime string `json:"endTime"`
AfterSalesGoodsDetails []struct {
GoodsCode string `json:"goodsCode"`
GoodsName string `json:"goodsName"`
ReturnCount int `json:"returnCount"`
GoodsTotalPrice string `json:"goodsTotalPrice"`
GoodsFreightPrice string `json:"goodsFreightPrice"`
AssembleGoodsCode string `json:"assembleGoodsCode,omitempty"`
} `json:"afterSalesGoodsDetails"`
} `json:"data"`
}
/**
查询售后
*/
func (s *orderRefund) Query(ctx context.Context, req *OrderRefundQueryReq) (res *OrderRefundQueryRes, err error) {
result, err := post(ctx, "com.csx.order-aftersales-detail-query.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
type OrderRefundListReq struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
}
type OrderRefundListRes struct {
Success string `json:"success"`
Code string `json:"code"`
Message string `json:"message"`
Data struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
AftersalesDetailRespVoList []struct {
CsxOrderCode string `json:"csxOrderCode"`
ThirdOrderCode string `json:"thirdOrderCode"`
AfterSalesCode string `json:"afterSalesCode"`
ThirdAfterSalesCode string `json:"thirdAfterSalesCode"`
RefundFreight string `json:"refundFreight"`
RefundTotalAmt string `json:"refundTotalAmt"`
RefundGoodsAmt string `json:"refundGoodsAmt"`
NeedReturnGoods int `json:"needReturnGoods"`
AfterSalesType int `json:"afterSalesType"`
ReasonCode int `json:"reasonCode"`
ReasonMsg string `json:"reasonMsg"`
AfterSalesImages string `json:"afterSalesImages"`
Remark string `json:"remark"`
ReturnGoodsStatus int `json:"returnGoodsStatus"`
RefundStatus int `json:"refundStatus"`
AuditType int `json:"auditType"`
AfterSalesStatus int `json:"afterSalesStatus"`
RecipientName string `json:"recipientName"`
RecipientPhone string `json:"recipientPhone"`
RecipientAddress string `json:"recipientAddress"`
CreateTime string `json:"createTime"`
EndTime string `json:"endTime"`
AfterSalesGoodsDetails []struct {
GoodsCode string `json:"goodsCode"`
GoodsName string `json:"goodsName"`
ReturnCount int `json:"returnCount"`
GoodsTotalPrice string `json:"goodsTotalPrice"`
GoodsFreightPrice string `json:"goodsFreightPrice"`
AssembleGoodsCode string `json:"assembleGoodsCode,omitempty"`
} `json:"afterSalesGoodsDetails"`
} `json:"aftersalesDetailRespVoList"`
} `json:"data"`
}
/**
查询售后
*/
func (s *orderRefund) List(ctx context.Context, req *OrderRefundListReq) (res *OrderRefundListRes, err error) {
result, err := post(ctx, "com.csx.order-aftersales-list-query.do", req)
if nil != err {
return
}
err = gjson.New(result).Scan(&res)
return
}
package yonghui
/**
订单数据推送
*/
type OrderPushReq struct {
CreateTime string `json:"createTime"`
FinishTime string `json:"finishTime"`
Freight int `json:"freight"`
GoodsDetails []struct {
ClassCode string `json:"classCode"`
ClassName string `json:"className"`
GoodsCode string `json:"goodsCode"`
GoodsCount int `json:"goodsCount"`
GoodsImage string `json:"goodsImage"`
GoodsName string `json:"goodsName"`
GoodsPrice int `json:"goodsPrice"`
GoodsSpec string `json:"goodsSpec"`
GoodsUnit string `json:"goodsUnit"`
NetPrice int `json:"netPrice"`
TaxPrice int `json:"taxPrice"`
TaxRate int `json:"taxRate"`
TotalPrice int `json:"totalPrice"`
} `json:"goodsDetails"`
OrderCode string `json:"orderCode"`
OrderPrice int `json:"orderPrice"`
OrderStatus string `json:"orderStatus"`
OrderType int `json:"orderType"`
PayDetails []struct {
PayAmount int `json:"payAmount"`
PayCode string `json:"payCode"`
PayType string `json:"payType"`
} `json:"payDetails"`
PayTime string `json:"payTime"`
PushType string `json:"pushType"`
ReceiverAddress string `json:"receiverAddress"`
ReceiverName string `json:"receiverName"`
ReceiverPhone string `json:"receiverPhone"`
ShipTime string `json:"shipTime"`
SignTime string `json:"signTime"`
UserName string `json:"userName"`
UserTelephone string `json:"userTelephone"`
}
type DataPushRes struct {
Result bool `json:"result"`
Message string `json:"message"`
}
/**
包裹数据推
*/
type PackagePushReq struct {
GoodsDetails []struct {
GoodsCode string `json:"goodsCode"`
GoodsCount int `json:"goodsCount"`
GoodsName string `json:"goodsName"`
LogisticCode string `json:"logisticCode"`
OutCountSum int `json:"outCountSum"`
PageOutCount int `json:"pageOutCount"`
ShipperCode string `json:"shipperCode"`
} `json:"goodsDetails"`
LogisticCode string `json:"logisticCode"`
LogisticStatus int `json:"logisticStatus"`
LogisticTime string `json:"logisticTime"`
OrderCode string `json:"orderCode"`
OrderKey string `json:"orderKey"`
PackageCode string `json:"packageCode"`
PackageRemark string `json:"packageRemark"`
PushType string `json:"pushType"`
ReceiverName string `json:"receiverName"`
ShipperCode string `json:"shipperCode"`
ShipperName string `json:"shipperName"`
ThirdOrderCode string `json:"thirdOrderCode"`
UserTelephone string `json:"userTelephone"`
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论