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();
}
///
/// 发送公众号模板消息
///
public static void SendGzhMessage()
{
var token = SmsGzhHelperHandle.GetGzhToken();
var obj = new { character_string4 = new { value = 1 }, thing5 = new { value = 2 }, thing6 = new { value = "美团" } };
SendTemplateMsgRequest sendReq = new SendTemplateMsgRequest()
{
template_id = "JysgGfHs9Zr_AyoazXVCEgHeGvZ2n7lRbH1xCSEFYWY",
touser = "oobYq6yFZhs52JIQ4zalhIJKEwy8",
data = obj
};
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 list = new List();
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 list = new List();
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\":\"









\",\"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(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 ls = new List();
ls.Add("683260412485");
PFTProductDetailRequest request = new PFTProductDetailRequest()
{
offerIds = ls
};
var response = AliabaClient.Execute(request, sessionkey);
}
///
/// 查询标获取
///
private static void GetProTag()
{
PFTProductSearchTagListRequest request = new PFTProductSearchTagListRequest();
var response = AliabaClient.Execute(request, sessionkey);
}
///
/// 获取精选商品列表
///
private static void GetProductList()
{
PFTProductListRequest request = new PFTProductListRequest()
{
ruleId = "508286",
pageNo = 1,
pageSize = 10
};
var response = AliabaClient.Execute(request, sessionkey);
}
///
/// 创建订单
///
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 cargoParamListItems = new List();
cargoParamListItems.Add(cargoParamListItem);
trReq.cargoParamList = cargoParamListItems;
var trresponse = AliabaClient.Execute(trReq, sessionkey);
}
}
}