-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathProgram.cs
1436 lines (1329 loc) · 48.3 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using Common;
using Common.Request;
using Common.Request.Subscribe;
using Utils;
using Newtonsoft.Json;
using Common.Request.Electronic.Image;
using Common.Request.Electronic.Html;
using Common.Request.Electronic;
using Common.Request.Electronic.Print;
using Common.Request.Sms;
using Common.Request.BorderOfficial;
using Common.Request.internationalshipment;
using Common.Request.cloud;
using Common.Request.samecity;
using Common.Request.thirdPlatform;
using System.Collections;
using System.Collections.Generic;
using Common.Request.Electronic.ocr;
using Common.Request.Label;
using Common.Request.Corder;
using Common.Request.reachable;
using Common.Request.Bsamecity;
using Common.Request.AddressResolution;
using Common.Request.PriceQuery;
class Program
{
//快递100的基础账号信息,可以在这里获取 (需要填写完整才能测试)
//https://api.kuaidi100.com/manager/v2/myinfo/enterprise
private static KuaiDi100Config config = new KuaiDi100Config()
{
key = "",
customer = "",
secret = "",
userid = "",
siid = "",
tid = "",
};
static void Main(string[] args)
{
// testQueryTrack();
// testSubscribe();
// testQueryTrackWithMap();
// testSubscribeWithMap();
// testPrintImg();
// testPrintHtml();
// testPrintCloud();
// testSendSms();
// testAutoNum();
// testBOrderQuery();
// testBOrder();
// testBOrderCancel();
// testInternationalShipment();
// testCloudPrintCustom();
// testCloudAttachment();
// testCloudDevStatus();
// testCloudPrintCommand();
// testCloudPrintOld();
// testCloudPrintParcelsBill();
// testThirdPlatformStoreAuth();
// testThirdPlatformCommitTask();
// testThirdPlatformUploadNum();
// testSameCityStoreAuth();
// testSameCityOrder();
// testSameCityQuery();
// testSameCityCancel();
// testThirdPlatformAuth();
// testThirdPlatBranchInfo();
// testLabelCancel();
// testOcr();
// testBOrderOfficialQueryDetail();
// testLabelOrder();
// testLabelRepeatPrint();
// testLabelCustomPrint();
// testCOrder();
// testCOrderCancel();
// testCOrderQueryPrice();
//testExpressReachable();
//testBsamecityPrice();
//testBsamecityOrder();
//testBsamecityPrecancel();
//testBsamecityAddfee();
//testDeliveryTime();
//testBackOrder();
//testInterceptOrder();
//testAddressResolution();
//testIntAddressResolution();
testPriceQuery();
}
/// <summary>
/// 轨迹物流查询
/// </summary>
static void testQueryTrack()
{
var queryTrackParam = new QueryTrackParam()
{
com = "zhongtong",
num = "7537****693697",
phone = "15****98256"
};
QueryTrack.query(new QueryTrackReq()
{
customer = config.customer,
sign = SignUtils.GetMD5(queryTrackParam.ToString() + config.key + config.customer),
param = queryTrackParam
});
}
/// <summary>
/// 轨迹订阅
/// </summary>
static void testSubscribe()
{
var subscribeParameters = new SubscribeParameters()
{
phone = "159*****256",
resultv2 = "1",
callbackurl = "http://www.xxxx.com"
};
var subscribeParam = new SubscribeParam()
{
company = "zhongtong",
number = "7537****693697",
key = config.key,
parameters = subscribeParameters
};
Subscribe.subscribe(new SubscribeReq()
{
schema = ApiInfoConstant.SUBSCRIBE_SCHEMA,
param = subscribeParam,
});
}
/// <summary>
/// 地图轨迹物流查询
/// </summary>
static void testQueryTrackWithMap()
{
var queryTrackParam = new QueryTrackParam()
{
com = "zhongtong",
num = "7537****693697",
phone = "159****8256",
from = "北京海淀区",
to = "深圳南山区"
};
QueryTrackWithMap.query(new QueryTrackReq()
{
customer = config.customer,
sign = SignUtils.GetMD5(queryTrackParam.ToString() + config.key + config.customer),
param = queryTrackParam
});
}
/// <summary>
/// 地图轨迹订阅
/// </summary>
static void testSubscribeWithMap()
{
var subscribeParameters = new SubscribeParameters()
{
phone = "159****8256",
resultv2 = "1",
callbackurl = "http://www.xxxx.com"
};
var subscribeParam = new SubscribeParam()
{
company = "zhongtong",
number = "7537****3697",
key = config.key,
parameters = subscribeParameters,
from = "北京海淀区",
to = "深圳南山区"
};
SubscribeWithMap.subscribe(new SubscribeReq()
{
schema = ApiInfoConstant.SUBSCRIBE_SCHEMA,
param = subscribeParam,
});
}
/// <summary>
/// 电子面单V2打印接口
/// </summary>
static void testLabelOrder()
{
var orderParam = new OrderParam()
{
kuaidicom = "zhaijisong",
sendMan = new ManInfo()
{
name = "张三",
mobile = "15****98256",
printAddr = "西藏日喀则市定日县珠穆朗玛峰",
},
recMan = new ManInfo()
{
name = "李四",
mobile = "15****98256",
printAddr = "西藏日喀则市定日县珠穆朗玛峰",
},
count = 1,
siid = config.siid,
tempId = "60f6c17c7c223700131d8bc3",
printType = "CLOUD"
};
var timestamp = DateUtils.GetTimestamp();
LabelV2.order(new BaseReq<OrderParam>()
{
method = ApiInfoConstant.ORDER,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(orderParam.ToString() + timestamp + config.key + config.secret),
param = orderParam,
});
}
/// <summary>
/// 电子面单V2复打接口
/// </summary>
static void testLabelRepeatPrint()
{
var orderParam = new RepeatPrintParam()
{
taskId = "638687EEB4744396A40F693541114E44"
};
var timestamp = DateUtils.GetTimestamp();
LabelV2.repeatPrint(new BaseReq<RepeatPrintParam>()
{
method = ApiInfoConstant.CLOUD_PRINT_OLD_METHOD,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(orderParam.ToString() + timestamp + config.key + config.secret),
param = orderParam,
});
}
/// <summary>
/// 自定义接口
/// </summary>
static void testLabelCustomPrint()
{
var customParam = new Dictionary<string, object>();
customParam.Add( "qrcode","888888888");
var orderParam = new CustomPrintParam()
{
siid = config.siid,
tempId = "41b9d19ee56b45b5a23d7b6ace4f9029",
printType = "IMAGE",
customParam = customParam
};
var timestamp = DateUtils.GetTimestamp();
LabelV2.customPrint(new BaseReq<CustomPrintParam>()
{
method = ApiInfoConstant.CUSTOM,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(orderParam.ToString() + timestamp + config.key + config.secret),
param = orderParam,
});
}
/// <summary>
/// 快递预估时效查询接口
/// </summary>
static void testDeliveryTime()
{
var deliveryTimeParam = new DeliveryTimeParam()
{
kuaidicom = "jd",
from = "广东省深圳市南山区",
to = "广东省深圳市南山区",
orderTime = "2023-10-12 10:00:00",
expType = "特惠送"
};
var timestamp = DateUtils.GetTimestamp();
LabelV2.deliveryTime(new BaseReq<DeliveryTimeParam>()
{
method = ApiInfoConstant.TIME,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(deliveryTimeParam.ToString() + timestamp + config.key + config.secret),
param = deliveryTimeParam,
});
}
/// <summary>
/// 运单附件查询接口
/// </summary>
static void testBackOrder()
{
var backOrderParam = new BackOrderParam()
{
kuaidicom = "shunfeng",
kuaidinum = "SF1234567",
imgType = 1,
partnerId = "12345678",
partnerKey = "12345678",
phone = "13088888888"
};
var timestamp = DateUtils.GetTimestamp();
LabelV2.backOrder(new BaseReq<BackOrderParam>()
{
method = ApiInfoConstant.BACKORDER,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(backOrderParam.ToString() + timestamp + config.key + config.secret),
param = backOrderParam,
});
}
/// <summary>
/// 地址解析接口
/// </summary>
static void testAddressResolution()
{
var addressResolutionParam = new AddressResolutionParam()
{
content = "张三广东省深圳市南山区粤海街道科技南十二路金蝶软件园13088888888"
};
var timestamp = DateUtils.GetTimestamp();
AddressResolution.addressResolution(new AddressResolutionReq<AddressResolutionParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(addressResolutionParam.ToString() + timestamp + config.key + config.secret),
param = addressResolutionParam,
});
}
/// <summary>
/// 国际地址解析接口
/// </summary>
static void testIntAddressResolution()
{
var intAddressResolutionParam = new IntAddressResolutionParam()
{
code = "US",
address = "24300 Nandina Ave Moreno Valley, CA",
language = "zh"
};
var timestamp = DateUtils.GetTimestamp();
IntAddressResolution.addressResolution(new AddressResolutionReq<IntAddressResolutionParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(intAddressResolutionParam.ToString() + timestamp + config.key + config.secret),
param = intAddressResolutionParam
});
}
/// <summary>
/// 订单拦截接口
/// </summary>
static void testInterceptOrder()
{
var interceptOrderParam = new InterceptOrderParam()
{
callbackUrl="http=//api.kuaidi100.com/test/callback",
interceptPayType="THIRDPARTY",
interceptType="MODIFY_ADDR",
kuaidicom="jtexpress",
kuaidinum="JT12345678",
orderId="123456789",
orderRole="1",
partnerId="12345678",
partnerKey="12345678",
reason="测试拦截",
salt="kuaidi1000api@salt",
recManInfo = new ManInfo()
{
name = "张三",
mobile = "130******66",
printAddr = "东省深圳市南山区粤海街道科技南十二路金蝶软件园",
},
};
var timestamp = DateUtils.GetTimestamp();
LabelV2.InterceptOrder(new BaseReq<InterceptOrderParam>()
{
method = ApiInfoConstant.INTERCEPTORDER,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(interceptOrderParam.ToString() + timestamp + config.key + config.secret),
param = interceptOrderParam,
});
}
/// <summary>
/// 电子面单图片接口(v1版本示例,建议使用v2)
/// </summary>
static void testPrintImg()
{
var printImgParam = new PrintImgParam()
{
kuaidicom = "zhaijisong",
sendManName = "张三",
sendManMobile = "159****8256",
sendManPrintAddr = "广东省深圳市南山区科技南十二路",
recManName = "李四",
recManMobile = "159****8256",
recManPrintAddr = "北京市海淀区xxx路",
type = "10",
tempid = "180c7c8f646742ca871a92c976392b05",
count = "1",
width = "76",
height = "130",
};
var timestamp = DateUtils.GetTimestamp();
PrintImg.query(new PrintImgReq()
{
method = ApiInfoConstant.ELECTRONIC_ORDER_PIC_METHOD,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(printImgParam.ToString() + timestamp + config.key + config.secret),
param = printImgParam,
});
}
/// <summary>
/// 电子面单html接口(v1版本示例,建议使用v2)
/// </summary>
static void testPrintHtml()
{
var printHtmlParam = new PrintHtmlParam()
{
kuaidicom = "zhaijisong",
sendMan = new ManInfo()
{
name = "张三",
mobile = "159****8256",
printAddr = "广东省深圳市南山区科技南十二路",
},
recMan = new ManInfo()
{
name = "李四",
mobile = "159****8256",
printAddr = "北京市海淀区xxx路",
},
count = "1",
needTemplate = "1", //如果需要返回电子面单,需要设置
};
var timestamp = DateUtils.GetTimestamp();
PrintHtml.query(new PrintHtmlReq()
{
method = ApiInfoConstant.ELECTRONIC_ORDER_HTML_METHOD,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(printHtmlParam.ToString() + timestamp + config.key + config.secret),
param = printHtmlParam,
});
}
/// <summary>
/// 电子面单打印接口(v1版本示例,建议使用v2)
/// </summary>
static void testPrintCloud()
{
var printCloudParam = new PrintCloudParam()
{
kuaidicom = "zhaijisong",
sendMan = new ManInfo()
{
name = "张三",
mobile = "15****98256",
printAddr = "广东省深圳市南山区科技南十二路",
},
recMan = new ManInfo()
{
name = "李四",
mobile = "15****98256",
printAddr = "北京市海淀区xxx路",
},
count = "1",
siid = config.siid,
tempid = "180c7c8f646742ca871a92c976392b05",
width = "76",
height = "130"
};
var timestamp = DateUtils.GetTimestamp();
PrintCloud.query(new PrintCloudReq()
{
method = ApiInfoConstant.ELECTRONIC_ORDER_PRINT_METHOD,
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(printCloudParam.ToString() + timestamp + config.key + config.secret),
param = printCloudParam,
});
}
/// <summary>
/// 发送短信
/// </summary>
static void testSendSms()
{
var content = new Hashtable();
content.Add("username", "测试用户");
SendSms.query(new SendSmsReq()
{
content = JsonConvert.SerializeObject(content),
phone = "xxx",
seller = "测试",
userid = config.userid,
tid = config.tid,
sign = SignUtils.GetMD5(config.key + config.userid)
});
}
/// <summary>
/// 智能识别
/// </summary>
static void testAutoNum()
{
AutoNum.query("773039762404825", config.key);
}
/// <summary>
/// 商家寄件查询价格
/// </summary>
static void testBOrderQuery()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new BOrderOfficialQueryPriceParam()
{
sendManPrintAddr = "福田区华强北",
kuaidiCom = "jtexpress",
recManPrintAddr = "北京海淀区"
};
BaseReq<BOrderOfficialQueryPriceParam> baseReq = new BaseReq<BOrderOfficialQueryPriceParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
BOrderOfficial.queryPrice(baseReq);
}
/// <summary>
/// 商家寄件下单
/// 注意保存一下返回值(taskId和orderId),用于获取验证码或者取消订单
/// </summary>
static void testBOrder()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new BOrderOfficialOrderParam()
{
kuaidicom = "jtexpress",
recManName = "张三",
recManMobile = "159953225555",
recManPrintAddr = "西藏日喀则市定日县珠穆朗玛峰",
sendManName = "李四",
sendManMobile = "15333333333",
sendManPrintAddr = "西藏日喀则市定日县珠穆朗玛峰",
cargo = "文件",
weight = "1",
remark = "测试单,待会取消",
salt = "123",
callBackUrl = "http://www.xxxx.com",
serviceType = "标准快递"
};
BaseReq<BOrderOfficialOrderParam> baseReq = new BaseReq<BOrderOfficialOrderParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
BOrderOfficial.order(baseReq);
}
/// <summary>
/// 商家寄件取消寄件
/// 入参为下单接口返回的taskId和orderId
/// </summary>
static void testBOrderCancel()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new BOrderOfficialCancelParam()
{
taskId = "9406BFCD6******1E0E00D23047FFB",
orderId = "169**740",
cancelMsg = "测试单"
};
BaseReq<BOrderOfficialCancelParam> baseReq = new BaseReq<BOrderOfficialCancelParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
BOrderOfficial.cancel(baseReq);
}
/// <summary>
/// 国际电子面单API
/// </summary>
static void testInternationalShipment()
{
var timestamp = DateUtils.GetTimestamp();
List<PackageInfo> packageInfoList = new List<PackageInfo>();
var packageInfo = new PackageInfo()
{
length = 10.00,
width = 20.00,
height = 10.00,
weight = 50.00
};
packageInfoList.Add(packageInfo);
List<ExportInfo> exportInfoList = new List<ExportInfo>();
var exportInfo = new ExportInfo()
{
desc = "test",
grossWeight = 50.00,
quantity = 1,
quantityUnitOfMeasurement = "PCS",
manufacturingCountryCode = "CN",
unitPrice = 100
};
exportInfoList.Add(exportInfo);
var baseParam = new ShipmentReq()
{
partnerId = "",
partnerKey = "",
partnerSecret = "",
code = "",
kuaidicom = "fedex",
cargo = "invoice",
expType = "FedEx International First®",
unitOfMeasurement = "SU",
weight = 50.00,
customsValue = 1000.00,
sendMan = new InterManInfo()
{
name = "test",
mobile = "1688888888",
countryCode = "CN",
city = "SHENZHEN",
addr = "Hi-tech Park,Nanshang District",
zipcode = "518057",
email = "[email protected]"
},
recMan = new InterManInfo()
{
name = "test",
mobile = "1688888888",
countryCode = "US",
city = "NEW YORK",
addr = " 70 Washington Square South",
zipcode = "10012",
stateOrProvinceCode = "NY",
email = "[email protected]"
},
packageInfos = packageInfoList,
exportInfos = exportInfoList,
customsClearance = new CustomsClearance()
{
purpose = "GIFT",
isDocument = true,
}
};
BaseReq<ShipmentReq> baseReq = new BaseReq<ShipmentReq>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
InternationalShipment.getLabel(baseReq);
}
/// <summary>
/// 自定义打印接口(v1版本示例,建议使用v2)
/// </summary>
static void testCloudPrintCustom()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new CustomParam()
{
tempid = "180c7c8f646742ca871a92c976392b05",
callBackUrl = "http://www.xxxx.com",
siid = config.siid,
};
BaseReq<CustomParam> baseReq = new BaseReq<CustomParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
CloudPrint.custom(baseReq);
}
/// <summary>
/// 云打印附件
/// </summary>
static void testCloudAttachment()
{
string filePath = "C:\\Users\\Administrator.-20171106WFEKLN\\Desktop\\2.png";
string filename = "2.png";
var timestamp = DateUtils.GetTimestamp();
var baseParam = new AttachmentParam()
{
callBackUrl = "http://www.xxxx.com",
siid = config.siid,
};
BaseReq<AttachmentParam> baseReq = new BaseReq<AttachmentParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
CloudPrint.attachment(baseReq, filePath, filename);
}
/// <summary>
/// 复打
/// </summary>
static void testCloudPrintOld()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new PrintOldParam()
{
taskId = "0E0D2AC5D******463DAF1DA5F9"
};
BaseReq<PrintOldParam> baseReq = new BaseReq<PrintOldParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
CloudPrint.printOld(baseReq);
}
/// <summary>
/// 指令打印接口
/// </summary>
static void testCloudPrintCommand()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new CommandParam()
{
content = "H4sIAAAAAAAAAO1cXWwdx3We9RpZQpC0BvoQPQhdgnnoDxbW3fu71yC48V9RAbWTWmoa9CmF0aIB4oQOApQBBO7SBMo8FOZr3whKD7ULu7Ajyo5t2VzqKr4KFYuUFVEBWld7tU2IBjG0FB80lFczPefs7uXey2Vs0kaBtneku3O038y3M2fOnDkzu9CJ43/15LBVKj1cGn7uOdOyE+HQgSeOP/Pk4yePf+3p4dKhA4//2YlDBx47fvKpR78+bNVNq1Jrms26aZfMkikHaZAGaZAGaZAGaZAG6f9oCqVsQRbDbwbEjpRzXawNPyOSoTCk1KWM9sk/LaXPmJHxz0gxyrTY5nijy3/QQf7Z2P08/AFjmtS6/N6QEimeTvxDxr75Pabn+AOmEP8ElyzHf1DfF7/HmMuYTnLGr4pRp80nuAB+0o/HXHmY2jDLlH3xc8pUOd2RyH/UmeF8XDT5FrafASh1A/iPqvvgn9Rllx/GtyNDfpBpkc+MH+b5F/fLf8qRszzmxA+knZWM//fZ0Bbqh00aHMFIxuqex9eXMfIn7YfM6LSB35lJ+an9n4+fM4349ZmQ+KdD0H87xw/2k/JDQ/bKz1ziB/0Q/2G3E6honwHnMrCVbH7FmowYky/Cb4/8Tq794tSk07lD/D7w+0e69rl/fiPWZzL++NSY0RFaxv/CkBIz5nwe/vgr+n3gR/8GKo5HRx3wQALmG/ALbU4iP8w6lyvEP00+aQ+Jf0WTwA8UBvCLMdsF/jjl1+eghHBwDkaKFG5HqHvlj56dzvOfGnNBtIeY4oNX8qBH0H72bCQ7DOx4KX5gr/oJw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gf7uBz8Yf+TYsb//m29PfPu7Dz///MPPfu+5Y88f+943//LEE0/97Xe+f+JP/+L7je+On/jGd54Glq8/c/xpmNqmdejAfwNd3t+nZUUAAA==",
siid = config.siid
};
BaseReq<CommandParam> baseReq = new BaseReq<CommandParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
CloudPrint.commandPrint(baseReq);
}
/// <summary>
/// 发货单接口
/// </summary>
static void testCloudPrintParcelsBill()
{
var timestamp = DateUtils.GetTimestamp();
//OrderGoods 表格对象,可以自行自定义即可,这里仅供参考
var baseParam = new ParcelsBillsParam<OrderGoods>()
{
tempid = "164509714515858026",
siid = config.siid
};
BaseReq<ParcelsBillsParam<OrderGoods>> baseReq = new BaseReq<ParcelsBillsParam<OrderGoods>>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
CloudPrint.billParcels(baseReq);
}
/// <summary>
/// 硬件状态接口
/// </summary>
static void testCloudDevStatus()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new DevStatusParam()
{
siid = config.siid
};
BaseReq<DevStatusParam> baseReq = new BaseReq<DevStatusParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
CloudPrint.devStatus(baseReq);
}
/// <summary>
/// 获取店铺授权超链接接口
/// </summary>
static void testThirdPlatformStoreAuth()
{
var baseParam = new StoreAuthParam()
{
shopType = "TAOBAO",
callBackUrl = "http://www.xxxx.com",
salt = "123"
};
BaseReq<StoreAuthParam> baseReq = new BaseReq<StoreAuthParam>()
{
key = config.key,
sign = SignUtils.GetMD5(baseParam.ToString() + config.key + config.secret),
param = baseParam
};
ThirdPlatformOrder.auth(baseReq);
}
/// <summary>
/// 提交订单获取任务接口
/// </summary>
static void testThirdPlatformCommitTask()
{
var baseParam = new CommitTaskParam()
{
shopType = "TAOBAO",
shopId = "41****377",
orderStatus = "UNSHIP",
updateAtMin = "2022-02-17 16:00:00",
updateAtMax = "2022-02-17 16:30:00",
callbackUrl = "http://www.xxxx.com",
salt = "123"
};
BaseReq<CommitTaskParam> baseReq = new BaseReq<CommitTaskParam>()
{
key = config.key,
sign = SignUtils.GetMD5(baseParam.ToString() + config.key + config.secret),
param = baseParam
};
ThirdPlatformOrder.commitTask(baseReq);
}
/// <summary>
/// 快递单号回传及订单发货接口
/// </summary>
static void testThirdPlatformUploadNum()
{
var baseParam = new UploadNumParam()
{
shopType = "TAOBAO",
shopId = "41****77",
orderNum = "240*****8072",
kuaidiCom = "yunda",
kuaidiNum = "1ds23456"
};
BaseReq<UploadNumParam> baseReq = new BaseReq<UploadNumParam>()
{
key = config.key,
sign = SignUtils.GetMD5(baseParam.ToString() + config.key + config.secret),
param = baseParam
};
ThirdPlatformOrder.uploadNum(baseReq);
}
/// <summary>
/// 同城配送账号授权接口
/// </summary>
static void testSameCityStoreAuth()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new SameCityAuthParam()
{
com = "shansong",
storeId = "123456",
callbackUrl = "http://www.xxxx.com"
};
BaseReq<SameCityAuthParam> baseReq = new BaseReq<SameCityAuthParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
SameCity.auth(baseReq);
}
/// <summary>
/// 同城配送下单
/// </summary>
static void testSameCityOrder()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new SameCityOrderParam()
{
partnerId = "199****601",
partnerKey = "806cdf87*******dfb000326375d",
com = "kfw",
storeId = "123456",
recManName = "张三",
recManMobile = "1599*****912",
recManPrintAddr = "西藏日喀则市定日县珠穆朗玛峰",
sendManName = "李四",
sendManMobile = "153******3333",
sendManPrintAddr = "西藏日喀则市定日县珠穆朗玛峰",
price = 100,
orderSourceType = "饿了么",
weight = 1,
remark = "测试单,待会取消",
serviceType = "火锅",
salt = "123",
callbackUrl = "http://www.xxxx.com",
orderSourceNo = "1233",
orderType = 0
};
BaseReq<SameCityOrderParam> baseReq = new BaseReq<SameCityOrderParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
SameCity.order(baseReq);
}
/// <summary>
/// 同城配送查询订单
/// </summary>
static void testSameCityQuery()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new SameCityQueryParam()
{
taskId = "EE815B30*****2FEE0EBFEC3",
orderId = "10003****SWiZ",
};
BaseReq<SameCityQueryParam> baseReq = new BaseReq<SameCityQueryParam>()
{
key = config.key,
t = timestamp,
sign = SignUtils.GetMD5(baseParam.ToString() + timestamp + config.key + config.secret),
param = baseParam
};
SameCity.query(baseReq);
}
/// <summary>
/// 同城配送取消下单接口
/// </summary>
static void testSameCityCancel()
{
var timestamp = DateUtils.GetTimestamp();
var baseParam = new SameCityCancelParam()