zhao_js
2023-11-01 73daf9245c2194c65104ffcd7990b741e5a4de32
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
using AlibabaSDK.Api;
using AlibabaSDK.Domain;
using AlibabaSDK.Request;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using YouZanSDKStandard.Api.Request;
using CommonUtil;
using YouZanSDKStandard.Api.Domain;
using YouZanSDKStandard.Api;
using Operater.DbModel;
using Operater.DAL;
using System.Linq;
using System.Xml;
using Operater.Common;
 
namespace Test
{
    class Program
    {
        public static string sessionkey = "1c57c663-6657-41af-85e1-77dec6ec500b";
        static void Main(string[] args)
        {
            SendGzhMessage();
 
            Console.ReadLine();
        }
 
        /// <summary>
        /// 发送公众号模板消息
        /// </summary>
        public static void SendGzhMessage()
        {
            var token = SmsGzhHelperHandle.GetGzhToken();
            var obj = new { thing15 = new { value = "您有新的回复" }, phone_number30 = new { value = "15295036569" } };
            SendTemplateMsgRequest sendReq = new SendTemplateMsgRequest()
            {
                template_id = "EiZ7vsaG7Ak6Y_gUJXe2cH-WQpdornVqqToZ6hpv4-c",
                touser = "ocUrg6nVVPhn-m6yNPg7igYnB64g",
                data = obj,
                url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx7a9a40880081340d&redirect_uri=https%3A%2F%2Fsms.ushopvip.com%2Fpages%2Ftransfer%2Findex&response_type=code&scope=snsapi_base&state=gzh#wechat_redirect"
            };
            var sendRsp = SmsGzhHelperHandle.SendTemplateMsg(sendReq, token);
        }
 
        public static void WxMessageHandle(string xmlMessage)
        {
            XmlDocument doc = new XmlDocument();
            XmlNode root;
            doc.LoadXml(xmlMessage);
            root = doc.FirstChild;
            string token = root["Token"].InnerText;
        }
 
        private static void AddAliExpress()
        {
            string aliToken = "1c57c663-6657-41af-85e1-77dec6ec500b";
            AlibabaLogisticsGetRequest req = new AlibabaLogisticsGetRequest();
            var response = AliabaClient.Execute(req, aliToken);
            List<AliExpress> list = new List<AliExpress>();
            foreach (var item in response.result)
            {
                AliExpress aliExpress = new AliExpress()
                {
                    Id = item.id,
                    ComNo = item.companyNo,
                    Name = item.companyName,
                    Phone = item.companyPhone,
                    SupportPrint = item.supportPrint
                };
                list.Add(aliExpress);
            }
            new AliExpressDAL().InsertRange(list);
        }
 
        private static void AddYzExpress()
        {
            string yzToken = "039f5ec3f71babf92b91875aa3c8ebf";
            YouZanLogisticsExpressGetRequest youZanLogisticsExpressGetRequest = new YouZanLogisticsExpressGetRequest();
            var response = YouZanClient.Execute(youZanLogisticsExpressGetRequest, yzToken);
            List<YzExpress> list = new List<YzExpress>();
            foreach (var item in response.data.allExpress)
            {
                YzExpress yzExpress = new YzExpress()
                {
                    Id = item.id,
                    Name = item.name,
                    Display = item.display
                };
                list.Add(yzExpress);
            }
            new YzExpressDAL().InsertRange(list);
        }
 
