ejy
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/platformapi"
|
||||
@@ -128,6 +129,7 @@ type GetStationListResult struct {
|
||||
|
||||
//获取油站列表
|
||||
func (a *API) GetStationList() (getStationListResult []*GetStationListResult, err error) {
|
||||
a.SetTimestamp(time.Now().Unix())
|
||||
params := make(map[string]interface{})
|
||||
// params["platformName"] = a.platformName
|
||||
sign := a.signParam(params)
|
||||
@@ -167,6 +169,7 @@ type GetUserOrdersResult struct {
|
||||
|
||||
//获取用户个人订单
|
||||
func (a *API) GetUserOrders(userPhone string, page int) (getUserOrdersResult *GetUserOrdersResult, err error) {
|
||||
a.SetTimestamp(time.Now().Unix())
|
||||
params := make(map[string]interface{})
|
||||
params["stationIds"] = ""
|
||||
params["page"] = page
|
||||
@@ -188,10 +191,11 @@ type UserRefundResult struct {
|
||||
|
||||
//用户申请退款
|
||||
func (a *API) UserRefund(orderId, userPhone, reason string) (userRefundResult *UserRefundResult, err error) {
|
||||
a.SetTimestamp(time.Now().Unix())
|
||||
params := make(map[string]interface{})
|
||||
params["reason"] = reason
|
||||
sign := a.signParam(params)
|
||||
result, err := a.AccessAPI("oreo/ejiayou_open_api/platform/refund/v1/"+a.platformName+"/"+userPhone+"/"+orderId+"/"+sign+"/"+utils.Int64ToStr(a.timeStamp), TestUrl, params, false)
|
||||
result, err := a.AccessAPI("oreo/ejiayou_open_api/platform/refund/v1/"+a.platformName+"/"+userPhone+"/"+orderId+"/"+sign+"/"+utils.Int64ToStr(a.timeStamp), Url, params, false)
|
||||
if err == nil {
|
||||
utils.Map2StructByJson(result["data"], &userRefundResult, false)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package ejyapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"git.rosy.net.cn/baseapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -18,9 +17,8 @@ func init() {
|
||||
logger, _ := zap.NewDevelopment()
|
||||
sugarLogger = logger.Sugar()
|
||||
baseapi.Init(sugarLogger)
|
||||
api = New("1Zbve", "ymsrrxlZXlmglK6Q", "MYsFZGgwwprIahzQ")
|
||||
// api = New("1Zbve", "htvse3XEDhBnCTNo", "QM5RnGl6kNh3ENLT")
|
||||
api.SetTimestamp(time.Now().Unix())
|
||||
// api = New("1Zbve", "ymsrrxlZXlmglK6Q", "MYsFZGgwwprIahzQ")
|
||||
api = New("1Zbve", "htvse3XEDhBnCTNo", "QM5RnGl6kNh3ENLT")
|
||||
}
|
||||
|
||||
func TestGetStationList(t *testing.T) {
|
||||
@@ -32,7 +30,7 @@ func TestGetStationList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserOrders(t *testing.T) {
|
||||
result, err := api.GetUserOrders("18980410281", 1)
|
||||
result, err := api.GetUserOrders("13688462300", 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -175,3 +175,10 @@ func TestProcessQuestionPic(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestCancelAndRefund(t *testing.T) {
|
||||
err := api.CancelAndRefund("2030098332000261", "jxadmin", "协商一致")
|
||||
if err != nil {
|
||||
t.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,9 +274,9 @@ func TestGetJdShopOrders(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJdTopSkus(t *testing.T) {
|
||||
err := api.GetJdStoreInfo("12050477")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// err := api.GetJdStoreInfo("12050477")
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user