From 005bd0de6c366c0f754a0f40f901e110fc593276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Wed, 10 Jan 2024 09:27:26 +0800 Subject: [PATCH] 1 --- platformapi/jxprintapi/jxprintapi.go | 7 +-- platformapi/jxprintapi/jxprintapi_test.go | 46 +++++++++++++++---- .../tiktok_shop/tiktok_api/afs_test.go | 2 +- .../tiktok_api/settl_bill_detail_test.go | 4 +- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/platformapi/jxprintapi/jxprintapi.go b/platformapi/jxprintapi/jxprintapi.go index 10c58fc5..6b0042d7 100644 --- a/platformapi/jxprintapi/jxprintapi.go +++ b/platformapi/jxprintapi/jxprintapi.go @@ -12,8 +12,9 @@ import ( ) const ( - prodURL = "http://api.jxc4.com/openapi/CallOpenAPI" - signKey = "sign" + prodURL = "http://api.jxc4.com/openapi/CallOpenAPI" // 老版本的URL + prodURLNew = "http://print.jxcs.net/v2/openapi/CallOpenAPI" // 老版本的URL + signKey = "sign" ) const ( // ResponseCodeSuccess 操作成功 @@ -76,7 +77,7 @@ func (a *API) AccessAPI(apiName string, apiParams map[string]interface{}) (retVa params["timestamp"] = utils.Int64ToStr(time.Now().Unix()) sign := a.signParams(params) params[signKey] = sign - fullURL := prodURL + fullURL := prodURLNew request, _ := http.NewRequest(http.MethodPost, fullURL, strings.NewReader(utils.Map2URLValues(params).Encode())) request.Header.Set("charset", "UTF-8") request.Header.Set("Content-Type", "application/x-www-form-urlencoded") diff --git a/platformapi/jxprintapi/jxprintapi_test.go b/platformapi/jxprintapi/jxprintapi_test.go index 128c3e2f..85600bf4 100644 --- a/platformapi/jxprintapi/jxprintapi_test.go +++ b/platformapi/jxprintapi/jxprintapi_test.go @@ -3,7 +3,10 @@ package jxprintapi import ( "fmt" "git.rosy.net.cn/baseapi" + "git.rosy.net.cn/baseapi/utils" "go.uber.org/zap" + "net/http" + "strings" "testing" "time" ) @@ -13,6 +16,8 @@ var ( sugarLogger *zap.SugaredLogger ) +//120220915001594 + func init() { logger, _ := zap.NewDevelopment() sugarLogger = logger.Sugar() @@ -24,7 +29,7 @@ func init() { func TestAddPrinter(t *testing.T) { err := api.AddPrinter([]*AddPrinterParam{ &AddPrinterParam{ - PrintNo: "20210615000012", + PrintNo: "120220915001594", Name: "test1", }, }) @@ -35,7 +40,7 @@ func TestAddPrinter(t *testing.T) { } func TestDelPrinter(t *testing.T) { - err := api.DelPrinter([]string{"20210615000012"}, "") + err := api.DelPrinter([]string{"120220915001594"}, "") if err != nil { t.Fatalf("PrintMsg return error:%v", err) } @@ -44,7 +49,7 @@ func TestDelPrinter(t *testing.T) { func TestUpdatePrinter(t *testing.T) { err := api.UpdatePrinter(&UpdatePrinterParam{ - PrintNo: "20210615000011", + PrintNo: "120220915001594", }) if err != nil { t.Fatalf("PrintMsg return error:%v", err) @@ -53,7 +58,7 @@ func TestUpdatePrinter(t *testing.T) { } func TestDelPrinterSeq(t *testing.T) { - err := api.DelPrinterSeq("20210615000012") + err := api.DelPrinterSeq("120220915001594") if err != nil { t.Fatal(err) } @@ -61,7 +66,7 @@ func TestDelPrinterSeq(t *testing.T) { } func TestGetPrintMsg(t *testing.T) { - result, err := api.GetPrintMsg("20210715104649_F3Z2JXyj") + result, err := api.GetPrintMsg("120220915001594") if err != nil { t.Fatal(err) } @@ -69,7 +74,7 @@ func TestGetPrintMsg(t *testing.T) { } func TestGetPrinterStatus(t *testing.T) { - result, err := api.GetPrinterStatus("120220915001283") + result, err := api.GetPrinterStatus("120220915001594") if err != nil { t.Fatal(err) } @@ -78,7 +83,7 @@ func TestGetPrinterStatus(t *testing.T) { // 20210615000012 func TestDoPrint(t *testing.T) { - result, err := api.DoPrint("120220915001877", `{ + result, err := api.DoPrint("120220915001594", `{ "allSkuCount": "2", "allSkuTypeCount": "1", "appId": "1000", @@ -110,5 +115,30 @@ func TestDoPrint(t *testing.T) { } func Test222(t *testing.T) { - fmt.Println(time.Now().Minute()) + //url := `http://api.jxc4.com/openapi/CallOpenAPI` + +} + +func TestName23(t *testing.T) { + url := "https://www.jxc4.com/v2/store/sku/UpdateStoresSkus" + + var storeList = []int64{103191, 100501, 100517, 100524, 669154, 100525, 667119, 669155, 100529, 100543, 100546, 669307, 668188, 668552, 100549, 667131, 667134, 100654, 667135, 667145, 667150, 667154, 667156, 668600, 102968, 668833, 100741, 667166, 669163, 667171, 100754, 667173, 668992, 102974, 667175, 100767, 102976, 668726, 100782, 667184, 667194, 669170, 667200, 100837, 667201, 667202, 100853, 668574, 667210, 669240, 667211, 668401, 667212, 668138, 667215, 667216, 100922, 667219, 100935, 667220, 667221, 668907, 667230, 668916, 668564, 100982, 102919, 103030, 668815, 667236, 667239, 101031, 669010, 102982, 667252, 669206, 667255, 667261, 101088, 667262, 668778, 101097, 667264, 667553, 101107, 667270, 667271, 667272, 668670, 669195, 667279, 668554, 668422, 101687, 669029, 103093, 667290, 667291, 668569, 101732, 103113, 103116, 667300, 101754, 667301, 667995, 101755, 103135, 101780, 101842, 667306, 668055, 101896, 103160, 669104, 103161, 101902, 103164, 103132, 102108, 103165, 101942, 103168, 668793, 103170, 668602, 668935, 101960, 103177, 667324, 668812, 668787, 668813, 668824, 103181, 668825, 102012, 668831, 667333, 668662, 667336, 668716, 668837, 103190, 668750, 102047, 667340, 668755, 668756, 667355, 667356, 102089, 103361, 102150, 103414, 667386, 103416, 667388, 668643, 667389, 102181, 667395, 103454, 667400, 102241, 666672, 102255, 669208, 102262, 102267, 666718, 102275, 666729, 667431, 103154, 666735, 667433, 666739, 667435, 666744, 669156, 102307, 666747, 667466, 667508, 666760, 667469, 668033, 666761, 668754, 666770, 668765, 666771, 666774, 666775, 668832, 666776, 667498, 668639, 666779, 667513, 668836, 666785, 668039, 669279, 668863, 668290, 102417, 666787, 668864, 666788, 668865, 668896, 666792, 666795, 669067, 666798, 666803, 666821, 667482, 668808, 666844, 666846, 668841, 666855, 666856, 668858, 666862, 102599, 100280, 102613, 666869, 666870, 668830, 668871, 668883, 666872, 666875, 668594, 102670, 666876, 666885, 666887, 668829, 668572, 666889, 102704, 666898, 666900, 668792, 102709, 666906, 100022, 102711, 100024, 666908, 100041, 666912, 102723, 666913, 666916, 102656, 667225, 102735, 666920, 100118, 666922, 666929, 669185, 666940, 669188, 666945, 100140, 666948, 100141, 666950, 668555, 666952, 666954, 100150, 666955, 666962, 100162, 669178, 668636, 668556, 100184, 668557, 666973, 666974, 100204, 102792, 100210, 666977, 666984, 669194, 100224, 666988, 666990, 666995, 100267, 666996, 668693, 667003, 669157, 667010, 669165, 102852, 667014, 668796, 668990, 668852, 667018, 668417, 667019, 667027, 668558, 667028, 668559, 100329, 102882, 668311, 100334, 100351, 667051, 668807, 667056, 668802, 667071, 667099, 667073, 667075, 669073, 667083, 667084, 100458, 102926, 667096, 669059, 668567, 669236, 100477, 102928, 102929, 667110, 669227, 669134, 667444, 669041, 667120, 667121, 102935, 667122, 100548, 102937, 667125, 668725, 668719, 100600, 667130, 100601, 102952, 668191, 668580, 102953, 100658, 668617, 100664, 102955, 100670, 102956, 100681, 102958, 668781, 100699, 102962, 669086, 669084, 100712, 102963, 667157, 669115, 668541, 100714, 667158, 669112, 100720, 667159, 668549, 668646, 100743, 102971, 668718, 102973, 100766, 669043, 667182, 668893, 102978, 668889, 100802, 102980, 668668, 669056, 100829, 102981, 669111, 102985, 669119, 100840, 102991, 667208, 102992, 669105, 100881, 100883, 102995, 100887, 667214, 668429, 668943, 102997, 669013, 668938, 669201, 669202, 669197, 103003, 668614, 103004, 668983, 103009, 667229, 668632, 100946, 103018, 668967, 667231, 100987, 100988, 667235, 669144, 101000, 103031, 669131, 103032, 101012, 103033, 667242, 101013, 103035, 667243, 669064, 103036, 101032, 103037, 101036, 103048, 668623, 101062, 101078, 103055, 668681, 103062, 103069, 667266, 669081, 668686, 669007, 669046, 103075, 101111, 103082, 101112, 103083, 667278, 668767, 668529, 103084, 668766, 669257, 668958, 668542, 101176, 103088, 667281, 669214, 669193, 101666, 103089, 669020, 667284, 668986, 668490, 101712, 103098, 669123, 101722, 103103, 103111, 667292, 667296, 101736, 667299, 668728, 101750, 668727, 102557, 103119, 667302, 101763, 667303, 669032, 103143, 103145, 667305, 101887, 103151, 101897, 667308, 668939, 667312, 668859, 101916, 667313, 669172, 669262, 101945, 667315, 668995, 101948, 667317, 668860, 103171, 668570, 101979, 103178, 667328, 668971, 101983, 103179, 667329, 101997, 667331, 103183, 667332, 102014, 103184, 668887, 102016, 103189, 102022, 667338, 668663, 668886, 669092, 102063, 667349, 102068, 103197, 667352, 102074, 103198, 668635, 669161, 102075, 103200, 668633, 103201, 667357, 668624, 669143, 668701, 102101, 103205, 668700, 668593, 102126, 667374, 669130, 668547, 669148, 102147, 103408, 667375, 669149, 668961, 102160, 669117, 102167, 103417, 102180, 667394, 103433, 102186, 669283, 102206, 667405, 102223, 666667, 667410, 667412, 102245, 666677, 667413, 669065, 669137, 668906, 668759, 667414, 668697, 667420, 668957, 669050, 102264, 667421, 667423, 668910, 667429, 102278, 666733, 668599, 102280, 669121, 102300, 666740, 667439, 102304, 667441, 666746, 667446, 668682, 102353, 666751, 667453, 669103, 669189, 102354, 666755, 669094, 669093, 102355, 669022, 102357, 667471, 669141, 102358, 667473, 667476, 669275, 669132, 102371, 667485, 669127, 102373, 667487, 102374, 102377, 669263, 669186, 102379, 666782, 667510, 101724, 668891, 666783, 668880, 102416, 666786, 669235, 668601, 669162, 102433, 666790, 102436, 669099, 102443, 669008, 666799, 103459, 666800, 669153, 102479, 669108, 102480, 666807, 669114, 102481, 666816, 669110, 102482, 666820, 669107, 102483, 102490, 666828, 668895, 669100, 102498, 666834, 102519, 666839, 102533, 666840, 669233, 103015, 666852, 669124, 668090, 102595, 668922, 666864, 666868, 102624, 668882, 102630, 102637, 668795, 668838, 668200, 102642, 102534, 102671, 666879, 669176, 669000, 102676, 666888, 668850, 668868, 668772, 668853, 666891, 669175, 102705, 669139, 668304, 102706, 668944, 669191, 669133, 666907, 102713, 100032, 102718, 666909, 669074, 102720, 669006, 669035, 100056, 100065, 102726, 102731, 668675, 669192, 668352, 102733, 666918, 666919, 100116, 102736, 100121, 102742, 666927, 100123, 102744, 100126, 102749, 669055, 100129, 102750, 669221, 100130, 102752, 666942, 100132, 102756, 666944, 100135, 102759, 669025, 669147, 668954, 102767, 668306, 100144, 102771, 669184, 668620, 100145, 102772, 102776, 100157, 102778, 668904, 102782, 666963, 668900, 669213, 100167, 102784, 100175, 102785, 666967, 102788, 666972, 100190, 102789, 669169, 100193, 102790, 666975, 668705, 102794, 669096, 102795, 100215, 666983, 667437, 668694, 100217, 102808, 668930, 669042, 100221, 666987, 669083, 668658, 102812, 669085, 100225, 102818, 669082, 100230, 102821, 666993, 100234, 102823, 668665, 668659, 102824, 100273, 102826, 100274, 102836, 667006, 669113, 100278, 102844, 100279, 667011, 668095, 100290, 102853, 102856, 100296, 102857, 102858, 668568, 668642, 668950, 102865, 667033, 668914, 100325, 102875, 667034, 669142, 100326, 102876, 669151, 102877, 667037, 669024, 669207, 667044, 669054, 102883, 667046, 100336, 102888, 100350, 102890, 667050, 669196, 102891, 100361, 102893, 100366, 102895, 667057, 668360, 669036, 100369, 102899, 667066, 100396, 667067, 669072, 668773, 100409, 102902, 668653, 100433, 668652, 100444, 102907, 668503, 100449, 102908, 102911, 100455, 102920, 667085, 102921, 667086, 669198, 100463, 102923, 667091, 100470, 668631, 102924, 667093, 668650, 102925, 667094, 667101, 667128, 667304, 667293, 666932, 103022, 100471, 668548, 102763, 667234, 666915, 668717, 101042, 668667, 668625, 668751, 669044, 668777, 666752, 668748, 668776, 666966, 668786, 102996, 667307, 102901, 668612, 668996, 668521, 100920, 668760, 667370, 101110, 102987, 668826, 668997, 666976, 667532, 102932, 102092, 667363, 667116, 668966, 669027, 668855, 668898, 668955, 668993, 103194, 669293, 669177, 669278, 669063, 669173, 669120, 669109, 668963, 669095, 668842, 669205, 669052, 669146, 669097, 669223, 668915, 102915, 101956, 667452, 101134, 667237, 667139, 669031} + + for _, v := range storeList { + payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"storeIDs\"\r\n\r\n[" + utils.Int64ToStr(v) + "]\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"payload\"\r\n\r\n[{\"nameID\":9564,\"unitPrice\":2600}]\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.20240105-151800.localpass.8E9FF0EAAB9A11EE9EC5525400E86DC0.[18981810340]") + req.Header.Add("content-type", "multipart/form-data; boundary=---011000010111000001101001") + + _, err := http.DefaultClient.Do(req) + if err != nil { + fmt.Println(v) + } else { + fmt.Println("=", v) + } + time.Sleep(1 * time.Second) + } + } diff --git a/platformapi/tiktok_shop/tiktok_api/afs_test.go b/platformapi/tiktok_shop/tiktok_api/afs_test.go index 4e2ab7e4..11e9e54e 100644 --- a/platformapi/tiktok_shop/tiktok_api/afs_test.go +++ b/platformapi/tiktok_shop/tiktok_api/afs_test.go @@ -8,7 +8,7 @@ import ( ) // 京西速食(蔬菜) -var token1 = `{"access_token":"f0f8a7d0-8484-482b-8c3e-39da6a415c27","expires_in":1704307911,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"8648acb6-35d1-4568-ba49-4f3295129845","authority_id":""}` +var token1 = `{"access_token":"b8dbed2b-090d-4719-88b9-7d061595bf58","expires_in":1704909356,"scope":"SCOPE","shop_id":57939570,"shop_name":"京西菜市速食","refresh_token":"fa1028c8-2c3e-41b5-992d-a92bdc17ab0c","authority_id":""}` // 美好菜市 //var token1 = `{"access_token":"9a315a03-c737-4a82-ae52-c9a6ce827007","expires_in":1699490747,"scope":"SCOPE","shop_id":68032645,"shop_name":"美好菜市","refresh_token":"8334c006-5301-4d25-911b-4d8cc7b70ebb","authority_id":""}` diff --git a/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go b/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go index 0503c3cc..2353fc4d 100644 --- a/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go +++ b/platformapi/tiktok_shop/tiktok_api/settl_bill_detail_test.go @@ -10,7 +10,7 @@ import ( ) func TestBillDetail(t *testing.T) { - orderDetail, err := a.GetTiktokOrderDetail("6924471291044304141") + orderDetail, err := a.GetTiktokOrderDetail("6925277063668307022") if err != nil { fmt.Println(err) } @@ -19,7 +19,7 @@ func TestBillDetail(t *testing.T) { for _, v := range orderDetail.SkuOrderList { childrenOrderList = append(childrenOrderList, v.OrderId) } - childrenOrderList = append(childrenOrderList, "6924471291044304141") + childrenOrderList = append(childrenOrderList, "6925277063668307022") date, datae, err := a.GetSettleBillDetailV3(&order_getSettleBillDetailV3_request.OrderGetSettleBillDetailV3Param{ Size: 20,