        private static void AddYz()
        {
            string str = "{\"presale_param\":null,\"video_id\":null,\"item_delivery_param\":null,\"item_weight\":0,\"category_param\":null,\"item_no\":\"683260412485\",\"sku_list\":[{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"黑色\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641034,\"stock_num\":418775},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"灰色\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641035,\"stock_num\":848563},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"深紫蓝\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641036,\"stock_num\":1456794},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"深灰蓝\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641037,\"stock_num\":1468204},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"浅棕\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641038,\"stock_num\":915220},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"深棕\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641039,\"stock_num\":1266399},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"浅咖\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641040,\"stock_num\":1526770},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"浅灰蓝\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641041,\"stock_num\":1616558},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"深灰紫\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641042,\"stock_num\":1666630},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"深红\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641043,\"stock_num\":1676700},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"土黄\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641044,\"stock_num\":1666720},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"藕粉\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641045,\"stock_num\":1675120},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"深紫\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641046,\"stock_num\":1422181},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"浅紫\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641047,\"stock_num\":1259430},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"蓝色\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641048,\"stock_num\":1189404},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"绿色\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641049,\"stock_num\":1116347},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"淡黄\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641050,\"stock_num\":1190561},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"米黄\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641051,\"stock_num\":1253520},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"粉色\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641052,\"stock_num\":950062},{\"weight\":0,\"barcode\":null,\"barcodes\":null,\"sku_props\":[{\"prop_value_name\":\"颜色\",\"prop_name\":\"鹅黄\",\"prop_name_id\":\"3216\",\"prop_value_id\":\"0\"}],\"price\":4,\"max_guide_price\":0,\"cost_price\":0,\"min_guide_price\":0,\"delivery_price\":0,\"standard_price\":0,\"prepare_time\":0,\"sku_no\":4890795641053,\"stock_num\":987736}],\"display_on_kdt_ids\":null,\"barcode\":null,\"item_props\":[{\"prop_id\":364,\"prop_text_ids\":[0]},{\"prop_id\":287,\"prop_text_ids\":[0]},{\"prop_id\":1398,\"prop_text_ids\":[0]},{\"prop_id\":2176,\"prop_text_ids\":[0]},{\"prop_id\":7195,\"prop_text_ids\":[0]},{\"prop_id\":346,\"prop_text_ids\":[0]},{\"prop_id\":182318189,\"prop_text_ids\":[0,0,0,0,0,0,0,0]},{\"prop_id\":3216,\"prop_text_ids\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]},{\"prop_id\":193290003,\"prop_text_ids\":[0]},{\"prop_id\":182282223,\"prop_text_ids\":[0]},{\"prop_id\":8614,\"prop_text_ids\":[0]},{\"prop_id\":20666,\"prop_text_ids\":[0]},{\"prop_id\":401,\"prop_text_ids\":[0]},{\"prop_id\":1811,\"prop_text_ids\":[0]},{\"prop_id\":18066441,\"prop_text_ids\":[0]},{\"prop_id\":275934765,\"prop_text_ids\":[0]}],\"desc\":\"<div id=\\\"offer-template-0\\\"></div><p><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN0188apVX1DRb8moQKq0_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01rzKRMq1DRb8nnDOjE_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN012F3dwY1DRb8nnEfiR_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01XSA6tS1DRb8moRwfP_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01wLDg6T1DRb8m2qqdj_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01ND8Z491DRb8uRIkhn_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01hhxKyg1DRb8hZfVb1_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01LJYJ1n1DRb8j1O48S_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN017VQDWM1DRb8rIFDna_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/><br class=\\\"img-brk\\\"/><img src=\\\"https://cbu01.alicdn.com/img/ibank/O1CN01Bl4JFB1DRb8m2rmum_!!2210022380213-0-cib.jpg?__r__=1662918827861\\\" alt=\\\"undefined\\\"/></p>\",\"auto_listing_time\":0,\"purchase_permission\":null,\"buy_btn_label\":null,\"start_sale_num\":100,\"buy_btn_config\":0,\"stock_deduct_mode\":0,\"join_level_discount\":0,\"post_sale_param\":null,\"messages\":null,\"image_ids\":[6074626834,6074626853,5993890659,5993890671,6074627118],\"sku_value_props\":[{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0},{\"name\":\"颜色\",\"img_id\":0,\"id\":0}],\"display_off_kdt_ids\":null,\"item_type\":0,\"summary\":null,\"brand_id\":null,\"item_price_param\":{\"origin\":null,\"min_guide_price\":0,\"cost_price\":0,\"price\":0,\"max_guide_price\":0},\"title\":\"无接缝毛巾圈头绳发圈女皮筋扎头发高弹耐用韩版网红厂家直销发绳\",\"no_sale_kdt_ids\":null,\"is_display\":0,\"barcodes\":null,\"prepare_time\":0,\"template_id\":0,\"yz_open_id\":null,\"quantity\":25571694,\"category_id\":0,\"hide_stock\":0,\"tag_ids\":null,\"sku_picture_display_config\":true,\"sell_point\":null}";
            YouZanItemAddRequest yzReq = new YouZanItemAddRequest();
            string yzToken = "039f5ec3f71babf92b91875aa3c8ebf";
            YouZanItemAddDomain doMian = JSONUtil.JsonToObject<YouZanItemAddDomain>(str);
            yzReq.param = doMian;
            var yzRsp = YouZanClient.Execute(yzReq, yzToken);
 
            string rss = "";
        }
 
 
        private static void UpFileToYZ()
        {
 
            WebClient MyWebClient = new WebClient();
            MyWebClient.DownloadFile("https://img01.yzcdn.cn/upload_files/2018/10/24/FsXh75Lre04-qJPgZDWefdvK--av.jpg!large.jpg", "D://Img/large.jpg");
 
 
            string filePath = "D:\\11.png";
 
            var client = new RestClient("https://open.youzanyun.com/api/youzan.materials.storage.platform.img.upload/3.0.0?access_token=8ff6c564bab332d4fc46b06880ed5ba");
            client.Timeout = -1;
            var request = new RestRequest(Method.POST);
            //request.AddHeader("operatertoken", "7NGjrBSrR/iEYZPtAw3AIEVYiass7p0NzMuVXo2IEXteuL4UMaTFmX44O+96TxYhvQ6+5KKue31FoW9Piu++q6Gow34J44eV0gpkrBddCHQxiDfAqyqQ7Y3EJD4s2hjn");
            request.AddFile("image", filePath);
            IRestResponse response = client.Execute(request);
            Console.WriteLine(response.Content);
        }
 
