aa
This commit is contained in:
@@ -2,8 +2,59 @@ package pddapi
|
||||
|
||||
import "git.rosy.net.cn/baseapi/utils"
|
||||
|
||||
const (
|
||||
OrderStatusPay = 0 //-已支付;
|
||||
OrderStatus1 = 1 //-已成团;
|
||||
OrderStatusTakeOver = 2 //-确认收货;
|
||||
OrderStatusAuditOver = 3 //-审核成功;
|
||||
OrderStatusAuditFail = 4 //-审核失败(不可提现);
|
||||
OrderStatusEaring = 5 //-已经结算 ;
|
||||
OrderStatusJuge = 10 //-已处罚
|
||||
)
|
||||
|
||||
type OrderListRangeGetResult struct {
|
||||
LastOrderID string `json:"last_order_id"`
|
||||
OrderList []struct {
|
||||
SepMarketFee int `json:"sep_market_fee"`
|
||||
GoodsPrice int `json:"goods_price"`
|
||||
SepDuoID int `json:"sep_duo_id"`
|
||||
PromotionRate int `json:"promotion_rate"`
|
||||
Type int `json:"type"`
|
||||
CatIds []int `json:"cat_ids"`
|
||||
OrderStatus int `json:"order_status"`
|
||||
OrderCreateTime int `json:"order_create_time"`
|
||||
IsDirect int `json:"is_direct"`
|
||||
OrderGroupSuccessTime int `json:"order_group_success_time"`
|
||||
OrderAmount int `json:"order_amount"`
|
||||
PriceCompareStatus int `json:"price_compare_status"`
|
||||
OrderModifyAt int `json:"order_modify_at"`
|
||||
AuthDuoID int `json:"auth_duo_id"`
|
||||
CpaNew int `json:"cpa_new"`
|
||||
GoodsName string `json:"goods_name"`
|
||||
BatchNo string `json:"batch_no"`
|
||||
GoodsQuantity int `json:"goods_quantity"`
|
||||
GoodsID int64 `json:"goods_id"`
|
||||
SepParameters string `json:"sep_parameters"`
|
||||
SepRate int `json:"sep_rate"`
|
||||
CustomParameters string `json:"custom_parameters"`
|
||||
GoodsThumbnailURL string `json:"goods_thumbnail_url"`
|
||||
ShareRate int `json:"share_rate"`
|
||||
PromotionAmount int `json:"promotion_amount"`
|
||||
OrderPayTime int `json:"order_pay_time"`
|
||||
GroupID int64 `json:"group_id"`
|
||||
SepPid string `json:"sep_pid"`
|
||||
OrderStatusDesc string `json:"order_status_desc"`
|
||||
ShareAmount int `json:"share_amount"`
|
||||
GoodsSign string `json:"goods_sign"`
|
||||
OrderSn string `json:"order_sn"`
|
||||
PID string `json:"p_id"`
|
||||
ZsDuoID int `json:"zs_duo_id"`
|
||||
} `json:"order_list"`
|
||||
RequestID string `json:"request_id"`
|
||||
}
|
||||
|
||||
//查询订单列表
|
||||
func (a *API) OrderListRangeGet(beginTime, endTime, lastOrderID string, pageSize int) (bool bool, err error) {
|
||||
func (a *API) OrderListRangeGet(beginTime, endTime, lastOrderID string, pageSize int) (orderListRangeGetResult *OrderListRangeGetResult, err error) {
|
||||
params := map[string]interface{}{
|
||||
"start_time": beginTime,
|
||||
"end_time": endTime,
|
||||
@@ -14,27 +65,75 @@ func (a *API) OrderListRangeGet(beginTime, endTime, lastOrderID string, pageSize
|
||||
}
|
||||
result, err := a.AccessAPI("pdd.ddk.order.list.range.get", false, params)
|
||||
if err == nil {
|
||||
if utils.MustInterface2Int64(result["order_list_get_response"].(map[string]interface{})["order_list"]) == 0 {
|
||||
return false, err
|
||||
} else {
|
||||
return true, err
|
||||
}
|
||||
utils.Map2StructByJson(result["order_list_get_response"], &orderListRangeGetResult, false)
|
||||
}
|
||||
return false, err
|
||||
return orderListRangeGetResult, err
|
||||
}
|
||||
|
||||
type OrderDetailGetResult struct {
|
||||
SepMarketFee int `json:"sep_market_fee"`
|
||||
GoodsPrice int `json:"goods_price"`
|
||||
SepDuoID int `json:"sep_duo_id"`
|
||||
CpsSign string `json:"cps_sign"`
|
||||
Pid string `json:"pid"`
|
||||
PromotionRate int `json:"promotion_rate"`
|
||||
Type int `json:"type"`
|
||||
CatIds []int `json:"cat_ids"`
|
||||
OrderStatus int `json:"order_status"`
|
||||
OrderCreateTime int `json:"order_create_time"`
|
||||
IsDirect int `json:"is_direct"`
|
||||
OrderGroupSuccessTime int `json:"order_group_success_time"`
|
||||
OrderAmount int `json:"order_amount"`
|
||||
PriceCompareStatus int `json:"price_compare_status"`
|
||||
OrderModifyAt int `json:"order_modify_at"`
|
||||
AuthDuoID int `json:"auth_duo_id"`
|
||||
CpaNew int `json:"cpa_new"`
|
||||
GoodsName string `json:"goods_name"`
|
||||
BatchNo string `json:"batch_no"`
|
||||
URLLastGenerateTime int `json:"url_last_generate_time"`
|
||||
GoodsQuantity int `json:"goods_quantity"`
|
||||
GoodsID int64 `json:"goods_id"`
|
||||
SepParameters string `json:"sep_parameters"`
|
||||
SepRate int `json:"sep_rate"`
|
||||
CustomParameters string `json:"custom_parameters"`
|
||||
GoodsThumbnailURL string `json:"goods_thumbnail_url"`
|
||||
ShareRate int `json:"share_rate"`
|
||||
PromotionAmount int `json:"promotion_amount"`
|
||||
OrderPayTime int `json:"order_pay_time"`
|
||||
GroupID int64 `json:"group_id"`
|
||||
SepPid string `json:"sep_pid"`
|
||||
ReturnStatus int `json:"return_status"`
|
||||
OrderStatusDesc string `json:"order_status_desc"`
|
||||
ShareAmount int `json:"share_amount"`
|
||||
RequestID string `json:"request_id"`
|
||||
GoodsSign string `json:"goods_sign"`
|
||||
OrderSn string `json:"order_sn"`
|
||||
ZsDuoID int `json:"zs_duo_id"`
|
||||
}
|
||||
|
||||
//查询订单详情
|
||||
func (a *API) OrderDetailGet(orderID string) (bool bool, err error) {
|
||||
func (a *API) OrderDetailGet(orderID string) (orderDetailGetResult *OrderDetailGetResult, err error) {
|
||||
params := map[string]interface{}{
|
||||
"order_sn": orderID,
|
||||
}
|
||||
result, err := a.AccessAPI("pdd.ddk.order.detail.get", false, params)
|
||||
if err == nil {
|
||||
if utils.MustInterface2Int64(result["order_list_get_response"].(map[string]interface{})["order_list"]) == 0 {
|
||||
return false, err
|
||||
} else {
|
||||
return true, err
|
||||
}
|
||||
utils.Map2StructByJson(result["order_detail_response"], &orderDetailGetResult, false)
|
||||
}
|
||||
return false, err
|
||||
return orderDetailGetResult, err
|
||||
}
|
||||
|
||||
//查询订单列表2
|
||||
func (a *API) OrderListIncrementGet(start_update_time, end_update_time int64, page, pageSize int) (orderDetailGetResult *OrderDetailGetResult, err error) {
|
||||
params := map[string]interface{}{
|
||||
"start_update_time": start_update_time,
|
||||
"end_update_time": end_update_time,
|
||||
"page": page,
|
||||
"page_size": pageSize,
|
||||
}
|
||||
result, err := a.AccessAPI("pdd.ddk.order.list.increment.get", false, params)
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["order_detail_response"], &orderDetailGetResult, false)
|
||||
}
|
||||
return orderDetailGetResult, err
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package pddapi
|
||||
import (
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestOrderListRangeGet(t *testing.T) {
|
||||
result, err := api.OrderListRangeGet("2021-04-28 00:00:00", "2021-04-29:23:59:59", "", 100)
|
||||
result, err := api.OrderListRangeGet("2021-05-05 00:00:00", "2021-05-06:23:59:59", "", 100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -14,7 +15,15 @@ func TestOrderListRangeGet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOrderDetailGet(t *testing.T) {
|
||||
result, err := api.OrderDetailGet("")
|
||||
result, err := api.OrderDetailGet("210429-173092373722098")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestOrderListIncrementGet(t *testing.T) {
|
||||
result, err := api.OrderListIncrementGet(time.Now().Add(-time.Hour*24).Unix(), time.Now().Unix(), 1, 10)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user