Files
baseapi/platformapi/mtwmapi/order_test.go
邹宗楠 21697cb84c 1
2023-08-24 15:50:58 +08:00

253 lines
5.6 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package mtwmapi
import (
"fmt"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/globals"
"strings"
"testing"
"time"
"unicode"
)
func TestOrderViewStatus(t *testing.T) {
result, err := api.OrderViewStatus(123)
if err != nil {
t.Fatal(err)
}
t.Log(result)
}
func TestOrderGetOrderDetail(t *testing.T) {
result, err := api.OrderGetOrderDetail(1100692033635137950, false)
if err != nil {
t.Fatal(err)
}
globals.SugarLogger.Debugf("====%s", utils.Format4Output(result["poi_receive_detail_yuan"], false))
if len(result) == 0 {
t.Fatal("result should have value")
}
for k, v := range result {
fmt.Println(fmt.Sprintf("%s=%v", k, v))
}
//globals.SugarLogger.Debugf("%s", utils.Format4Output(result, false))
}
func TestOrderGetOrderDetail2(t *testing.T) {
result, err := api.OrderGetOrderDetail2(1100687990339131759, false)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestOrderGetPartRefundFoods(t *testing.T) {
result, err := api.OrderGetPartRefundFoods(93475541926981203)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestOrderReceived(t *testing.T) {
err := api.OrderReceived(25236872740350976)
if err != nil {
t.Fatal(err)
}
}
func TestOrderConfirm(t *testing.T) {
err := api.OrderConfirm(27058923254735296)
if err != nil {
t.Fatal(err)
}
}
func TestOrderApplyPartRefund(t *testing.T) {
err := api.OrderApplyPartRefund(93495654059392270, "缺货", []*RefundSku{
&RefundSku{
AppFoodCode: "30831",
Count: 1,
},
})
if err != nil {
t.Fatal(err)
}
}
func TestOrderLogisticsStatus(t *testing.T) {
result, err := api.OrderLogisticsStatus(1100687990339131759)
if err != nil {
t.Fatal(err)
}
if result == 0 {
t.Fatal("result should have value")
}
t.Log(utils.Format4Output(result, false))
}
func TestOrderLogisticsFee(t *testing.T) {
result, err := api.OrderLogisticsFee(1000690713907180740)
if err != nil {
t.Fatal(err)
}
if result == 0 {
t.Fatal("result should have value")
}
t.Log(utils.Format4Output(result, false))
}
func TestOrderBatchPullPhoneNumber(t *testing.T) {
result, err := api.OrderBatchPullPhoneNumber("5873_2705892", 0, MaxBatchPullPhoneNumberLimit)
t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestOrderGetRiderInfoPhoneNumber(t *testing.T) {
result, err := api.OrderGetRiderInfoPhoneNumber("8872485", 0, MaxBatchPullPhoneNumberLimit)
t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestGetOrderRefundDetail(t *testing.T) {
result, err := api.GetOrderRefundDetail(70263190513673732, 0)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetOrderActDetaill(t *testing.T) {
result, err := api.GetOrderActDetail([]*GetOrderActDetailParam{
&GetOrderActDetailParam{
OrderID: 69760842061320598,
// ActParam: []*GetOrderActDetailParamAct{
// &GetOrderActDetailParamAct{
// Type: 1,
// },
// },
},
})
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetOrderIdByDaySeq(t *testing.T) {
result, err := api.GetOrderIdByDaySeq("8050205", utils.Str2Time("2021-02-21"), 1, MaxGap4GetOrderIdByDaySeq)
t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestGetOrderIdByDaySeqSingle(t *testing.T) {
result, err := api.GetOrderIdByDaySeqSingle("17284266", utils.Time2Date(time.Now()), 1)
t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestOrderRefundReject(t *testing.T) {
err := api.OrderRefundReject(27058923254735296, "测试")
// t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestOrderRefundAgree(t *testing.T) {
err := api.OrderRefundAgree(27058922456066076, "测试")
// t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestOrderCancel(t *testing.T) {
err := api.OrderCancel(27058922397679200, "取消", 1)
// t.Log(utils.Format4Output(result, false))
if err != nil {
t.Fatal(err)
}
}
func TestAa2(t *testing.T) {
time := time.Now().Unix()
fmt.Println(api.signParams(apiURL+"/oauth/authorize?", map[string]interface{}{
"timestamp": time,
"app_id": "5873",
"app_poi_code": "12422751",
"response_type": "token",
}), time)
}
func TestDeleving(t *testing.T) {
err := api.OrderLogisticsChange2Self(148815413321281654)
fmt.Println(strings.Contains(err.Error(), "1047"))
t.Fatal(err)
}
func TestOrderDelivering(t *testing.T) {
err := api.OrderDelivering(148815413321281654)
t.Fatal(err)
}
// 88 67 【组合菜】尖椒茄子茄子500g 青尖椒200g700g/组(茄子500g 青椒200g)
// 90 60
func TestLen(t *testing.T) {
aa := "【组合菜】尖椒茄子茄子500g 青尖椒200g700g/组(茄子500g 青椒200g)"
var count int // 中文
var punctZh int // 中文标点
var punctEn int // 英文标点
var punctAZ int // 字母
var punctNum int // 字母
var spance int // 空格
for _, v := range aa {
if unicode.Is(unicode.Han, v) { // 中文
count++
continue
}
if unicode.IsPunct(v) { // 字符
if v >= 1000 {
fmt.Println(v)
punctZh++
} else {
punctEn++
}
continue
}
if unicode.IsLetter(v) {
punctAZ++
continue
}
if unicode.IsNumber(v) {
punctNum++
continue
}
if unicode.IsSpace(v) {
spance++
continue
}
}
fmt.Println("count:= ", count)
fmt.Println("count:= ", punctZh)
fmt.Println("count:= ", punctEn)
fmt.Println("count:= ", punctAZ)
fmt.Println("count:= ", punctNum)
fmt.Println("all = ", (count*2)+(punctZh*2)+punctEn+punctAZ+punctNum+spance)
}
func TestName(t *testing.T) {
fmt.Println((10 & 2) != 0)
}