This commit is contained in:
邹宗楠
2024-01-16 16:24:32 +08:00
parent 2fd23aff1f
commit 2182c1ce93
7 changed files with 61 additions and 57 deletions

File diff suppressed because one or more lines are too long

View File

@@ -29,9 +29,9 @@ func init() {
// 天天果园
//api = New("c45e6510-00ba-4be2-977e-bcb9c9792cc7", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
// 京东果园 320406
api = New("c454ef86-2213-4860-9a31-f2ef7e883386", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4")
// 果切
//api = New("3ef42248-1247-4efa-8624-43cd3a3b97ae", "5d5577a2506f41b8b4ec520ba83490f5", "0b01b9eeb15b41dab1c3d05d95c17a26")
//api = New("c454ef86-2213-4860-9a31-f2ef7e883386", "1dba76d40cac446ca500c0391a0b6c9d", "a88d031a1e7b462cb1579f12e97fe7f4")
// 果切 379599
api = New("ad4061a1-6a5c-43f9-bf51-b1232fd9499d", "f2ed33075faf4773a47e065acd79532b", "aed14cbbecac4456843570e90c5f46ec")
// 京东超市 359459
//api = New("21ff22c5-0716-4c05-9468-8e4dde2b1cd6", "21b627c23ea04c69b64b48d0b361213e", "51cd27a748e64c829b4b7f83f4844610")

File diff suppressed because one or more lines are too long

View File

@@ -3,8 +3,6 @@ package tiktok_api
import (
"fmt"
order_getSettleBillDetailV3_request "git.rosy.net.cn/baseapi/platformapi/tiktok_shop/sdk-golang/api/order_getSettleBillDetailV3/request"
"io/ioutil"
"net/http"
"strings"
"testing"
)
@@ -31,26 +29,6 @@ func TestBillDetail(t *testing.T) {
}
func TestLen(t *testing.T) {
url := "https://www.jxc4.com/v2/store/sku/UpdateStoresSkus"
param := ``
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeIDs\"\r\n\r\n[" + param + "]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n[{\"nameID\":8461,\"unitPrice\":2600},{\"nameID\":9325,\"unitPrice\":1800},{\"nameID\":15045,\"unitPrice\":500},{\"nameID\":15026,\"unitPrice\":450},{\"nameID\":15007,\"unitPrice\":220},{\"nameID\":15019,\"unitPrice\":700},{\"nameID\":8075561,\"unitPrice\":350},{\"nameID\":10247,\"unitPrice\":600},{\"nameID\":15055,\"unitPrice\":900},{\"nameID\":11044,\"unitPrice\":580},{\"nameID\":15021,\"unitPrice\":300},{\"nameID\":15042,\"unitPrice\":650},{\"nameID\":11479,\"unitPrice\":2600},{\"nameID\":8779,\"unitPrice\":1200},{\"nameID\":15066,\"unitPrice\":700},{\"nameID\":8077377,\"unitPrice\":2200},{\"nameID\":14984,\"unitPrice\":800},{\"nameID\":14993,\"unitPrice\":500},{\"nameID\":15095,\"unitPrice\":750},{\"nameID\":9105,\"unitPrice\":1100},{\"nameID\":15005,\"unitPrice\":300},{\"nameID\":15107,\"unitPrice\":500},{\"nameID\":15029,\"unitPrice\":520},{\"nameID\":15027,\"unitPrice\":1100}]\n\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"causeFlag\"\r\n\r\n16\r\n-----011000010111000001101001--\r\n\r\n")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("token", "TOKEN.V2.2452A93EEB9111EC9B06525400E86DC0.20231208-110713.localpass.E252DAB0957611EE96A5525400E86DC0.[18981810340]")
req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
func TestName(t *testing.T) {
a := 1
a = a | 1

View File

@@ -99,7 +99,7 @@ func TestGetOrderDetail(t *testing.T) {
//取消订单
func TestCancelOrder(t *testing.T) {
err := api.CancelOrder("23013118111004700001004861", "测试取消")
err := api.CancelOrder("24011415121024100001986825", "测试取消")
fmt.Println(err)
}

View File

@@ -237,12 +237,18 @@ func (a *API) GetPrintStatusWithToken(machineCode, token string) (state int, err
return a.getPrintStatus(machineCode, token)
}
func (a *API) GetPrinterToken(machineCode, qrKey string) (tokenInfo *TokenInfo, err error) {
result, err := a.AccessAPI(scanCodemodelApiPath, map[string]interface{}{
func (a *API) GetPrinterToken(machineCode, qrKey, msign string) (tokenInfo *TokenInfo, err error) {
parameter := map[string]interface{}{
"machine_code": machineCode,
"qr_key": qrKey,
"scope": "all",
}, "")
}
if qrKey != "" {
parameter["qr_key"] = qrKey
} else if msign != "" {
parameter["msign"] = msign
}
result, err := a.AccessAPI(scanCodemodelApiPath, parameter, "")
if err == nil {
err = utils.Map2StructByJson(result, &tokenInfo, false)
}

View File

@@ -1,7 +1,9 @@
package yilianyunapi
import (
"fmt"
"testing"
"time"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
@@ -20,11 +22,11 @@ func init() {
baseapi.Init(sugarLogger)
// 自有应用
api = New("1039586024", "4885d07c2997b661102e4b6099c0bf3b")
api.SetToken("07e5895c70114395a285ae20119d83b1")
//api = New("1039586024", "4885d07c2997b661102e4b6099c0bf3b")
//api.SetToken("283f27f7dfbe4379b2db9b8f11e61b9c")
// 开放应用
//api = New("1098307169", "d5eedb40c99e6691b1ca2ba82a363d6a")
api = New("1098307169", "d5eedb40c99e6691b1ca2ba82a363d6a")
}
func handleError(t *testing.T, err error) {
@@ -54,13 +56,14 @@ func TestDeletePrinter(t *testing.T) {
func TestPrintMsg(t *testing.T) {
// 4004606481
err := api.PrintMsg("4004615546", utils.GetUUID(), "<FS2>饿百取货码</FS2>")
err := api.PrintMsg("4004797135", utils.GetUUID(), "<FS2>饿百取货码</FS2>")
handleError(t, err)
}
func TestPrintMsgWithToken(t *testing.T) {
// 4004606481
err := api.PrintMsgWithToken("4004600675", utils.GetUUID(), "<FS2>饿百取货码</FS2>", "b1a36aa8de5647d2b08af49db11a9c9d")
//err := api.PrintMsgWithToken("4004555254", utils.GetUUID(), "<FS2>饿百取货码</FS2>", "0a8255eeb42445f7b8db42b1fc60ce87")
err := api.PrintMsgWithToken("4004797135", utils.GetUUID(), "<FS2>饿百取货码</FS2>", "179770218366")
handleError(t, err)
}
@@ -77,7 +80,7 @@ func TestGetPrintStatusWithToken(t *testing.T) {
}
func TestGetPrinterToken(t *testing.T) {
TokenInfo, err := api.GetPrinterToken("1039586024", "4885d07c2997b661102e4b6099c0bf3b")
TokenInfo, err := api.GetPrinterToken("4004797135", "179770218366", "")
handleError(t, err)
baseapi.SugarLogger.Debug(TokenInfo)
}
@@ -104,6 +107,10 @@ func TestGetOrderPagingList(t *testing.T) {
t.Log(utils.Format4Output(result, true))
}
func TestName(t *testing.T) {
fmt.Println(time.Now().Add(time.Duration(2592000) * time.Second).Unix())
}
func TestSetSound(t *testing.T) {
err := api.SetSound("4004617180", "2")
handleError(t, err)