        private static void GetProDetail()
        {
            //string timset = "20321026210402000+0800";
            //string format = "yyyyMMddHHmmssfffzzz";
            //DateTime ss = DateTime.ParseExact(timset, format, CultureInfo.InvariantCulture, DateTimeStyles.None);
            List<string> ls = new List<string>();
            ls.Add("683260412485");
            PFTProductDetailRequest request = new PFTProductDetailRequest()
            {
                offerIds = ls
            };
            var response = AliabaClient.Execute(request, sessionkey);
        }
 
        /// <summary>
        /// 查询标获取
        /// </summary>
        private static void GetProTag()
        {
            PFTProductSearchTagListRequest request = new PFTProductSearchTagListRequest();
            var response = AliabaClient.Execute(request, sessionkey);
        }
 
        /// <summary>
        /// 获取精选商品列表
        /// </summary>
        private static void GetProductList()
        {
            PFTProductListRequest request = new PFTProductListRequest()
            {
                ruleId = "508286",
                pageNo = 1,
                pageSize = 10
            };
            var response = AliabaClient.Execute(request, sessionkey);
        }
 
        /// <summary>
        /// 创建订单
        /// </summary>
        private static void CreateTrade()
        {
            AlibabaTradeCreateRequest trReq = new AlibabaTradeCreateRequest();
            trReq.flow = "ttpft";
            trReq.isvBizTypeStr = "fenxiaoMedia";
            trReq.isvBizTypePD = false;
 
            AddressParamItem addressParamItem = new AddressParamItem()
            {
                // addressId = 1242,
                fullName = "zjs",
                mobile = "15295036569",
                phone = "15295036569",
                postCode = "",
                cityText = "常州市",
                provinceText = "江苏省",
                areaText = "新北区",
                townText = "三井街道",
                address = "三井街道",
                districtCode = ""
            };
            trReq.addressParam = addressParamItem;
 
            CargoParamListItem cargoParamListItem = new CargoParamListItem()
            {
                offerId = 677023409817,
                specId = "1fe6464b092c2559b6adb3ad6eaa5d25",
                quantity = 1
            };
            List<CargoParamListItem> cargoParamListItems = new List<CargoParamListItem>();
            cargoParamListItems.Add(cargoParamListItem);
            trReq.cargoParamList = cargoParamListItems;
            var trresponse = AliabaClient.Execute(trReq, sessionkey);
        }
    }
}