Merge branch 'master' of https://e.coding.net/rosydev/baseapi
This commit is contained in:
@@ -45,7 +45,7 @@ import (
|
||||
//}
|
||||
//
|
||||
func TestCancel(t *testing.T) {
|
||||
cancelResponse, err := dadaapi.CancelOrder("1100551162883899675", ReasonIDOther, "协商一致")
|
||||
cancelResponse, err := dadaapi.CancelOrder("1100632781686164762", ReasonIDOther, "协商一致")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package jdapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -800,8 +799,6 @@ func (a *API) GetSkuCategoryBySkuName(productName string) (*GetSkuCategoryBySkuN
|
||||
"productName": productName,
|
||||
"fields": []string{"category"},
|
||||
}, nil, nil, nil)
|
||||
globals.SugarLogger.Debugf("GetSkuCategoryBySkuName :%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("err :%v", err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestRetailDiscountBatchSave(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailDiscountList(t *testing.T) {
|
||||
result, err := api.RetailDiscountList("8694203", RetailActTypeSecKill)
|
||||
result, err := api.RetailDiscountList("9202390", RetailActTypeSecKill)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
func TestBillList(t *testing.T) {
|
||||
now := time.Now()
|
||||
from := time.Date(now.Year(), now.Month(), now.Day()-8, 0, 0, 0, 0, time.Local)
|
||||
to := time.Date(now.Year(), now.Month(), now.Day()-2, 23, 59, 59, 59, time.Local)
|
||||
from := time.Date(now.Year(), now.Month(), now.Day()-7, 0, 0, 0, 0, time.Local)
|
||||
to := time.Date(now.Year(), now.Month(), now.Day()-1, 23, 59, 59, 59, time.Local)
|
||||
param := &Bill{
|
||||
AppPoiCode: "7379574",
|
||||
AppPoiCode: "9202390",
|
||||
StartDate: from.Unix(),
|
||||
EndDate: to.Unix(),
|
||||
Offset: 0,
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
func TestCommentQuery(t *testing.T) {
|
||||
result, err := api.CommentQuery("7809572", "20210817", "20210818", 0, 0, CommentReplyStatusAll)
|
||||
result, err := api.CommentQuery("18026738", "20230711", "20230717", 0, 0, CommentReplyStatusNotReplied)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -20,3 +21,7 @@ func TestCommentAddReply(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTime(t *testing.T) {
|
||||
fmt.Println(utils.TryStr2Time("2023-07-16"))
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ func TestGetAccessToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAccessToken2(t *testing.T) {
|
||||
result, err := api.GetAccessToken2("18125316 ") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
|
||||
result, err := api.GetAccessToken2("17284266") //refresh_token_pLG7Jw7g9mu7oOzNSuJIUg
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ func TestGetOrderIdByDaySeq(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOrderIdByDaySeqSingle(t *testing.T) {
|
||||
result, err := api.GetOrderIdByDaySeqSingle("16708848", utils.Time2Date(time.Now()), 1)
|
||||
result, err := api.GetOrderIdByDaySeqSingle("17284266", utils.Time2Date(time.Now()), 1)
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -19,71 +19,71 @@ import (
|
||||
|
||||
// AgreeUserCancel 同意用户售后申请
|
||||
func (a *API) AgreeUserCancel(req *request2.AlibabaTclsAelophyRefundAgreeRequest) error {
|
||||
globals.SugarLogger.Debugf("进入AgreeUserCancel := %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入AgreeUserCancel := %s", utils.Format4Output(req, false))
|
||||
client := ability3156.NewAbility3156(&a.client)
|
||||
|
||||
data, _ := client.AlibabaTclsAelophyRefundAgree(req, a.token)
|
||||
|
||||
if !*data.Result.IsSuccess {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(*data.Result.ReturnMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("进入AgreeUserCancel := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("进入AgreeUserCancel := %s", utils.Format4Output(data, false))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DisAgreeUserCancel 拒绝用户售后申请
|
||||
func (a *API) DisAgreeUserCancel(req *request2.AlibabaTclsAelophyRefundDisagreeRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 DisAgreeUserCancel : %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入 DisAgreeUserCancel : %s", utils.Format4Output(req, false))
|
||||
client := ability3156.NewAbility3156(&a.client)
|
||||
|
||||
data, _ := client.AlibabaTclsAelophyRefundDisagree(req, a.token)
|
||||
|
||||
if !*data.Result.IsSuccess {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(*data.Result.ReturnMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("进入 DisAgreeUserCancel : %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("进入 DisAgreeUserCancel : %s", utils.Format4Output(data, false))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// PartialRefundReason 商户逆向取消订单数据渲染(获取订单商品列表已经取消原因:部分退款)
|
||||
func (a *API) PartialRefundReason(req *request2.AlibabaTclsAelophyRefundCsapplyrenderRequest) (*domain.AlibabaTclsAelophyRefundCsapplyrenderRefundCsApplyRenderResponseDto, error) {
|
||||
globals.SugarLogger.Debugf("进入 PartialRefundReason: %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入 PartialRefundReason: %s", utils.Format4Output(req, false))
|
||||
client := ability3156.NewAbility3156(&a.client)
|
||||
|
||||
data, _ := client.AlibabaTclsAelophyRefundCsapplyrender(req, a.token)
|
||||
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return nil, fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("PartialRefundReason := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("PartialRefundReason := %s", utils.Format4Output(data, false))
|
||||
|
||||
return data.ApiResult.Model, nil
|
||||
}
|
||||
|
||||
// PartialRefund 商户逆向取消订单
|
||||
func (a *API) PartialRefund(req *request2.AlibabaTclsAelophyRefundCsapplyNewRequest) error {
|
||||
globals.SugarLogger.Debugf("PartialRefund := %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("PartialRefund := %s", utils.Format4Output(req, false))
|
||||
client := ability3156.NewAbility3156(&a.client)
|
||||
|
||||
data, _ := client.AlibabaTclsAelophyRefundCsapplyNew(req, a.token)
|
||||
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("PartialRefund := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("PartialRefund := %s", utils.Format4Output(data, false))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// UserApplyRefund 用户申请售后单消息通知
|
||||
func (a *API) UserApplyRefund(c *http.Request) (*UserApplyRefundCallBack, string, error) {
|
||||
globals.SugarLogger.Debugf("进入 UserApplyRefund")
|
||||
//globals.SugarLogger.Debugf("进入 UserApplyRefund")
|
||||
data, err := ioutil.ReadAll(c.Body)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
@@ -101,7 +101,7 @@ func (a *API) UserApplyRefund(c *http.Request) (*UserApplyRefundCallBack, string
|
||||
|
||||
// UserCancelRefundApply 用户取消售后申请
|
||||
func (a *API) UserCancelRefundApply(c *http.Request) (*UserCancelRefundApply, string, error) {
|
||||
globals.SugarLogger.Debugf("进入 UserCancelRefundApply")
|
||||
//globals.SugarLogger.Debugf("进入 UserCancelRefundApply")
|
||||
data, err := ioutil.ReadAll(c.Body)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
@@ -119,7 +119,7 @@ func (a *API) UserCancelRefundApply(c *http.Request) (*UserCancelRefundApply, st
|
||||
|
||||
// OnSaleRefundOrder 用户售中取消
|
||||
func (a *API) OnSaleRefundOrder(c *http.Request) (*OnSaleCancel, string, error) {
|
||||
globals.SugarLogger.Debugf("进入 OnSaleRefundOrder")
|
||||
//globals.SugarLogger.Debugf("进入 OnSaleRefundOrder")
|
||||
body, _ := ioutil.ReadAll(c.Body)
|
||||
|
||||
if len(body) == 0 {
|
||||
@@ -134,7 +134,7 @@ func (a *API) OnSaleRefundOrder(c *http.Request) (*OnSaleCancel, string, error)
|
||||
|
||||
// RefundOrderFinish 同城零售逆向订单状态完成接口(退款完成)
|
||||
func (a *API) RefundOrderFinish(c *http.Request) (*RefundOrderFinish, string, error) {
|
||||
globals.SugarLogger.Debugf("进入 RefundOrderFinish")
|
||||
//globals.SugarLogger.Debugf("进入 RefundOrderFinish")
|
||||
data, err := ioutil.ReadAll(c.Body)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
@@ -152,29 +152,29 @@ func (a *API) RefundOrderFinish(c *http.Request) (*RefundOrderFinish, string, er
|
||||
|
||||
// QueryAfsOrderDetail 获取订单退款详情
|
||||
func (a *API) QueryAfsOrderDetail(req *request591.AlibabaWdkOrderRefundGetRequest) (*domain591.AlibabaWdkOrderRefundGetOrderSyncRefundListResult, error) {
|
||||
globals.SugarLogger.Debugf("进入 QueryAfsOrderDetail : %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入 QueryAfsOrderDetail : %s", utils.Format4Output(req, false))
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkOrderRefundGet(req, a.token)
|
||||
|
||||
if !*data.Result.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return nil, fmt.Errorf(*data.Result.ReturnMsg)
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debugf("QueryAfsOrderDetail := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("QueryAfsOrderDetail := %s", utils.Format4Output(data, false))
|
||||
return &data.Result, nil
|
||||
}
|
||||
|
||||
// QueryAfsOrderDetailList 批量获取订单退款详情
|
||||
func (a *API) QueryAfsOrderDetailList(req *request591.AlibabaWdkOrderRefundListRequest) (*domain591.AlibabaWdkOrderRefundListOrderSyncRefundListResult, error) {
|
||||
globals.SugarLogger.Debugf("进入 QueryAfsOrderDetailList")
|
||||
//globals.SugarLogger.Debugf("进入 QueryAfsOrderDetailList")
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkOrderRefundList(req, a.token)
|
||||
|
||||
if !*data.Result.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return nil, fmt.Errorf(*data.Result.ReturnMsg)
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ func (a *API) QueryAfsOrderDetailList(req *request591.AlibabaWdkOrderRefundListR
|
||||
|
||||
// GetTransactionOrderListByTime 获取门店当天订单
|
||||
func (a *API) GetTransactionOrderListByTime(storeId string, queryData time.Time) ([]string, error) {
|
||||
globals.SugarLogger.Debugf("进入 GetTransactionOrderListByTime")
|
||||
//globals.SugarLogger.Debugf("进入 GetTransactionOrderListByTime")
|
||||
createTime := util.LocalTime(time.Date(queryData.Year(), queryData.Month(), queryData.Day(), 0, 0, 0, 0, queryData.Location()))
|
||||
endTime := util.LocalTime(time.Date(queryData.Year(), queryData.Month(), queryData.Day(), 23, 59, 59, 59, queryData.Location()))
|
||||
var pageIndex int64 = 1
|
||||
@@ -224,7 +224,7 @@ func (a *API) GetTransactionOrderListByTime(storeId string, queryData time.Time)
|
||||
|
||||
// GetTransactionOrderList 实时拉取交易列表
|
||||
func (a *API) GetTransactionOrderList(req *request591.AlibabaWdkOrderListRequest) (*domain591.AlibabaWdkOrderListResult, error) {
|
||||
globals.SugarLogger.Debugf("进入 GetTransactionOrderList")
|
||||
//globals.SugarLogger.Debugf("进入 GetTransactionOrderList")
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkOrderList(req, a.token)
|
||||
@@ -238,7 +238,7 @@ func (a *API) GetTransactionOrderList(req *request591.AlibabaWdkOrderListRequest
|
||||
|
||||
// QueryBillList 获取账单信息
|
||||
func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain591.AlibabaWdkBillListTxdBillListGetResult, error) {
|
||||
globals.SugarLogger.Debugf("进入 QueryBillList")
|
||||
//globals.SugarLogger.Debugf("进入 QueryBillList")
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkBillList(req, a.token)
|
||||
@@ -247,6 +247,10 @@ func (a *API) QueryBillList(req *request591.AlibabaWdkBillListRequest) (*domain5
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return nil, fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
kk := *data.ApiResult.Model
|
||||
for _, v := range *kk.TxdBillDetailBOS {
|
||||
globals.SugarLogger.Debugf("kk := %s -- %s == %s", utils.Format4Output(v.BizOrderId, false), *v.OrderType, *v.ReceivableAmount)
|
||||
}
|
||||
|
||||
return data.ApiResult.Model, nil
|
||||
}
|
||||
|
||||
@@ -6,8 +6,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/domain"
|
||||
request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability591/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
)
|
||||
@@ -29,12 +27,12 @@ func (a *API) ReaderOrderInfo(c *http.Request) (*CallbackOrder, string, error) {
|
||||
|
||||
// QueryOrderDetail 自配送查询订单详情
|
||||
func (a *API) QueryOrderDetail(req *request2.AlibabaAelophyOrderGetRequest) (*domain.AlibabaAelophyOrderGetOrderResponse, error) {
|
||||
globals.SugarLogger.Debugf("进入 QueryOrderDetail")
|
||||
//globals.SugarLogger.Debugf("进入 QueryOrderDetail")
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
data, _ := client.AlibabaAelophyOrderGet(req, a.token)
|
||||
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return nil, fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
|
||||
@@ -44,46 +42,46 @@ func (a *API) QueryOrderDetail(req *request2.AlibabaAelophyOrderGetRequest) (*do
|
||||
// DeliveryFinish 订单一下的没一个状态通知接口
|
||||
// ACCEPTED = 商户接单 REJECTED = 商户取消订单 PICKED = 拣货完成 PACKAGED = 打包出库 SHIPPING = 开始配送 SIGN = 用户签收 REFUSED = 用户拒收
|
||||
func (a *API) DeliveryFinish(req *request2.AlibabaAelophyOrderWorkCallbackRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 DeliveryFinish: %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入 DeliveryFinish: %s", utils.Format4Output(req, false))
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
globals.SugarLogger.Debugf("param := %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("param := %s", utils.Format4Output(req, false))
|
||||
data, _ := client.AlibabaAelophyOrderWorkCallback(req, a.token)
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeliveryTrajectory 自配送轨迹回传(骑手开始配送之后同步订单数据)
|
||||
func (a *API) DeliveryTrajectory(req *request2.AlibabaAelophyOrderLogisticsTraceCallbackRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 DeliveryTrajectory : %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入 DeliveryTrajectory : %s", utils.Format4Output(req, false))
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
data, _ := client.AlibabaAelophyOrderLogisticsTraceCallback(req, a.token)
|
||||
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("进入 DeliveryTrajectory : %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("进入 DeliveryTrajectory : %s", utils.Format4Output(data, false))
|
||||
return nil
|
||||
}
|
||||
|
||||
// DelivererChange 骑手信息变化时传入
|
||||
func (a *API) DelivererChange(req *request2.AlibabaAelophyOrderDelivererChangeRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 DelivererChange : %s", utils.Format4Output(req, false))
|
||||
//globals.SugarLogger.Debugf("进入 DelivererChange : %s", utils.Format4Output(req, false))
|
||||
client := ability591.NewAbility591(&a.client)
|
||||
|
||||
data, _ := client.AlibabaAelophyOrderDelivererChange(req, a.token)
|
||||
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
globals.SugarLogger.Debugf("进入 DelivererChange : %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("进入 DelivererChange : %s", utils.Format4Output(data, false))
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -16,16 +16,18 @@ import (
|
||||
)
|
||||
|
||||
func TestName(t *testing.T) {
|
||||
|
||||
earliestTime := utils.Str2Time("2023-07-14 17:30:00").Unix()
|
||||
fmt.Println(earliestTime - time.Now().Unix())
|
||||
}
|
||||
func TestGetOrderDetail(t *testing.T) {
|
||||
requestParam := &request591.AlibabaAelophyOrderGetRequest{OrderGetRequest: &domain591.AlibabaAelophyOrderGetOrderGetRequest{
|
||||
StoreId: utils.String2Pointer("JX668594"),
|
||||
BizOrderId: utils.Int64ToPointer(5000900194372970922),
|
||||
BizOrderId: utils.Int64ToPointer(5000902065494700922),
|
||||
}}
|
||||
data, err := apiTao.QueryOrderDetail(requestParam)
|
||||
globals.SugarLogger.Debugf("data := %s", utils.Format4Output(data, false))
|
||||
globals.SugarLogger.Debugf("err := %s", utils.Format4Output(err, false))
|
||||
globals.SugarLogger.Debugf("errdatadatadata := %s", utils.Format4Output(utils.Str2Int(*data.StoreId), false))
|
||||
}
|
||||
|
||||
func TestPartialRefundReason(t *testing.T) {
|
||||
@@ -196,6 +198,27 @@ func TestDeliveryTrajectory(t *testing.T) {
|
||||
apiTao.DeliveryTrajectory(param)
|
||||
}
|
||||
|
||||
func TestS(t *testing.T) {
|
||||
fmt.Println(1 % 20)
|
||||
func TestQueryBillList(t *testing.T) {
|
||||
queryData := time.Now()
|
||||
create := time.Date(queryData.Year(), queryData.Month(), queryData.Day()-7, 0, 0, 0, 0, queryData.Location())
|
||||
end := time.Date(queryData.Year(), queryData.Month(), queryData.Day(), 23, 59, 59, 59, queryData.Location())
|
||||
createTime := util.LocalTime(create)
|
||||
endTime := util.LocalTime(end)
|
||||
param := &request591.AlibabaWdkBillListRequest{
|
||||
TxdBillListGetRequest: &domain591.AlibabaWdkBillListTxdBillListGetRequest{
|
||||
EndBillDate: &endTime,
|
||||
StartBillDate: &createTime,
|
||||
ShopCode: utils.String2Pointer("JX668594"),
|
||||
PageSize: utils.Int64ToPointer(200),
|
||||
PageIndex: utils.Int64ToPointer(1),
|
||||
},
|
||||
}
|
||||
|
||||
data, err := apiTao.QueryBillList(param)
|
||||
if err != nil {
|
||||
fmt.Println("err === ", err)
|
||||
return
|
||||
}
|
||||
|
||||
globals.SugarLogger.Debugf("data:= %s", utils.Format4Output(data, false))
|
||||
}
|
||||
|
||||
@@ -326,7 +326,6 @@ func (ability *Ability2770) AlibabaRetailMarketingItemdiscountActivityCreate(req
|
||||
if ability.Client == nil {
|
||||
return nil, errors.New("Ability2770 topClient is nil")
|
||||
}
|
||||
globals.SugarLogger.Debugf("ActivityCreate req=%s", utils.Format4Output(&req, false))
|
||||
var jsonStr, err = ability.Client.ExecuteWithSession("alibaba.retail.marketing.itemdiscount.activity.create", req.ToMap(), req.ToFileMap(), session)
|
||||
var respStruct = response.AlibabaRetailMarketingItemdiscountActivityCreateResponse{}
|
||||
if err != nil {
|
||||
@@ -348,7 +347,6 @@ func (ability *Ability2770) AlibabaRetailMarketingItemdiscountActivityUpdate(req
|
||||
if ability.Client == nil {
|
||||
return nil, errors.New("Ability2770 topClient is nil")
|
||||
}
|
||||
globals.SugarLogger.Debugf("ActivityUpdate req=%s", utils.Format4Output(&req, false))
|
||||
var jsonStr, err = ability.Client.ExecuteWithSession("alibaba.retail.marketing.itemdiscount.activity.update", req.ToMap(), req.ToFileMap(), session)
|
||||
var respStruct = response.AlibabaRetailMarketingItemdiscountActivityUpdateResponse{}
|
||||
if err != nil {
|
||||
|
||||
@@ -106,7 +106,6 @@ func (ability *Ability3156) AlibabaAelophyShopUpdatestatus(req *request2.Alibaba
|
||||
if ability.Client == nil {
|
||||
return nil, errors.New("Ability3156 topClient is nil")
|
||||
}
|
||||
globals.SugarLogger.Debugf("ShopUpdatestatus req=%s", utils.Format4Output(&req, false))
|
||||
var jsonStr, err = ability.Client.ExecuteWithSession("alibaba.aelophy.shop.updatestatus", req.ToMap(), req.ToFileMap(), session)
|
||||
var respStruct = response2.AlibabaAelophyShopUpdatestatusResponse{}
|
||||
if err != nil {
|
||||
@@ -128,7 +127,6 @@ func (ability *Ability3156) AlibabaAelophyShopUpdateinfo(req *request2.AlibabaAe
|
||||
if ability.Client == nil {
|
||||
return nil, errors.New("Ability3156 topClient is nil")
|
||||
}
|
||||
globals.SugarLogger.Debugf("ShopUpdateinfo req=%s", utils.Format4Output(&req, false))
|
||||
var jsonStr, err = ability.Client.ExecuteWithSession("alibaba.aelophy.shop.updateinfo", req.ToMap(), req.ToFileMap(), session)
|
||||
var respStruct = response2.AlibabaAelophyShopUpdateinfoResponse{}
|
||||
if err != nil {
|
||||
@@ -150,7 +148,6 @@ func (ability *Ability3156) AlibabaAelophyShopUpdaterange(req *request2.AlibabaA
|
||||
if ability.Client == nil {
|
||||
return nil, errors.New("Ability3156 topClient is nil")
|
||||
}
|
||||
globals.SugarLogger.Debugf("ShopUpdaterange req=%s", utils.Format4Output(&req, false))
|
||||
var jsonStr, err = ability.Client.ExecuteWithSession("alibaba.aelophy.shop.updaterange", req.ToMap(), req.ToFileMap(), session)
|
||||
var respStruct = response2.AlibabaAelophyShopUpdaterangeResponse{}
|
||||
if err != nil {
|
||||
|
||||
@@ -42,7 +42,7 @@ type AlibabaWdkBillListTxdBillDetailBo struct {
|
||||
BizOrderId *string `json:"biz_order_id,omitempty" `
|
||||
|
||||
/*
|
||||
单据类型(正/逆向) */
|
||||
单据类型(正/逆向) positive 有效订单/negative取消订单 */
|
||||
OrderType *string `json:"order_type,omitempty" `
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,18 +2,15 @@ package tao_vegetable
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// GetStoreAllCategory 获取门店所有分类
|
||||
func (a *API) GetStoreAllCategory() ([]*CategoryInfo, error) {
|
||||
globals.SugarLogger.Debugf("进入 GetStoreAllCategory")
|
||||
//globals.SugarLogger.Debugf("进入 GetStoreAllCategory")
|
||||
// 获取所有的父分类
|
||||
parent, err := a.GetStoreCategoryInfo("")
|
||||
if err != nil {
|
||||
@@ -44,7 +41,7 @@ func (a *API) GetStoreAllCategory() ([]*CategoryInfo, error) {
|
||||
|
||||
// GetStoreCategoryInfo 获取门店指定分类
|
||||
func (a *API) GetStoreCategoryInfo(code string) (*CategoryInfo, error) {
|
||||
globals.SugarLogger.Debugf("进入 GetStoreCategoryInfo")
|
||||
//globals.SugarLogger.Debugf("进入 GetStoreCategoryInfo")
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, _ := storeCategory.AlibabaWdkSkuCategoryQuery(&request.AlibabaWdkSkuCategoryQueryRequest{Param: &domain.AlibabaWdkSkuCategoryQueryCategoryDo{Code: &code}}, a.token)
|
||||
|
||||
@@ -61,18 +58,18 @@ func (a *API) GetStoreCategoryInfo(code string) (*CategoryInfo, error) {
|
||||
|
||||
// AddStoreCategoryInfo 添加门店分类
|
||||
func (a *API) AddStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryAddRequest) (string, error) {
|
||||
globals.SugarLogger.Debugf("进入 AddStoreCategoryInfo := %s", utils.Format4Output(param, false))
|
||||
//globals.SugarLogger.Debugf("进入 AddStoreCategoryInfo := %s", utils.Format4Output(param, false))
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, err := storeCategory.AlibabaWdkSkuCategoryAdd(param, a.token)
|
||||
globals.SugarLogger.Debugf("进入 AddStoreCategoryInfo : %s,%v", utils.Format4Output(resp, false), err)
|
||||
resp, _ := storeCategory.AlibabaWdkSkuCategoryAdd(param, a.token)
|
||||
//globals.SugarLogger.Debugf("进入 AddStoreCategoryInfo : %s,%v", utils.Format4Output(resp, false), err)
|
||||
|
||||
return *resp.Result.Model, nil
|
||||
}
|
||||
|
||||
// DeleteStoreCategoryInfo 删除门店分类
|
||||
func (a *API) DeleteStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryDeleteRequest) error {
|
||||
//return nil // 不支持程序删除
|
||||
globals.SugarLogger.Debugf("进入 DeleteStoreCategoryInfo")
|
||||
return nil // 不支持程序删除
|
||||
//globals.SugarLogger.Debugf("进入 DeleteStoreCategoryInfo")
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, _ := storeCategory.AlibabaWdkSkuCategoryDelete(param, a.token)
|
||||
|
||||
@@ -85,7 +82,7 @@ func (a *API) DeleteStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryDelete
|
||||
|
||||
// UpdateStoreCategoryInfo 修改门店分类
|
||||
func (a *API) UpdateStoreCategoryInfo(param *request.AlibabaWdkSkuCategoryUpdateRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 UpdateStoreCategoryInfo")
|
||||
//globals.SugarLogger.Debugf("进入 UpdateStoreCategoryInfo")
|
||||
storeCategory := ability587.NewAbility587(&a.client)
|
||||
resp, _ := storeCategory.AlibabaWdkSkuCategoryUpdate(param, a.token)
|
||||
|
||||
|
||||
@@ -5,13 +5,10 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability585/request"
|
||||
request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request"
|
||||
request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587"
|
||||
request2 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability587/request"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589"
|
||||
request589 "git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability589/request"
|
||||
)
|
||||
|
||||
// AddStoreSku 新增门店商品
|
||||
@@ -19,7 +16,7 @@ func (a *API) AddStoreSku(param *request.AlibabaWdkSkuAddRequest) (*[]VegetableR
|
||||
client := ability585.NewAbility585(&a.client)
|
||||
data, _ := client.AlibabaWdkSkuAdd(param, a.token)
|
||||
if !*data.Result.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return nil, fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
@@ -45,20 +42,18 @@ func (a *API) AddStoreSku(param *request.AlibabaWdkSkuAddRequest) (*[]VegetableR
|
||||
}
|
||||
|
||||
}
|
||||
globals.SugarLogger.Debugf("========addSuk := %s", utils.Format4Output(foodList, false))
|
||||
|
||||
return &foodList, nil
|
||||
}
|
||||
|
||||
// UpdateStoreSku 更新门店商品
|
||||
func (a *API) UpdateStoreSku(param *request.AlibabaWdkSkuUpdateRequest) (*[]VegetableResultList, error) {
|
||||
globals.SugarLogger.Debugf("进入 UpdateStoreSku: %s", utils.Format4Output(param, false))
|
||||
client := ability585.NewAbility585(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkSkuUpdate(param, a.token)
|
||||
globals.SugarLogger.Debugf("UpdateStoreSku := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("UpdateStoreSku := %s", utils.Format4Output(data, false))
|
||||
if !*data.Result.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return nil, fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
@@ -79,13 +74,13 @@ func (a *API) UpdateStoreSku(param *request.AlibabaWdkSkuUpdateRequest) (*[]Vege
|
||||
|
||||
// QueryStoreSKu 查询门店商品
|
||||
func (a *API) QueryStoreSKu(param *request.AlibabaWdkSkuQueryRequest) (*[]domain.AlibabaWdkSkuQueryApiResult, error) {
|
||||
globals.SugarLogger.Debugf("进入 QueryStoreSKu")
|
||||
//globals.SugarLogger.Debugf("进入 QueryStoreSKu")
|
||||
client := ability585.NewAbility585(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkSkuQuery(param, a.token)
|
||||
|
||||
if !*data.Result.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return nil, fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
@@ -99,13 +94,13 @@ func (a *API) DeleteStoreSku() {
|
||||
|
||||
// StoreSkuUpdateOffShelf 门店商品上下架
|
||||
func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUpdateRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 StoreSkuUpdateOffShelf")
|
||||
//globals.SugarLogger.Debugf("进入 StoreSkuUpdateOffShelf")
|
||||
client := ability587.NewAbility587(&a.client)
|
||||
|
||||
data, _ := client.AlibabaAxChannelSkuStatusUpdate(param, a.token)
|
||||
|
||||
if !*data.ApiResult.Success {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.ApiResult, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.ApiResult, false))
|
||||
return fmt.Errorf(*data.ApiResult.ErrMsg)
|
||||
}
|
||||
|
||||
@@ -114,13 +109,13 @@ func (a *API) StoreSkuUpdateOffShelf(param *request2.AlibabaAxChannelSkuStatusUp
|
||||
|
||||
// StoreSkuStock 商品库存同步
|
||||
func (a *API) StoreSkuStock(param *request589.AlibabaWdkStockPublishRequest) error {
|
||||
globals.SugarLogger.Debugf("进入 StoreSkuStock")
|
||||
//globals.SugarLogger.Debugf("进入 StoreSkuStock")
|
||||
client := ability589.NewAbility589(&a.client)
|
||||
|
||||
data, _ := client.AlibabaWdkStockPublish(param)
|
||||
globals.SugarLogger.Debugf("StoreSkuStock err := %s", utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("StoreSkuStock err := %s", utils.Format4Output(data, false))
|
||||
if !data.IsSuccess {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data, false))
|
||||
return fmt.Errorf(data.Message)
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import (
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/domain"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability2770/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// ActCreateReq 1 活动详情
|
||||
@@ -21,18 +20,18 @@ type SkuChannelConfigs = domain.AlibabaRetailMarketingItemdiscountActivitySkuAdd
|
||||
// ActivityCreate 创建单品特价活动【同城零售】 1-1
|
||||
func (a *API) ActivityCreate(param domain.AlibabaRetailMarketingItemdiscountActivityCreateItemDiscountActivityOperateRequest) (actID int64, err error) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
globals.SugarLogger.Debugf("ActivityCreate req=%s", utils.Format4Output(param, false))
|
||||
//globals.SugarLogger.Debugf("ActivityCreate req=%s", utils.Format4Output(param, false))
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivityCreate(&request.AlibabaRetailMarketingItemdiscountActivityCreateRequest{
|
||||
Param: ¶m,
|
||||
}, a.token)
|
||||
globals.SugarLogger.Debugf("ActivityCreate:resp %s", utils.Format4Output(&resp, false))
|
||||
//globals.SugarLogger.Debugf("ActivityCreate:resp %s", utils.Format4Output(&resp, false))
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if resp.Result.ErrorMessage != nil {
|
||||
return 0, fmt.Errorf("ActivityCreate:requestId:" + resp.RequestId + "msg:" + *resp.Result.ErrorMessage)
|
||||
}
|
||||
globals.SugarLogger.Debugf("ActivityCreate actID=%d", utils.Pointer2Int64(resp.Result.Data))
|
||||
//globals.SugarLogger.Debugf("ActivityCreate actID=%d", utils.Pointer2Int64(resp.Result.Data))
|
||||
return utils.Pointer2Int64(resp.Result.Data), nil
|
||||
}
|
||||
|
||||
@@ -44,11 +43,11 @@ type skuAct struct {
|
||||
// ActivitySkuCreate 特价活动新增商品 1-2
|
||||
func (a *API) ActivitySkuCreate(param domain.AlibabaRetailMarketingItemdiscountActivitySkuAddItemDiscountActivityElementOperateRequest) (error, *skuAct, []string) {
|
||||
act := ability2770.NewAbility2770(&a.client)
|
||||
globals.SugarLogger.Debugf("ActivitySkuCreate req=%s", utils.Format4Output(param, false))
|
||||
//globals.SugarLogger.Debugf("ActivitySkuCreate req=%s", utils.Format4Output(param, false))
|
||||
resp, err := act.AlibabaRetailMarketingItemdiscountActivitySkuAdd(&request.AlibabaRetailMarketingItemdiscountActivitySkuAddRequest{
|
||||
Param: ¶m,
|
||||
}, a.token)
|
||||
globals.SugarLogger.Debugf("ActivitySkuCreate:resp %s", utils.Format4Output(&resp, false))
|
||||
//globals.SugarLogger.Debugf("ActivitySkuCreate:resp %s", utils.Format4Output(&resp, false))
|
||||
if err != nil {
|
||||
return err, nil, *resp.Result.FailedSkuCodes
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability1475"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tao_vegetable/sdk/ability1475/request"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// UploadImg 上传图片
|
||||
@@ -14,7 +12,7 @@ func (a *API) UploadImg(param *request.AlibabaWdkPictureUploadRequest) (string,
|
||||
|
||||
data, _ := client.AlibabaWdkPictureUpload(param, a.token)
|
||||
if data.Result.ErrCode != nil {
|
||||
globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
//globals.SugarLogger.Debugf("requestId[%s],err[%s]", data.RequestId, utils.Format4Output(data.Result, false))
|
||||
return "", fmt.Errorf(*data.Result.ErrMsg)
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ func TestAddOrder(t *testing.T) {
|
||||
|
||||
//获取订单详情
|
||||
func TestGetOrderDetail(t *testing.T) {
|
||||
detail, err := api.GetOrderDetail("23022310041019000003804258")
|
||||
detail, err := api.GetOrderDetail("23071316101004700004743106")
|
||||
fmt.Println(utils.Format4Output(detail, false))
|
||||
orderPrice := utils.Str2Float64(detail.OrderPrice)
|
||||
priceOff := utils.Str2Float64(detail.PriceOff)
|
||||
|
||||
Reference in New Issue
Block a user