|
|
|
|
using NetLibrary;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Web.Script.Serialization;
|
|
|
|
|
using System.Net;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using NetLibrary.Data;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
|
|
|
|
namespace NetLibrary.OnlineTrade
|
|
|
|
|
{
|
|
|
|
|
public class AlibabaApi
|
|
|
|
|
{
|
|
|
|
|
public string Url = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.findOrderListQuery/";
|
|
|
|
|
public string Appkey { get; set; }
|
|
|
|
|
public Int32 ShopId { get; set; }
|
|
|
|
|
|
|
|
|
|
public string DeveKey { get; set; }
|
|
|
|
|
public string RefreshToken { get; set; }
|
|
|
|
|
public string AccessToken { get; set; }
|
|
|
|
|
public DateTime? AccessTokenUpdateTime { get; set; }
|
|
|
|
|
public DateTime? RefreshTokenSaveTime { get; set; }
|
|
|
|
|
public string GroupName { get; set; }
|
|
|
|
|
public string Code { get; set; }
|
|
|
|
|
public int RequestNum = 0;
|
|
|
|
|
public int Num = 0;
|
|
|
|
|
JavaScriptSerializer JsonConvert = null;
|
|
|
|
|
|
|
|
|
|
public AlibabaApi()
|
|
|
|
|
{
|
|
|
|
|
JsonConvert = new JavaScriptSerializer();
|
|
|
|
|
this.Appkey = "4777502";
|
|
|
|
|
this.DeveKey = "QQEkGZe0G93";
|
|
|
|
|
}
|
|
|
|
|
#region 签名函数
|
|
|
|
|
public string Sign(string urlPath, Dictionary<string, string> paramDic, string devekey)
|
|
|
|
|
{
|
|
|
|
|
byte[] signatureKey = Encoding.UTF8.GetBytes(devekey);
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
list.Add(kv.Key + kv.Value);
|
|
|
|
|
}
|
|
|
|
|
list.Sort();
|
|
|
|
|
string tmp = urlPath;
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
tmp = tmp + kvstr;
|
|
|
|
|
}
|
|
|
|
|
//HMAC-SHA1
|
|
|
|
|
HMACSHA1 hmacsha1 = new HMACSHA1(signatureKey);
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(tmp));
|
|
|
|
|
byte[] hash = hmacsha1.Hash;
|
|
|
|
|
//TO HEX
|
|
|
|
|
return BitConverter.ToString(hash).Replace("-", string.Empty).ToUpper();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 授权签名_不使用
|
|
|
|
|
string GetSignName()
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("grant_type", "refresh_token");
|
|
|
|
|
paramDic.Add("client_id", Appkey);
|
|
|
|
|
paramDic.Add("client_secret", DeveKey);
|
|
|
|
|
paramDic.Add("refresh_token", RefreshToken);
|
|
|
|
|
string rUrl = "https://gw.api.alibaba.com/openapi/param2/1/system.oauth2/refreshToken/" + Appkey + "?";
|
|
|
|
|
string signature = Sign("param2/1/system.oauth2/refreshToken/" + Appkey, paramDic, DeveKey);
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
list.Add(kv.Key + "=" + kv.Value);
|
|
|
|
|
}
|
|
|
|
|
list.Sort();
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
rUrl = rUrl + kvstr + "&";
|
|
|
|
|
}
|
|
|
|
|
rUrl = rUrl + "_aop_signature=" + signature;
|
|
|
|
|
return rUrl;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 获取权限令牌_不使用
|
|
|
|
|
string GetAccessToken()
|
|
|
|
|
{
|
|
|
|
|
string AccessToken = "";
|
|
|
|
|
string signatureUrl = GetSignName();
|
|
|
|
|
signatureUrl = "https://gw.api.alibaba.com/openapi/param2/1/system.oauth2/refreshToken/4777502?client_id=4777502&client_secret=QQEkGZe0G93&grant_type=refresh_token&refresh_token=55cd0af4-0a2e-482e-85fc-f660bf95825e&_aop_signature=4BDE5E758525958BC95C447BB3DD459F1E8EBF7C";
|
|
|
|
|
string ErrorMessage = "";
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(signatureUrl, "POST", out ErrorMessage);
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Regex re = new Regex(@"""access_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp = re.Match(XmlContent);
|
|
|
|
|
AccessToken = matchtemp.Groups[1].ToString();
|
|
|
|
|
return AccessToken;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 返回速卖通首次开通API调用首次用户授权Url
|
|
|
|
|
public string GetAuthUrl()
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("client_id", Appkey);
|
|
|
|
|
paramDic.Add("site", "aliexpress");
|
|
|
|
|
//redirect_uri: 用户完成授权之后,回跳到第三方的地址
|
|
|
|
|
paramDic.Add("redirect_uri", "http://gw.api.alibaba.com/auth/authCode.htm");
|
|
|
|
|
string redirect_uri = "http://gw.api.alibaba.com/auth/authCode.htm";
|
|
|
|
|
//state:可选,app自定义参数,回跳到redirect_uri时,会原样返回
|
|
|
|
|
//paramDic.Add("state", "aliexpress");
|
|
|
|
|
//string url = "http://gw.api.alibaba.com/auth/authorize.htm?";
|
|
|
|
|
|
|
|
|
|
//API api = new API();
|
|
|
|
|
string signature = sign(paramDic, DeveKey);
|
|
|
|
|
string url = "http://authhz.alibaba.com/auth/authorize.htm?client_id=" + Appkey + "&site=aliexpress&redirect_uri=" + redirect_uri + "&_aop_signature=" + signature;
|
|
|
|
|
//List<string> list = new List<string>();
|
|
|
|
|
//foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
//{
|
|
|
|
|
// list.Add(kv.Key + "=" + kv.Value);
|
|
|
|
|
//}
|
|
|
|
|
//list.Sort();
|
|
|
|
|
//foreach (string kvstr in list)
|
|
|
|
|
//{
|
|
|
|
|
// url = url + kvstr + "&";
|
|
|
|
|
//}
|
|
|
|
|
//url = url + "_aop_signature=" + signature;
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 返回速卖通首次开通API调用首次用户授权Url
|
|
|
|
|
public string GetAuthUrl2()
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("client_id", Appkey);
|
|
|
|
|
paramDic.Add("site", "aliexpress");
|
|
|
|
|
//redirect_uri: 用户完成授权之后,回跳到第三方的地址
|
|
|
|
|
paramDic.Add("redirect_uri", "http://gw.api.alibaba.com/auth/authCode.htm");
|
|
|
|
|
string redirect_uri = "http://gw.api.alibaba.com/auth/authCode.htm";
|
|
|
|
|
//state:可选,app自定义参数,回跳到redirect_uri时,会原样返回
|
|
|
|
|
//paramDic.Add("state", "aliexpress");
|
|
|
|
|
//string url = "http://gw.api.alibaba.com/auth/authorize.htm?";
|
|
|
|
|
|
|
|
|
|
//API api = new API();
|
|
|
|
|
string signature = sign(paramDic, DeveKey);
|
|
|
|
|
string url = "http://authhz.alibaba.com/auth/authorize.htm?client_id=" + Appkey + "&site=aliexpress&redirect_uri=" + redirect_uri + "&_aop_signature=" + signature;
|
|
|
|
|
//List<string> list = new List<string>();
|
|
|
|
|
//foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
//{
|
|
|
|
|
// list.Add(kv.Key + "=" + kv.Value);
|
|
|
|
|
//}
|
|
|
|
|
//list.Sort();
|
|
|
|
|
//foreach (string kvstr in list)
|
|
|
|
|
//{
|
|
|
|
|
// url = url + kvstr + "&";
|
|
|
|
|
//}
|
|
|
|
|
//url = url + "_aop_signature=" + signature;
|
|
|
|
|
return url;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private string sign(Dictionary<string, string> paramDic, string appSecret)
|
|
|
|
|
{
|
|
|
|
|
byte[] signatureKey = Encoding.UTF8.GetBytes(appSecret);
|
|
|
|
|
//第一步:拼装key+value
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
list.Add(kv.Key + kv.Value);
|
|
|
|
|
}
|
|
|
|
|
//第二步:排序
|
|
|
|
|
list.Sort();
|
|
|
|
|
//第三步:拼装排序后的各个字符串
|
|
|
|
|
string tmp = "";
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
tmp = tmp + kvstr;
|
|
|
|
|
}
|
|
|
|
|
//第四步:将拼装后的字符串和app密钥一起计算签名
|
|
|
|
|
//HMAC-SHA1
|
|
|
|
|
HMACSHA1 hmacsha1 = new HMACSHA1(signatureKey);
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(tmp));
|
|
|
|
|
byte[] hash = hmacsha1.Hash;
|
|
|
|
|
//TO HEX
|
|
|
|
|
return BitConverter.ToString(hash).Replace("-", string.Empty).ToUpper();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private string sign2(string urlPath, Dictionary<string, string> paramDic)
|
|
|
|
|
{
|
|
|
|
|
byte[] signatureKey = Encoding.UTF8.GetBytes(DeveKey);//此处用自己的签名密钥
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
list.Add(kv.Key + kv.Value);
|
|
|
|
|
}
|
|
|
|
|
list.Sort();
|
|
|
|
|
string tmp = urlPath;
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
tmp = tmp + kvstr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//HMAC-SHA1
|
|
|
|
|
HMACSHA1 hmacsha1 = new HMACSHA1(signatureKey);
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(tmp));
|
|
|
|
|
/*
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(urlPath));
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(kvstr));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
byte[] hash = hmacsha1.Hash;
|
|
|
|
|
//TO HEX
|
|
|
|
|
return BitConverter.ToString(hash).Replace("-", string.Empty).ToUpper();
|
|
|
|
|
}
|
|
|
|
|
private string sign3(string urlPath, Dictionary<string, string> paramDic)
|
|
|
|
|
{
|
|
|
|
|
byte[] signatureKey = Encoding.UTF8.GetBytes("YOURSIGNATRUEKEY");//此处用自己的签名密钥
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
list.Add(kv.Key + kv.Value);
|
|
|
|
|
}
|
|
|
|
|
list.Sort();
|
|
|
|
|
string tmp = urlPath;
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
tmp = tmp + kvstr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//HMAC-SHA1
|
|
|
|
|
HMACSHA1 hmacsha1 = new HMACSHA1(signatureKey);
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(tmp));
|
|
|
|
|
/*
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(urlPath));
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(kvstr));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
byte[] hash = hmacsha1.Hash;
|
|
|
|
|
//TO HEX
|
|
|
|
|
return BitConverter.ToString(hash).Replace("-", string.Empty).ToUpper();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取零时和长时令牌
|
|
|
|
|
public void GetAllToken(out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//string URL = "https://gw.api.alibaba.com/openapi/http/1/system.oauth2/getToken/YOUR_APPKEY?grant_type=authorization_code&need_refresh_token=true&client_id= YOUR_APPKEY&client_secret= YOUR_APPSECRET&redirect_uri=YOUR_REDIRECT_URI&code=CODE
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/http/1/system.oauth2/getToken/" + Appkey + "?grant_type=authorization_code&need_refresh_token=true&client_id=" + Appkey + "&client_secret=" + DeveKey + "&redirect_uri=http://121.43.228.63/&code=" + Code;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
RequestNum++;
|
|
|
|
|
|
|
|
|
|
Regex re = new Regex(@"""access_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp = re.Match(XmlContent);
|
|
|
|
|
|
|
|
|
|
Regex re1 = new Regex(@"""refresh_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp1 = re1.Match(XmlContent);
|
|
|
|
|
|
|
|
|
|
AccessToken = matchtemp.Groups[1].Value;
|
|
|
|
|
RefreshToken = matchtemp1.Groups[1].Value;
|
|
|
|
|
RefreshTokenSaveTime = DateTime.Now;
|
|
|
|
|
AccessTokenUpdateTime = DateTime.Now;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 当长时令牌超过25天,那么重新请求
|
|
|
|
|
public void GetRefreshToken(out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
//ErrorMessage = "";
|
|
|
|
|
RefreshTokenSaveTime = DateTime.Now;
|
|
|
|
|
// return;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("client_id", Appkey);
|
|
|
|
|
paramDic.Add("client_secret", DeveKey);
|
|
|
|
|
paramDic.Add("refresh_token", RefreshToken);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/system.oauth2/postponeToken/" + Appkey;
|
|
|
|
|
string signature = sign(paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/system.oauth2/postponeToken/" + Appkey + "?client_id=" + Appkey + "&client_secret=" + DeveKey + "&refresh_token=" + RefreshToken + "&access_token=" + AccessToken;
|
|
|
|
|
//URL += "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
|
|
|
|
|
Regex re = new Regex(@"""access_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp = re.Match(XmlContent);
|
|
|
|
|
|
|
|
|
|
Regex re1 = new Regex(@"""refresh_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp1 = re1.Match(XmlContent);
|
|
|
|
|
|
|
|
|
|
AccessToken = matchtemp.Groups[1].Value;
|
|
|
|
|
RefreshToken = matchtemp1.Groups[1].Value;
|
|
|
|
|
RefreshTokenSaveTime = DateTime.Now;
|
|
|
|
|
AccessTokenUpdateTime = DateTime.Now;
|
|
|
|
|
UpdateShopToken();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 当访问令牌超过10小时,那么重新请求
|
|
|
|
|
public void GetAccessToken2(out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
// ErrorMessage = "";
|
|
|
|
|
//return;
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/system.oauth2/getToken/" + Appkey + "?grant_type=refresh_token&client_id=" + Appkey + "&client_secret=" + DeveKey + "&refresh_token=" + RefreshToken;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Regex re = new Regex(@"""access_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp = re.Match(XmlContent);
|
|
|
|
|
AccessToken = matchtemp.Groups[1].Value;
|
|
|
|
|
AccessTokenUpdateTime = DateTime.Now;
|
|
|
|
|
UpdateShopToken();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 当访问令牌超过10小时,那么重新请求
|
|
|
|
|
public void GetAccessToken21(out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
// ErrorMessage = "";
|
|
|
|
|
//return;
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/system.oauth2/getToken/" + Appkey + "?grant_type=refresh_token&client_id=" + Appkey + "&client_secret=" + DeveKey + "&refresh_token=" + RefreshToken;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Regex re = new Regex(@"""access_token"":""(?'1'[^""]+)""");
|
|
|
|
|
Match matchtemp = re.Match(XmlContent);
|
|
|
|
|
AccessToken = matchtemp.Groups[1].Value;
|
|
|
|
|
AccessTokenUpdateTime = DateTime.Now;
|
|
|
|
|
UpdateShopToken();
|
|
|
|
|
UpdateShopToken3();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 得到待发货订单
|
|
|
|
|
public List<OrderModel> GetWaitGoods(DateTime? StartTime, DateTime? StopTime, bool IsReadMsg,List<Alibaba_OrderCode> OList, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-5))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if ( RefreshTokenSaveTime.Value.AddDays(160) < DateTime.Now)
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("page", "1");
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
paramDic.Add("orderStatus", "WAIT_SELLER_SEND_GOODS");
|
|
|
|
|
//if (StartTime!=null)
|
|
|
|
|
//paramDic.Add("createDateStart", StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
// if (StopTime != null)
|
|
|
|
|
// paramDic.Add("createDateEnd", StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderListQuery/" + Appkey;
|
|
|
|
|
string signature = signPath(MethodName, paramDic,DeveKey);
|
|
|
|
|
|
|
|
|
|
string rUrl = Url + Appkey + "?access_token=" + AccessToken + "&page=1&pageSize=50&orderStatus=WAIT_SELLER_SEND_GOODS";
|
|
|
|
|
//if (StartTime != null) rUrl += "&createDateStart=" + StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
//if (StopTime != null) rUrl += "&createDateEnd=" + StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
rUrl += "&_aop_signature="+signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(rUrl, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
AlibabaOrder Model = JsonConvert.Deserialize<AlibabaOrder>(XmlContent);
|
|
|
|
|
if (Model.orderList == null) return Model.ToListOrderModel();
|
|
|
|
|
foreach (var item in Model.orderList)
|
|
|
|
|
{
|
|
|
|
|
if (IsReadMsg == true)
|
|
|
|
|
{
|
|
|
|
|
item.msgListNew = GetMsgData3(item.orderId.ToString(), "order_msg", out ErrorMessage);
|
|
|
|
|
//if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
// return null;
|
|
|
|
|
}
|
|
|
|
|
item.OrderState = 1;
|
|
|
|
|
// item.BuyersInfo=GetBuyers(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
item.buyerInfo = GetOrderXXInfo(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
}
|
|
|
|
|
if (Model.totalItem < 50) return Model.ToListOrderModel();
|
|
|
|
|
|
|
|
|
|
int PageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(Model.totalItem) / Convert.ToDecimal(50)));
|
|
|
|
|
for (int i = 1; i < PageCount; i++)
|
|
|
|
|
{
|
|
|
|
|
rUrl = Url + Appkey + "?access_token=" + AccessToken + "&page=" + (i + 1) + "&pageSize=50&orderStatus=WAIT_SELLER_SEND_GOODS";
|
|
|
|
|
// if (StartTime != null) rUrl += "&createDateStart=" + StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
//if (StopTime != null) rUrl += "&createDateEnd=" + StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
Dictionary<string, string> paramDic1 = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic1.Add("access_token", AccessToken);
|
|
|
|
|
paramDic1.Add("page", (i + 1).ToString());
|
|
|
|
|
paramDic1.Add("pageSize", "50");
|
|
|
|
|
paramDic1.Add("orderStatus", "WAIT_SELLER_SEND_GOODS");
|
|
|
|
|
//if (StartTime != null)
|
|
|
|
|
//paramDic1.Add("createDateStart", StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
//if (StopTime != null)
|
|
|
|
|
// paramDic1.Add("createDateEnd", StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
|
|
|
|
|
string signature1 = signPath(MethodName, paramDic1, DeveKey);
|
|
|
|
|
rUrl += "&_aop_signature=" + signature1;
|
|
|
|
|
XmlContent = CustomIO.HttpRequest(rUrl, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
AlibabaOrder Model2 = JsonConvert.Deserialize<AlibabaOrder>(XmlContent);
|
|
|
|
|
|
|
|
|
|
foreach (var item in Model2.orderList)
|
|
|
|
|
{
|
|
|
|
|
//if (item.orderId == 72860947447064)
|
|
|
|
|
//{
|
|
|
|
|
// string treqq = "72860947447064";
|
|
|
|
|
//}
|
|
|
|
|
int iscz=0; //是否已经导入过
|
|
|
|
|
|
|
|
|
|
if (OList != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var omd = OList.Find(n => n.OrderCode == item.orderId.ToString());
|
|
|
|
|
if (omd != null)
|
|
|
|
|
iscz = 1;
|
|
|
|
|
}
|
|
|
|
|
if (iscz==0&&IsReadMsg == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
item.msgListNew = GetMsgData3(item.orderId.ToString(), "order_msg", out ErrorMessage);
|
|
|
|
|
// if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
// return null;
|
|
|
|
|
}
|
|
|
|
|
// item.BuyersInfo = GetBuyers(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
if (iscz == 0)
|
|
|
|
|
{
|
|
|
|
|
item.buyerInfo = GetOrderXXInfo(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
}
|
|
|
|
|
item.OrderState = 1;
|
|
|
|
|
Model.orderList.Add(item.Copy());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Model.ToListOrderModel();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 得到待发货订单
|
|
|
|
|
public List<OrderModel> GetWaitGoods2(DateTime? StartTime, DateTime? StopTime, bool IsReadMsg, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-5))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("page", "1");
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
paramDic.Add("orderStatus", "WAIT_SELLER_SEND_GOODS");
|
|
|
|
|
if (StartTime != null)
|
|
|
|
|
paramDic.Add("createDateStart", StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
if (StopTime != null)
|
|
|
|
|
paramDic.Add("createDateEnd", StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderListQuery/" + Appkey;
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
|
|
|
|
|
string rUrl = Url + Appkey + "?access_token=" + AccessToken + "&page=1&pageSize=50&orderStatus=WAIT_SELLER_SEND_GOODS";
|
|
|
|
|
if (StartTime != null) rUrl += "&createDateStart=" + StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
if (StopTime != null) rUrl += "&createDateEnd=" + StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
rUrl += "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(rUrl, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
AlibabaOrder Model = JsonConvert.Deserialize<AlibabaOrder>(XmlContent);
|
|
|
|
|
if (Model.orderList == null) return Model.ToListOrderModel();
|
|
|
|
|
foreach (var item in Model.orderList)
|
|
|
|
|
{
|
|
|
|
|
if (IsReadMsg == true)
|
|
|
|
|
{
|
|
|
|
|
item.msgListNew = GetMsgData3(item.orderId.ToString(), "order_msg", out ErrorMessage);
|
|
|
|
|
//if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
// return null;
|
|
|
|
|
}
|
|
|
|
|
item.OrderState = 1;
|
|
|
|
|
// item.BuyersInfo=GetBuyers(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
item.buyerInfo = GetOrderXXInfo(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
}
|
|
|
|
|
if (Model.totalItem < 50) return Model.ToListOrderModel();
|
|
|
|
|
int PageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(Model.totalItem) / Convert.ToDecimal(50)));
|
|
|
|
|
for (int i = 1; i < PageCount; i++)
|
|
|
|
|
{
|
|
|
|
|
rUrl = Url + Appkey + "?access_token=" + AccessToken + "&page=" + (i + 1) + "&pageSize=50&orderStatus=WAIT_SELLER_SEND_GOODS";
|
|
|
|
|
if (StartTime != null) rUrl += "&createDateStart=" + StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
if (StopTime != null) rUrl += "&createDateEnd=" + StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss");
|
|
|
|
|
Dictionary<string, string> paramDic1 = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic1.Add("access_token", AccessToken);
|
|
|
|
|
paramDic1.Add("page", (i + 1).ToString());
|
|
|
|
|
paramDic1.Add("pageSize", "50");
|
|
|
|
|
paramDic1.Add("orderStatus", "WAIT_SELLER_SEND_GOODS");
|
|
|
|
|
if (StartTime != null)
|
|
|
|
|
paramDic1.Add("createDateStart", StartTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
if (StopTime != null)
|
|
|
|
|
paramDic1.Add("createDateEnd", StopTime.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
|
|
|
|
|
string signature1 = signPath(MethodName, paramDic1, DeveKey);
|
|
|
|
|
rUrl += "&_aop_signature=" + signature1;
|
|
|
|
|
XmlContent = CustomIO.HttpRequest(rUrl, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
AlibabaOrder Model2 = JsonConvert.Deserialize<AlibabaOrder>(XmlContent);
|
|
|
|
|
foreach (var item in Model2.orderList)
|
|
|
|
|
{
|
|
|
|
|
if (IsReadMsg == true)
|
|
|
|
|
{
|
|
|
|
|
item.msgListNew = GetMsgData3(item.orderId.ToString(), "order_msg", out ErrorMessage);
|
|
|
|
|
// if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
// return null;
|
|
|
|
|
}
|
|
|
|
|
// item.BuyersInfo = GetBuyers(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
item.buyerInfo = GetOrderXXInfo(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
item.OrderState = 1;
|
|
|
|
|
Model.orderList.Add(item.Copy());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Model.ToListOrderModel();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 付款后24小时内的订单
|
|
|
|
|
public List<OrderModel> GetPayMoneyGoods(bool IsReadMsg, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("page", "1");
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
paramDic.Add("orderStatus", "RISK_CONTROL");
|
|
|
|
|
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderListQuery/" + Appkey;
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
string rUrl = Url + Appkey + "?access_token=" + AccessToken + "&page=1&pageSize=50&orderStatus=RISK_CONTROL";
|
|
|
|
|
rUrl += "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(rUrl, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
AlibabaOrder Model = JsonConvert.Deserialize<AlibabaOrder>(XmlContent);
|
|
|
|
|
if (Model.orderList == null) return Model.ToListOrderModel();
|
|
|
|
|
foreach (var item in Model.orderList)
|
|
|
|
|
{
|
|
|
|
|
if (IsReadMsg == true)
|
|
|
|
|
{
|
|
|
|
|
item.msgListNew = GetMsgData3(item.orderId.ToString(), "order_msg", out ErrorMessage);
|
|
|
|
|
// if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
}
|
|
|
|
|
item.OrderState = 2;
|
|
|
|
|
|
|
|
|
|
//item.BuyersInfo = GetBuyers(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
item.buyerInfo = GetOrderXXInfo(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
}
|
|
|
|
|
if (Model.totalItem <= 50) return Model.ToListOrderModel();
|
|
|
|
|
int PageCount = Convert.ToInt32(Math.Ceiling(Convert.ToDecimal(Model.totalItem) / Convert.ToDecimal(50)));
|
|
|
|
|
for (int i = 1; i < PageCount; i++)
|
|
|
|
|
{
|
|
|
|
|
rUrl = Url + Appkey + "?access_token=" + AccessToken + "&page=" + (i + 1) + "&pageSize=50&orderStatus=RISK_CONTROL";
|
|
|
|
|
Dictionary<string, string> paramDic1 = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic1.Add("access_token", AccessToken);
|
|
|
|
|
paramDic1.Add("page", (i + 1).ToString());
|
|
|
|
|
paramDic1.Add("pageSize", "50");
|
|
|
|
|
paramDic1.Add("orderStatus", "RISK_CONTROL");
|
|
|
|
|
string signature1 = signPath(MethodName, paramDic1, DeveKey);
|
|
|
|
|
rUrl += "&_aop_signature=" + signature1;
|
|
|
|
|
XmlContent = CustomIO.HttpRequest(rUrl, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
AlibabaOrder Model2 = JsonConvert.Deserialize<AlibabaOrder>(XmlContent);
|
|
|
|
|
if (Model2.orderList == null) continue;
|
|
|
|
|
foreach (var item in Model2.orderList)
|
|
|
|
|
{
|
|
|
|
|
if (IsReadMsg == true)
|
|
|
|
|
{
|
|
|
|
|
item.msgListNew = GetMsgData3(item.orderId.ToString(), "order_msg", out ErrorMessage);
|
|
|
|
|
// if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
}
|
|
|
|
|
// item.BuyersInfo = GetBuyers(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
item.buyerInfo = GetOrderXXInfo(item.orderId.ToString(), out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
item.OrderState = 2;
|
|
|
|
|
Model.orderList.Add(item.Copy());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Model.ToListOrderModel();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 取得收货信息
|
|
|
|
|
public Alibaba_Buyers GetBuyers(string orderid, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderReceiptInfo/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_Buyers Model = JsonConvert.Deserialize<Alibaba_Buyers>(XmlContent);
|
|
|
|
|
return Model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 订单详情信息
|
|
|
|
|
public Alibaba_OrderXXInfo GetOrderXXInfo(string orderid, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderById/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_OrderXXInfo Model = JsonConvert.Deserialize<Alibaba_OrderXXInfo>(XmlContent);
|
|
|
|
|
return Model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单详情信息
|
|
|
|
|
public string GetOrderstr(string orderid, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderById/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = "失败 " + ErrorMessage;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 得到留言的数据
|
|
|
|
|
public List<Alibaba_MsgResult_content> GetMsgData(string orderid, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.queryOrderMsgList/" + this.Appkey + "?access_token=" + AccessToken + "&pageSize=50&orderId=" + orderid;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.queryOrderMsgList/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL += "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_MsgResult Model = JsonConvert.Deserialize<Alibaba_MsgResult>(XmlContent);
|
|
|
|
|
if (Model.total == 0) return null;
|
|
|
|
|
if (Model.msgList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var md in Model.msgList)
|
|
|
|
|
{
|
|
|
|
|
var wmd = new DT_LeavewordAPI();
|
|
|
|
|
wmd.ShopId = ShopId;
|
|
|
|
|
wmd.isRead = md.read;
|
|
|
|
|
wmd.orderId = md.orderId;
|
|
|
|
|
wmd.wId = md.id;
|
|
|
|
|
wmd.wordContent = md.content;
|
|
|
|
|
wmd.senderName = md.senderName;
|
|
|
|
|
wmd.fileUrl = md.fileUrl;
|
|
|
|
|
wmd.receiverLoginId = md.receiverLoginId;
|
|
|
|
|
wmd.senderLoginId = md.senderLoginId;
|
|
|
|
|
wmd.typeId = md.typeId;
|
|
|
|
|
DateTime wordCreate = DateTime.Now;
|
|
|
|
|
DateTime wordCreateCN = DateTime.Now;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (md.gmtCreate != "" && md.gmtCreate.Contains('-'))
|
|
|
|
|
{
|
|
|
|
|
string stime = md.gmtCreate.Split('-')[0];
|
|
|
|
|
wordCreate = Convert.ToDateTime(stime.Substring(0, 4) + "-" + stime.Substring(4, 2) + "-" + stime.Substring(6, 2) + " " + stime.Substring(8, 2) + ":" + stime.Substring(10, 2));
|
|
|
|
|
wordCreateCN = wordCreate;
|
|
|
|
|
wordCreate = wordCreate.AddHours(Convert.ToInt32(md.gmtCreate.Split('-')[1].Substring(0, 2)) * -1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (md.gmtCreate != "" && md.gmtCreate.Contains('+'))
|
|
|
|
|
{
|
|
|
|
|
string stime1 = md.gmtCreate.Split('-')[0];
|
|
|
|
|
wordCreate = Convert.ToDateTime(stime1.Substring(0, 4) + "-" + stime1.Substring(4, 2) + "-" + stime1.Substring(6, 2) + " " + stime1.Substring(8, 2) + ":" + stime1.Substring(10, 2));
|
|
|
|
|
wordCreateCN = wordCreate;
|
|
|
|
|
wordCreate = wordCreate.AddHours(Convert.ToInt32(md.gmtCreate.Split('-')[1].Substring(0, 2)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
wmd.wordCreate = wordCreate;
|
|
|
|
|
wmd.wordCreateCN = wordCreateCN;
|
|
|
|
|
wmd.indate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
SaveLeaveword(wmd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return Model.msgList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 得到留言的数据
|
|
|
|
|
public List<Alibaba_MsgResult_content> GetMsgData2(DateTime? Sdate,DateTime? Edate, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.queryOrderMsgList/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
if(Sdate!=null)
|
|
|
|
|
paramDic.Add("startTime", Sdate.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
if (Edate != null)
|
|
|
|
|
paramDic.Add("endTime", Edate.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
// paramDic.Add("orderId", orderid);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.queryOrderMsgList/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_MsgResult Model = JsonConvert.Deserialize<Alibaba_MsgResult>(XmlContent);
|
|
|
|
|
if (Model.total == 0) return null;
|
|
|
|
|
if (Model.msgList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var md in Model.msgList)
|
|
|
|
|
{
|
|
|
|
|
var wmd = new DT_LeavewordAPI();
|
|
|
|
|
wmd.ShopId = ShopId;
|
|
|
|
|
wmd.isRead = md.read;
|
|
|
|
|
wmd.orderId = md.orderId;
|
|
|
|
|
wmd.wId = md.id;
|
|
|
|
|
wmd.wordContent = md.content;
|
|
|
|
|
wmd.senderName = md.senderName;
|
|
|
|
|
wmd.fileUrl = md.fileUrl;
|
|
|
|
|
wmd.receiverLoginId = md.receiverLoginId;
|
|
|
|
|
wmd.senderLoginId = md.senderLoginId;
|
|
|
|
|
wmd.typeId = md.typeId;
|
|
|
|
|
//wmd.CompanyId = 0;
|
|
|
|
|
DateTime wordCreate = DateTime.Now;
|
|
|
|
|
DateTime wordCreateCN = DateTime.Now;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (md.gmtCreate != "" && md.gmtCreate.Contains('-'))
|
|
|
|
|
{
|
|
|
|
|
string stime = md.gmtCreate.Split('-')[0];
|
|
|
|
|
wordCreate = Convert.ToDateTime(stime.Substring(0, 4) + "-" + stime.Substring(4, 2) + "-" + stime.Substring(6, 2) + " " + stime.Substring(8, 2) + ":" + stime.Substring(10, 2));
|
|
|
|
|
wordCreateCN = wordCreate;
|
|
|
|
|
wordCreate = wordCreate.AddHours(Convert.ToInt32(md.gmtCreate.Split('-')[1].Substring(0, 2)) * -1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (md.gmtCreate != "" && md.gmtCreate.Contains('+'))
|
|
|
|
|
{
|
|
|
|
|
string stime1 = md.gmtCreate.Split('-')[0];
|
|
|
|
|
wordCreate = Convert.ToDateTime(stime1.Substring(0, 4) + "-" + stime1.Substring(4, 2) + "-" + stime1.Substring(6, 2) + " " + stime1.Substring(8, 2) + ":" + stime1.Substring(10, 2));
|
|
|
|
|
wordCreateCN = wordCreate;
|
|
|
|
|
wordCreate = wordCreate.AddHours(Convert.ToInt32(md.gmtCreate.Split('-')[1].Substring(0, 2)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
wmd.wordCreate = wordCreate;
|
|
|
|
|
wmd.wordCreateCN = wordCreateCN;
|
|
|
|
|
wmd.indate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
SaveLeaveword(wmd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return Model.msgList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 得到留言的数据
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="channelId"></param>
|
|
|
|
|
/// <param name="msgSources">(站内信)message_center/order_msg(留言)</param>
|
|
|
|
|
/// <param name="ErrorMessage"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<Alibaba_MsgContentNew> GetMsgData3(string channelId, string msgSources, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.queryMsgDetailList/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
|
|
|
|
|
paramDic.Add("currentPage", "1");
|
|
|
|
|
paramDic.Add("pageSize", "20");
|
|
|
|
|
paramDic.Add("channelId", channelId);
|
|
|
|
|
paramDic.Add("msgSources", msgSources);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.queryMsgDetailList/" + Appkey;
|
|
|
|
|
string signature = sign2(MethodName, paramDic);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_MsgResultNew Model = JsonConvert.Deserialize<Alibaba_MsgResultNew>(XmlContent);
|
|
|
|
|
if (Model == null||Model.result.Count==0) return null;
|
|
|
|
|
if (Model.result != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var md in Model.result)
|
|
|
|
|
{
|
|
|
|
|
var wmd = new DT_LeavewordAPI();
|
|
|
|
|
wmd.ShopId = ShopId;
|
|
|
|
|
// wmd.isRead = md.read;
|
|
|
|
|
// wmd.orderId = md.orderId;
|
|
|
|
|
wmd.wId = md.id;
|
|
|
|
|
wmd.wordContent = md.content;
|
|
|
|
|
wmd.senderName = md.senderName;
|
|
|
|
|
// wmd.fileUrl = md.fileUrl;
|
|
|
|
|
// wmd.receiverLoginId = md.receiverLoginId;
|
|
|
|
|
wmd.senderLoginId = md.senderName;
|
|
|
|
|
wmd.typeId = md.typeId.ToString();
|
|
|
|
|
//wmd.CompanyId = 0;
|
|
|
|
|
DateTime wordCreate = DateTime.Now;
|
|
|
|
|
DateTime wordCreateCN = DateTime.Now;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (md.gmtCreate != "" && md.gmtCreate.Contains('-'))
|
|
|
|
|
{
|
|
|
|
|
string stime = md.gmtCreate.Split('-')[0];
|
|
|
|
|
wordCreate = Convert.ToDateTime(stime.Substring(0, 4) + "-" + stime.Substring(4, 2) + "-" + stime.Substring(6, 2) + " " + stime.Substring(8, 2) + ":" + stime.Substring(10, 2));
|
|
|
|
|
wordCreateCN = wordCreate;
|
|
|
|
|
wordCreate = wordCreate.AddHours(Convert.ToInt32(md.gmtCreate.Split('-')[1].Substring(0, 2)) * -1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
if (md.gmtCreate != "" && md.gmtCreate.Contains('+'))
|
|
|
|
|
{
|
|
|
|
|
string stime1 = md.gmtCreate.Split('-')[0];
|
|
|
|
|
wordCreate = Convert.ToDateTime(stime1.Substring(0, 4) + "-" + stime1.Substring(4, 2) + "-" + stime1.Substring(6, 2) + " " + stime1.Substring(8, 2) + ":" + stime1.Substring(10, 2));
|
|
|
|
|
wordCreateCN = wordCreate;
|
|
|
|
|
wordCreate = wordCreate.AddHours(Convert.ToInt32(md.gmtCreate.Split('-')[1].Substring(0, 2)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
wmd.wordCreate = wordCreate;
|
|
|
|
|
wmd.wordCreateCN = wordCreateCN;
|
|
|
|
|
wmd.indate = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
SaveLeaveword(wmd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return Model.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 得到留言的数据
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="channelId"></param>
|
|
|
|
|
/// <param name="msgSources">(站内信)message_center/order_msg(留言)</param>
|
|
|
|
|
/// <param name="ErrorMessage"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetMsgstr(string channelId, string msgSources, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.queryMsgDetailList/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
|
|
|
|
|
paramDic.Add("currentPage", "1");
|
|
|
|
|
paramDic.Add("pageSize", "20");
|
|
|
|
|
paramDic.Add("channelId", channelId);
|
|
|
|
|
paramDic.Add("msgSources", msgSources);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.queryMsgDetailList/" + Appkey;
|
|
|
|
|
string signature = sign2(MethodName, paramDic);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage ="失败 "+ ErrorMessage;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 更新留言的状态
|
|
|
|
|
public void UpdateWordState(string typeId, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.updateReadOrderMessage/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
|
|
|
|
|
paramDic.Add("typeId", typeId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.updateReadOrderMessage/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 得到站内信数据
|
|
|
|
|
public List<Alibaba_InnerMail_content> GetInnerMail(DateTime? Sdate, DateTime? Edate, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.queryMessageList/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
if (Sdate != null)
|
|
|
|
|
paramDic.Add("startTime", Sdate.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
if (Edate != null)
|
|
|
|
|
paramDic.Add("endTime", Edate.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
// paramDic.Add("orderId", orderid);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.queryMessageList/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_InnerMailResult Model = JsonConvert.Deserialize<Alibaba_InnerMailResult>(XmlContent);
|
|
|
|
|
if (Model.total == 0) return null;
|
|
|
|
|
return Model.msgList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 更新站内信的状态
|
|
|
|
|
public void UpdateInnerMailState(string typeId, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.updateReadMessage/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
|
|
|
|
|
paramDic.Add("typeId", typeId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.updateReadMessage/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 回复留言
|
|
|
|
|
public void BackLeaveWordOld(string orderid, string content, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
paramDic.Add("content", content);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.addOrderMessage/" + Appkey;
|
|
|
|
|
// string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?orderId=" + orderid + "&content=" + content + "&access_token=" + AccessToken;
|
|
|
|
|
//foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
//{
|
|
|
|
|
// URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
//}
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 回复留言
|
|
|
|
|
public void BackLeaveWord(string channelId, string buyerId, string content, string msgSources, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("channelId", channelId);
|
|
|
|
|
paramDic.Add("buyerId", buyerId);
|
|
|
|
|
paramDic.Add("content", content);
|
|
|
|
|
paramDic.Add("msgSources", msgSources);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.addMsg/" + Appkey;
|
|
|
|
|
// string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?channelId=" + channelId + "&buyerId=" + buyerId + "&content=" + content + "&msgSources=" + msgSources + "&access_token=" + AccessToken;
|
|
|
|
|
//foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
//{
|
|
|
|
|
// URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
//}
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) ErrorMessage="失败" + ErrorMessage;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询未付款订单
|
|
|
|
|
public string NoPayOrderList(string pagenum, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("page", pagenum);
|
|
|
|
|
paramDic.Add("pageSize", "10");
|
|
|
|
|
paramDic.Add("orderStatus", "PLACE_ORDER_SUCCESS");
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderListQuery/" + Appkey;
|
|
|
|
|
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.findOrderListQuery/" + this.Appkey + "?access_token=" + AccessToken + "&pageSize=10¤tPage=" + pagenum + "&orderStatus=PLACE_ORDER_SUCCESS";
|
|
|
|
|
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "失败" + ErrorMessage;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询订单
|
|
|
|
|
public string OrderList(string pagenum, string orderStatus, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("page", pagenum);
|
|
|
|
|
paramDic.Add("pageSize", "10");
|
|
|
|
|
paramDic.Add("orderStatus", orderStatus);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findOrderListQuery/" + Appkey;
|
|
|
|
|
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.findOrderListQuery/" + this.Appkey + "?access_token=" + AccessToken + "&pageSize=10¤tPage=" + pagenum + "&orderStatus=" + orderStatus;
|
|
|
|
|
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "失败" + ErrorMessage;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 查询订单评价
|
|
|
|
|
public string FeedBackList( string pagenum, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("pageSize", "10");
|
|
|
|
|
paramDic.Add("currentPage", pagenum);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.evaluation.querySellerEvaluationOrderList/" + Appkey;
|
|
|
|
|
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.evaluation.querySellerEvaluationOrderList/" + this.Appkey + "?access_token=" + AccessToken + "&pageSize=10¤tPage=" + pagenum;
|
|
|
|
|
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "GET", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "失败" + ErrorMessage;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 订单评价提交
|
|
|
|
|
public string FeedBackWord(string orderid, string content, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
string score = "太棒了";
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
paramDic.Add("feedbackContent", content);
|
|
|
|
|
paramDic.Add("score", score);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.evaluation.saveSellerFeedback/" + Appkey;
|
|
|
|
|
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.evaluation.saveSellerFeedback/" + this.Appkey + "?access_token=" + AccessToken + "&orderId=" + orderid + "&feedbackContent=" + content + "&score=" + score;
|
|
|
|
|
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "失败" + ErrorMessage;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单收货时间延长提交
|
|
|
|
|
public string Extentday(string orderid, string day, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("orderId", orderid);
|
|
|
|
|
paramDic.Add("day", day);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.extendsBuyerAcceptGoodsTime/" + Appkey;
|
|
|
|
|
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.extendsBuyerAcceptGoodsTime/" + this.Appkey + "?access_token=" + AccessToken + "&orderId=" + orderid + "&day=" +day;
|
|
|
|
|
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "失败" + ErrorMessage;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 得到货款到账
|
|
|
|
|
public List<LoanorderList> GetOrderLoan(DateTime? Sdate, DateTime? Edate,int page,string loanStatus, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.findLoanListQuery/" + this.Appkey + "?";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
if (Sdate != null)
|
|
|
|
|
paramDic.Add("startTime", Sdate.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
if (Edate != null)
|
|
|
|
|
paramDic.Add("endTime", Edate.Value.ToString("MM/dd/yyyy HH:mm:ss"));
|
|
|
|
|
paramDic.Add("pageSize", "50");
|
|
|
|
|
paramDic.Add("loanStatus", loanStatus);//订单放款状态:wait_loan 未放款,loan_ok已放款。
|
|
|
|
|
|
|
|
|
|
paramDic.Add("page", page.ToString());
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.findLoanListQuery/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL += "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
OrderLoanList Model = JsonConvert.Deserialize<OrderLoanList>(XmlContent);
|
|
|
|
|
if (Model.totalItem == 0) return null;
|
|
|
|
|
return Model.orderList;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 发货
|
|
|
|
|
public string SendGoods(Alibaba_Order model,string sendType,out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
if (string.IsNullOrEmpty(model.tradeOrderId) == false) paramDic.Add("tradeOrderId", model.tradeOrderId);
|
|
|
|
|
if (string.IsNullOrEmpty(model.tradeOrderFrom) == false) paramDic.Add("tradeOrderFrom", model.tradeOrderFrom);
|
|
|
|
|
if (string.IsNullOrEmpty(model.warehouseCarrierService) == false) paramDic.Add("warehouseCarrierService", model.warehouseCarrierService);
|
|
|
|
|
if (string.IsNullOrEmpty(model.domesticLogisticsCompanyId) == false) paramDic.Add("domesticLogisticsCompanyId", model.domesticLogisticsCompanyId);
|
|
|
|
|
if (string.IsNullOrEmpty(model.domesticLogisticsCompany) == false) paramDic.Add("domesticLogisticsCompany", model.domesticLogisticsCompany);
|
|
|
|
|
if (string.IsNullOrEmpty(model.domesticTrackingNo) == false) paramDic.Add("domesticTrackingNo", model.domesticTrackingNo);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.createWarehouseOrder/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "";
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_Order_Result model2 = JsonConvert.Deserialize<Alibaba_Order_Result>(XmlContent);
|
|
|
|
|
OrderConfirm(model.domesticLogisticsCompany, model2.result.intlTracking, sendType, model.tradeOrderId, out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "";
|
|
|
|
|
return model2.result.intlTracking;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 根据订单号获取线上发货物流方案(运费估算)
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="orderId">交易订单ID</param>
|
|
|
|
|
/// <param name="goodsWeight">包裹重量</param>
|
|
|
|
|
/// <param name="goodsLength">包裹长</param>
|
|
|
|
|
/// <param name="goodsWidth">包裹宽</param>
|
|
|
|
|
/// <param name="goodsHeight">包裹高</param>
|
|
|
|
|
/// <param name="authenticate"></param>
|
|
|
|
|
/// <param name="ErrorMessage"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public List<Alibaba_Fee> GetFee(string orderId, decimal goodsWeight, int goodsLength, int goodsWidth, int goodsHeight, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("orderId", orderId);
|
|
|
|
|
paramDic.Add("goodsWeight", goodsWeight.ToString("0.###"));
|
|
|
|
|
paramDic.Add("goodsLength", goodsLength.ToString());
|
|
|
|
|
paramDic.Add("goodsWidth", goodsWidth.ToString());
|
|
|
|
|
paramDic.Add("goodsHeight", goodsHeight.ToString());
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.getOnlineLogisticsServiceListByOrderId/" + Appkey;
|
|
|
|
|
// string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string signature = signPath(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_Fee_Result model2 = JsonConvert.Deserialize<Alibaba_Fee_Result>(XmlContent);
|
|
|
|
|
return model2.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 发货确认
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发货确认
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="orderid">订单号</param>
|
|
|
|
|
/// <param name="mailno">运单号</param>
|
|
|
|
|
/// <param name="dealttype">1运单确认2消单</param>
|
|
|
|
|
/// <param name="ErrorMessage">错误消息</param>
|
|
|
|
|
/// <returns>true成功false失败</returns>
|
|
|
|
|
public void OrderConfirm(string serviceName, string logisticsNo, string sendType,string outRef, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("serviceName", serviceName);
|
|
|
|
|
paramDic.Add("logisticsNo", logisticsNo);
|
|
|
|
|
paramDic.Add("sendType", sendType);
|
|
|
|
|
paramDic.Add("outRef", outRef);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.sellerShipment/" + Appkey;
|
|
|
|
|
string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 列出平台所支持的物流服务
|
|
|
|
|
public List<Alibaba_Express> GetListExpress(out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string MethodName = "param2/1/aliexpress.open/api.listLogisticsService/" + Appkey;
|
|
|
|
|
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.listLogisticsService/" + Appkey + "?access_token=" + AccessToken;
|
|
|
|
|
//foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
//{
|
|
|
|
|
// URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
//}
|
|
|
|
|
string signature = signPath(MethodName,paramDic, DeveKey);
|
|
|
|
|
URL = URL + "&_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
Alibaba_Express_Result Model = JsonConvert.Deserialize<Alibaba_Express_Result>(XmlContent);
|
|
|
|
|
return Model.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
private string signPath(string urlPath, Dictionary<string, string> paramDic, string DeveKey)
|
|
|
|
|
{
|
|
|
|
|
byte[] signatureKey = Encoding.UTF8.GetBytes(DeveKey);//此处用自己的签名密钥
|
|
|
|
|
List<string> list = new List<string>();
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
list.Add(kv.Key + kv.Value);
|
|
|
|
|
}
|
|
|
|
|
list.Sort();
|
|
|
|
|
string tmp = urlPath;
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
tmp = tmp + kvstr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//HMAC-SHA1
|
|
|
|
|
HMACSHA1 hmacsha1 = new HMACSHA1(signatureKey);
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(tmp));
|
|
|
|
|
/*
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(urlPath));
|
|
|
|
|
foreach (string kvstr in list)
|
|
|
|
|
{
|
|
|
|
|
hmacsha1.ComputeHash(Encoding.UTF8.GetBytes(kvstr));
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
byte[] hash = hmacsha1.Hash;
|
|
|
|
|
//TO HEX
|
|
|
|
|
return BitConverter.ToString(hash).Replace("-", string.Empty).ToUpper();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 创建线上发货物流订单
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="tradeOrderId">交易订单号</param>
|
|
|
|
|
/// <param name="tradeOrderFrom">交易订单来源,AE订单为ESCROW ;国际站订单为“SOURCING”</param>
|
|
|
|
|
/// <param name="warehouseCarrierService">”根据订单号获取线上发货物流方案“API获取用户选择的实际发货物流服务(物流服务key,即仓库服务名称)例如:HRB_WLB_ZTOGZ是 中俄航空 Ruston广州仓库; HRB_WLB_RUSTONHEB为哈尔滨备货仓暂不支持,该渠道请做忽略</param>
|
|
|
|
|
/// <param name="domesticLogisticsCompanyId">国内快递ID505(物流公司是other时,ID为-1)</param>
|
|
|
|
|
/// <param name="domesticLogisticsCompany">物流公司Id为-1时,必填</param>
|
|
|
|
|
/// <param name="domesticTrackingNo">国内快递运单号,长度1-32</param>
|
|
|
|
|
/// <param name="declareProductDTOs">申报产品信息,列表类型,以json格式来表达。{productId为产品ID(必填,如为礼品,则设置为</param>
|
|
|
|
|
/// <param name="addressDTOs">地址信息,包含发货人地址,收货人地址.发货人地址key值是sender; 收货人地址key值是receiver,都必填{country为国家简称,必填;province为省/州,(必填,长度限制1-48字节);city为城市,(必填,长度限制1-48,可以直接填写城市信息),county为区县,(必填,长度限制1-20字节)streetAddress为街道 ,(必填,长度限制1-90字节);name为姓名,(必填,长度限制1-90字节);phone,mobile两者二选一,phone(长度限制1- 54字节);mobile(长度限制1-30字节);email邮箱必填(长度限制1-64字节);trademanageId旺旺(必填,长度限制1-32字节);如果是中俄航空Ruston需要揽收的订单,则再添加揽收地址信息,key值是pickup,字段同上,内容必须是中文(如无需揽收,则不必传pickup的值)</param>
|
|
|
|
|
/// <param name="ErrorMessage"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public warehouseService createWarehouseOrder(string tradeOrderId, string tradeOrderFrom, string warehouseCarrierService, string domesticLogisticsCompanyId, string domesticLogisticsCompany, string domesticTrackingNo, string declareProductDTOs, string addressDTOs, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
|
|
|
|
|
paramDic.Add("tradeOrderId", tradeOrderId);
|
|
|
|
|
paramDic.Add("tradeOrderFrom", tradeOrderFrom);
|
|
|
|
|
paramDic.Add("warehouseCarrierService", warehouseCarrierService);
|
|
|
|
|
paramDic.Add("domesticLogisticsCompanyId", domesticLogisticsCompanyId);
|
|
|
|
|
paramDic.Add("domesticLogisticsCompany", domesticLogisticsCompany);
|
|
|
|
|
paramDic.Add("domesticTrackingNo", domesticTrackingNo);
|
|
|
|
|
paramDic.Add("declareProductDTOs", declareProductDTOs);
|
|
|
|
|
paramDic.Add("addressDTOs", addressDTOs);
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.createWarehouseOrder/" + Appkey;
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.createWarehouseOrder/" + Appkey + "?";
|
|
|
|
|
foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
{
|
|
|
|
|
URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
}
|
|
|
|
|
URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "Get", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
warehouseList Model = JsonConvert.Deserialize<warehouseList>(XmlContent);
|
|
|
|
|
|
|
|
|
|
return Model.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 根据订单号获取线上发货物流方案
|
|
|
|
|
public List<logisticsService> getOnlineLogistics(string orderId, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("orderId", orderId);
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.getOnlineLogisticsServiceListByOrderId/" + Appkey;
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.getOnlineLogisticsServiceListByOrderId/" + Appkey + "?access_token=" + AccessToken + "&orderId=" + orderId + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "Get", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
logisticsServiceList Model = JsonConvert.Deserialize<logisticsServiceList>(XmlContent);
|
|
|
|
|
|
|
|
|
|
return Model.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取邮政小包订单信息(线上物流发货专用接口)
|
|
|
|
|
public List<logisticsOrder> getOnlineLogisticsInfo(string orderId, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
string status = "wait_warehouse_receive_goods";
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("orderId", orderId);
|
|
|
|
|
paramDic.Add("logisticsStatus", status);
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.getOnlineLogisticsInfo/" + Appkey;
|
|
|
|
|
string signature = signPath(pathurl, paramDic,DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.getOnlineLogisticsInfo/" + Appkey + "?access_token=" + AccessToken + "&orderId=" + orderId + "&_aop_signature=" + signature + "&logisticsStatus=" + status;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "Get", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
logisticsOrderList Model = JsonConvert.Deserialize<logisticsOrderList>(XmlContent);
|
|
|
|
|
|
|
|
|
|
return Model.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 获取线上发货标签
|
|
|
|
|
public string GetPrintInfo(string internationalLogisticsId, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("warehouseOrderQueryDTOs", internationalLogisticsId);
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.getPrintInfos/" + Appkey;
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.getPrintInfos/" + Appkey + "?access_token=" + AccessToken + "&warehouseOrderQueryDTOs=" + internationalLogisticsId + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
////client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
//paramDic.Add("access_token", AccessToken);
|
|
|
|
|
//string MethodName = "param2/1/aliexpress.open/api.getPrintInfo/" + Appkey;
|
|
|
|
|
//string signature = Sign(MethodName, paramDic, DeveKey);
|
|
|
|
|
//string URL = "https://gw.api.alibaba.com/openapi/" + MethodName + "?warehouseOrderQueryDTOs=" + internationalLogisticsId+"&";
|
|
|
|
|
//foreach (KeyValuePair<string, string> kv in paramDic)
|
|
|
|
|
//{
|
|
|
|
|
// URL = URL + kv.Key + "=" + kv.Value + "&";
|
|
|
|
|
//}
|
|
|
|
|
//URL = URL + "_aop_signature=" + signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "Get", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
ExpressBody Model = JsonConvert.Deserialize<ExpressBody>(XmlContent);
|
|
|
|
|
if (Model == null || Model.Body == null || Model.Body == "")
|
|
|
|
|
return "";
|
|
|
|
|
byte[] bytes = CustomIO.Base64ToBytes(Model.Body);
|
|
|
|
|
string dir=AppDomain.CurrentDomain.BaseDirectory+"ServerCookies";
|
|
|
|
|
if (System.IO.Directory.Exists(dir)==false)System.IO.Directory.CreateDirectory(dir);
|
|
|
|
|
string fname = Guid.NewGuid().ToString() + ".pdf";
|
|
|
|
|
string filePath=dir+"/"+fname;
|
|
|
|
|
CustomIO.SetOffice(filePath, bytes);
|
|
|
|
|
return fname;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 声明发货
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="orderid">订单号</param>
|
|
|
|
|
/// <param name="trackno">跟踪码</param>
|
|
|
|
|
/// <param name="ysfs">物流类型</param>
|
|
|
|
|
/// <param name="shippmark"></param>
|
|
|
|
|
/// <param name="acc"></param>
|
|
|
|
|
/// <param name="appkey"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public bool SubmitTrack(string ordercode, string trackno, string serviceName, string shippmark, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
//serviceName = "EMS_ZX_ZX_US";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (ysfs == "China Post Air Mail")
|
|
|
|
|
//{
|
|
|
|
|
// serviceName = "CPAM";
|
|
|
|
|
//}
|
|
|
|
|
//else if (ysfs == "EUB")
|
|
|
|
|
//{
|
|
|
|
|
// serviceName = "EMS_ZX_ZX_US";
|
|
|
|
|
//}
|
|
|
|
|
//if (ysfs == "XRU")
|
|
|
|
|
//{
|
|
|
|
|
// serviceName = "CPAM";
|
|
|
|
|
//}
|
|
|
|
|
//if (ysfs == "SF Express")
|
|
|
|
|
//{
|
|
|
|
|
// serviceName = "SF";
|
|
|
|
|
//}
|
|
|
|
|
//if (ysfs == "China Post OM Plus")
|
|
|
|
|
//{
|
|
|
|
|
// serviceName = "YANWEN_JYT";
|
|
|
|
|
//}
|
|
|
|
|
//if (shippmark.Contains("平邮"))
|
|
|
|
|
//{
|
|
|
|
|
// serviceName = "Other";
|
|
|
|
|
//}
|
|
|
|
|
//trackno = "123456789";
|
|
|
|
|
//orderid = "5514d9533084f21025e158d3175";
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.sellerShipment/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("serviceName", serviceName);
|
|
|
|
|
paramDic.Add("logisticsNo", trackno);
|
|
|
|
|
paramDic.Add("sendType", "all");
|
|
|
|
|
paramDic.Add("outRef", ordercode);
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.sellerShipment/" + Appkey + "?access_token=" + AccessToken + "&serviceName=" + serviceName + "&logisticsNo=" + trackno + "&sendType=all&outRef=" + ordercode + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return false;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return josn;//SaveData(josn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上传跟踪码增加网址
|
|
|
|
|
public bool SubmitTrackW(string ordercode, string trackno, string serviceName, string shippmark, string trackingWebsite, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.sellerShipment/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("serviceName", serviceName);
|
|
|
|
|
paramDic.Add("logisticsNo", trackno);
|
|
|
|
|
paramDic.Add("sendType", "all");
|
|
|
|
|
if (trackingWebsite != "" && trackingWebsite != null)
|
|
|
|
|
paramDic.Add("trackingWebsite", trackingWebsite);
|
|
|
|
|
paramDic.Add("outRef", ordercode);
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "";
|
|
|
|
|
if (trackingWebsite != ""&&trackingWebsite!=null)
|
|
|
|
|
URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.sellerShipment/" + Appkey + "?access_token=" + AccessToken + "&serviceName=" + serviceName + "&logisticsNo=" + trackno + "&sendType=all&outRef=" + ordercode + "&_aop_signature=" + signature + "&trackingWebsite=" + trackingWebsite;
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.sellerShipment/" + Appkey + "?access_token=" + AccessToken + "&serviceName=" + serviceName + "&logisticsNo=" + trackno + "&sendType=all&outRef=" + ordercode + "&_aop_signature=" + signature ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return false;
|
|
|
|
|
if (ErrorMessage.Contains("错误")) return false;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return josn;//SaveData(josn);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//上传跟踪码增加备注
|
|
|
|
|
public bool SubmitTrackD(string ordercode, string trackno, string serviceName, string shippmark, string description, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.sellerShipment/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("serviceName", serviceName);
|
|
|
|
|
paramDic.Add("logisticsNo", trackno);
|
|
|
|
|
paramDic.Add("sendType", "all");
|
|
|
|
|
paramDic.Add("description", description);
|
|
|
|
|
paramDic.Add("outRef", ordercode);
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.sellerShipment/" + Appkey + "?access_token=" + AccessToken + "&serviceName=" + serviceName + "&logisticsNo=" + trackno + "&sendType=all&outRef=" + ordercode + "&_aop_signature=" + signature + "&description=" + description;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return false;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return josn;//SaveData(josn);
|
|
|
|
|
}
|
|
|
|
|
//上传跟踪码增加网址和备注
|
|
|
|
|
public bool SubmitTrackDW(string ordercode, string trackno, string serviceName, string shippmark, string description, string trackingWebsite, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.sellerShipment/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("serviceName", serviceName);
|
|
|
|
|
paramDic.Add("logisticsNo", trackno);
|
|
|
|
|
paramDic.Add("sendType", "all");
|
|
|
|
|
paramDic.Add("description", description);
|
|
|
|
|
paramDic.Add("trackingWebsite", trackingWebsite);
|
|
|
|
|
paramDic.Add("outRef", ordercode);
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.sellerShipment/" + Appkey + "?access_token=" + AccessToken + "&serviceName=" + serviceName + "&logisticsNo=" + trackno + "&sendType=all&outRef=" + ordercode + "&_aop_signature=" + signature + "&description=" + description + "&trackingWebsite=" + trackingWebsite;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return false;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
//return josn;//SaveData(josn);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 获取中邮小包支持的国内快递公司信息
|
|
|
|
|
public List<InnerService> GetInnerCompany(out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
//client_id:app注册时,分配给app的唯一标示,又称appKey
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.qureyWlbDomesticLogisticsCompany/" + Appkey;
|
|
|
|
|
string signature = signPath(pathurl,paramDic, this.DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.qureyWlbDomesticLogisticsCompany/" + Appkey + "?access_token=" + AccessToken + "&_aop_signature=" + signature;// +signature;
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "Get", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return null;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
InnerServiceList Model = JsonConvert.Deserialize<InnerServiceList>(XmlContent);
|
|
|
|
|
|
|
|
|
|
return Model.result;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 修改tocken
|
|
|
|
|
public void UpdateShopToken()
|
|
|
|
|
{
|
|
|
|
|
string tsql = @"
|
|
|
|
|
Update [JC_Shop] set [RequestNumber]=@RequestNumber,[RefreshToken]=@RefreshToken,[AccessToken]=@AccessToken,[RefreshTokenSaveTime]=@RefreshTokenSaveTime,[AccessTokenUpdateTime]=@AccessTokenUpdateTime where ShopId=@ShopId
|
|
|
|
|
";
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
DbCommand cmd = db.GetSqlStringCommand(tsql);
|
|
|
|
|
db.AddInParameter(cmd, "@ShopId", DbType.Int32, ShopId);
|
|
|
|
|
db.AddInParameter(cmd, "@RequestNumber", DbType.Int32, RequestNum);
|
|
|
|
|
db.AddInParameter(cmd, "@RefreshToken", DbType.String, RefreshToken);
|
|
|
|
|
db.AddInParameter(cmd, "@AccessToken", DbType.String, AccessToken);
|
|
|
|
|
db.AddInParameter(cmd, "@RefreshTokenSaveTime", DbType.DateTime, RefreshTokenSaveTime);
|
|
|
|
|
db.AddInParameter(cmd, "@AccessTokenUpdateTime", DbType.DateTime, AccessTokenUpdateTime);
|
|
|
|
|
db.ExecuteNonQuery(cmd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 修改tocken
|
|
|
|
|
public void UpdateShopToken3()
|
|
|
|
|
{
|
|
|
|
|
string tsql = @"
|
|
|
|
|
Update [tb_APIToken] set AccessToken=@AccessToken where ApiIndex=@ShopId
|
|
|
|
|
";
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase("ConnectionString3");
|
|
|
|
|
DbCommand cmd = db.GetSqlStringCommand(tsql);
|
|
|
|
|
db.AddInParameter(cmd, "@ShopId", DbType.Int32, ShopId);
|
|
|
|
|
db.AddInParameter(cmd, "@RequestNumber", DbType.Int32, RequestNum);
|
|
|
|
|
db.AddInParameter(cmd, "@RefreshToken", DbType.String, RefreshToken);
|
|
|
|
|
db.AddInParameter(cmd, "@AccessToken", DbType.String, AccessToken);
|
|
|
|
|
db.AddInParameter(cmd, "@RefreshTokenSaveTime", DbType.DateTime, RefreshTokenSaveTime);
|
|
|
|
|
db.AddInParameter(cmd, "@AccessTokenUpdateTime", DbType.DateTime, AccessTokenUpdateTime);
|
|
|
|
|
db.ExecuteNonQuery(cmd);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 保存留言
|
|
|
|
|
public int SaveLeaveword(DT_LeavewordAPI Model)
|
|
|
|
|
{
|
|
|
|
|
string tsql = @"
|
|
|
|
|
select @Id=Id from DT_Leaveword where wId=@wId
|
|
|
|
|
if @Id>0
|
|
|
|
|
begin
|
|
|
|
|
if @isRead=1
|
|
|
|
|
begin
|
|
|
|
|
Update [DT_Leaveword] set [isRead]=@isRead,readdate=getdate() where Id=@Id
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
INSERT INTO [DT_Leaveword]([wordContent],[orderId],[isRead],[senderName],[senderLoginId],[receiverLoginId],[fileUrl],[wordCreate],[wordCreateCN],[wId],[typeId],[indate],ShopId)values(@wordContent,@orderId,@isRead,@senderName,@senderLoginId,@receiverLoginId,@fileUrl,@wordCreate,@wordCreateCN,@wId,@typeId,@indate,@ShopId)
|
|
|
|
|
set @Id=SCOPE_IDENTITY()
|
|
|
|
|
end
|
|
|
|
|
select @Id";
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
DbCommand cmd = db.GetSqlStringCommand(tsql);
|
|
|
|
|
db.AddInParameter(cmd, "@Id", DbType.Int32, Model.Id);
|
|
|
|
|
db.AddInParameter(cmd, "@wordContent", DbType.String, Model.wordContent);
|
|
|
|
|
db.AddInParameter(cmd, "@orderId", DbType.String, Model.orderId);
|
|
|
|
|
db.AddInParameter(cmd, "@isRead", DbType.Boolean, Model.isRead);
|
|
|
|
|
db.AddInParameter(cmd, "@senderName", DbType.String, Model.senderName);
|
|
|
|
|
db.AddInParameter(cmd, "@senderLoginId", DbType.String, Model.senderLoginId);
|
|
|
|
|
db.AddInParameter(cmd, "@receiverLoginId", DbType.String, Model.receiverLoginId);
|
|
|
|
|
db.AddInParameter(cmd, "@fileUrl", DbType.String, Model.fileUrl);
|
|
|
|
|
db.AddInParameter(cmd, "@wordCreate", DbType.DateTime, Model.wordCreate);
|
|
|
|
|
db.AddInParameter(cmd, "@wordCreateCN", DbType.DateTime, Model.wordCreateCN);
|
|
|
|
|
db.AddInParameter(cmd, "@wId", DbType.Int64, Model.wId);
|
|
|
|
|
db.AddInParameter(cmd, "@typeId", DbType.String, Model.typeId);
|
|
|
|
|
db.AddInParameter(cmd, "@indate", DbType.DateTime, Model.indate);
|
|
|
|
|
db.AddInParameter(cmd, "@ShopId", DbType.Int32, Model.ShopId);
|
|
|
|
|
int a = Convert.ToInt32(db.ExecuteScalar(cmd));
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 保存站内信
|
|
|
|
|
public int SaveInnerMail(DT_InnerMailAPI Model)
|
|
|
|
|
{
|
|
|
|
|
string tsql = @"
|
|
|
|
|
select @Id=Id from DT_InnerMail where wId=@wId
|
|
|
|
|
if @Id>0
|
|
|
|
|
begin
|
|
|
|
|
if @isRead=1
|
|
|
|
|
begin
|
|
|
|
|
Update [DT_InnerMail] set [isRead]=@isRead where Id=@Id
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
begin
|
|
|
|
|
INSERT INTO [DT_InnerMail]([wordContent],[orderId],[isRead],[senderName],[senderLoginId],[receiverLoginId],[fileUrl],[wordCreate],[wId],[typeId])values(@wordContent,@orderId,@isRead,@senderName,@senderLoginId,@receiverLoginId,@fileUrl,@wordCreate,@wId,@typeId)
|
|
|
|
|
set @Id=SCOPE_IDENTITY()
|
|
|
|
|
end
|
|
|
|
|
select @Id";
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
DbCommand cmd = db.GetSqlStringCommand(tsql);
|
|
|
|
|
db.AddInParameter(cmd, "@Id", DbType.Int32, Model.Id);
|
|
|
|
|
db.AddInParameter(cmd, "@wordContent", DbType.String, Model.wordContent);
|
|
|
|
|
db.AddInParameter(cmd, "@orderId", DbType.String, Model.orderId);
|
|
|
|
|
db.AddInParameter(cmd, "@isRead", DbType.Boolean, Model.isRead);
|
|
|
|
|
db.AddInParameter(cmd, "@senderName", DbType.String, Model.senderName);
|
|
|
|
|
db.AddInParameter(cmd, "@senderLoginId", DbType.String, Model.senderLoginId);
|
|
|
|
|
db.AddInParameter(cmd, "@receiverLoginId", DbType.String, Model.receiverLoginId);
|
|
|
|
|
db.AddInParameter(cmd, "@fileUrl", DbType.String, Model.fileUrl);
|
|
|
|
|
db.AddInParameter(cmd, "@wordCreate", DbType.DateTime, Model.wordCreate);
|
|
|
|
|
db.AddInParameter(cmd, "@wId", DbType.Int32, Model.wId);
|
|
|
|
|
db.AddInParameter(cmd, "@typeId", DbType.String, Model.typeId);
|
|
|
|
|
int a = Convert.ToInt32(db.ExecuteScalar(cmd));
|
|
|
|
|
return a;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 产品
|
|
|
|
|
//产品上架
|
|
|
|
|
public bool OnlineProduct(string productIds, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
// if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value <DateTime.Now.AddHours(-9))
|
|
|
|
|
//{
|
|
|
|
|
GetAccessToken21(out ErrorMessage);
|
|
|
|
|
// }
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.onlineAeProduct/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("productIds", productIds);
|
|
|
|
|
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.onlineAeProduct/" + Appkey + "?access_token=" + AccessToken + "&productIds=" + productIds + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false)
|
|
|
|
|
{
|
|
|
|
|
if (ErrorMessage.Contains("未经授权") && Num<3)
|
|
|
|
|
{
|
|
|
|
|
OnlineProduct(productIds, out ErrorMessage);
|
|
|
|
|
Num++;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//产品下架
|
|
|
|
|
public bool OfflineProduct(string productIds, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
//if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
//{
|
|
|
|
|
GetAccessToken21(out ErrorMessage);
|
|
|
|
|
//}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.offlineAeProduct/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("productIds", productIds);
|
|
|
|
|
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.offlineAeProduct/" + Appkey + "?access_token=" + AccessToken + "&productIds=" + productIds + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return false;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//产品设置橱窗
|
|
|
|
|
public bool setShopwindowProduct(string productIdList, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.setShopwindowProduct/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("productIdList", productIdList);
|
|
|
|
|
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.setShopwindowProduct/" + Appkey + "?access_token=" + AccessToken + "&productIdList=" + productIdList + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return false;
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 纠纷
|
|
|
|
|
//查询纠纷列表
|
|
|
|
|
public string GetQueryIssueList(int currentPage, string issueStatus, out string ErrorMessage)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(RefreshToken) == true || RefreshTokenSaveTime == null || RefreshTokenSaveTime.Value.AddDays(180) < DateTime.Now.AddDays(-25))
|
|
|
|
|
{
|
|
|
|
|
GetRefreshToken(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
if (AccessTokenUpdateTime == null || AccessTokenUpdateTime.Value < DateTime.Now.AddHours(-9))
|
|
|
|
|
{
|
|
|
|
|
GetAccessToken2(out ErrorMessage);
|
|
|
|
|
}
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string pathurl = "param2/1/aliexpress.open/api.queryIssueList/" + Appkey;
|
|
|
|
|
Dictionary<string, string> paramDic = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
|
paramDic.Add("access_token", AccessToken);
|
|
|
|
|
paramDic.Add("currentPage", currentPage.ToString());
|
|
|
|
|
string tempStatus = "";
|
|
|
|
|
if(issueStatus!="")
|
|
|
|
|
{
|
|
|
|
|
paramDic.Add("issueStatus", issueStatus);
|
|
|
|
|
tempStatus = "&issueStatus=" + issueStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
string signature = signPath(pathurl, paramDic, DeveKey);
|
|
|
|
|
string URL = "https://gw.api.alibaba.com/openapi/param2/1/aliexpress.open/api.queryIssueList/" + Appkey + "?access_token=" + AccessToken + "¤tPage=" + currentPage + tempStatus + "&_aop_signature=" + signature;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string XmlContent = CustomIO.HttpRequest(URL, "POST", out ErrorMessage);
|
|
|
|
|
if (string.IsNullOrEmpty(ErrorMessage) == false) return "";
|
|
|
|
|
RequestNum++;
|
|
|
|
|
return XmlContent;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
ErrorMessage = ex.Message;
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
public class DT_LeavewordAPI
|
|
|
|
|
{
|
|
|
|
|
public Int32? Id { get; set; }
|
|
|
|
|
public Int32? Oid { get; set; }
|
|
|
|
|
public String wordContent { get; set; }
|
|
|
|
|
public String orderId { get; set; }
|
|
|
|
|
public Boolean? isRead { get; set; }
|
|
|
|
|
public String senderName { get; set; }
|
|
|
|
|
public String senderLoginId { get; set; }
|
|
|
|
|
public String receiverLoginId { get; set; }
|
|
|
|
|
public String fileUrl { get; set; }
|
|
|
|
|
public DateTime? wordCreate { get; set; }
|
|
|
|
|
public DateTime? wordCreateCN { get; set; }
|
|
|
|
|
public Int64 wId { get; set; }
|
|
|
|
|
public String typeId { get; set; }
|
|
|
|
|
public DateTime? indate { get; set; }
|
|
|
|
|
public Int32? CompanyId { get; set; }
|
|
|
|
|
public Boolean? isBack { get; set; }
|
|
|
|
|
public Int32? ShopId { get; set; }
|
|
|
|
|
public String readimg { get; set; }
|
|
|
|
|
public String readstate { get; set; }
|
|
|
|
|
public String backstate { get; set; }
|
|
|
|
|
public String ShopName { get; set; }
|
|
|
|
|
public String StateName { get; set; }
|
|
|
|
|
public String CountryName { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class DT_InnerMailAPI
|
|
|
|
|
{
|
|
|
|
|
public Int32? Id { get; set; }
|
|
|
|
|
public String wordContent { get; set; }
|
|
|
|
|
public String orderId { get; set; }
|
|
|
|
|
public Boolean? isRead { get; set; }
|
|
|
|
|
public String senderName { get; set; }
|
|
|
|
|
public String senderLoginId { get; set; }
|
|
|
|
|
public String receiverLoginId { get; set; }
|
|
|
|
|
public String fileUrl { get; set; }
|
|
|
|
|
public DateTime? wordCreate { get; set; }
|
|
|
|
|
public Int64 wId { get; set; }
|
|
|
|
|
public String typeId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 订单总数
|
|
|
|
|
public class AlibabaOrder
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单总数
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int totalItem { get; set; }
|
|
|
|
|
public List<Alibaba_orderList> orderList { get; set; }
|
|
|
|
|
|
|
|
|
|
public List<OrderModel> ToListOrderModel()
|
|
|
|
|
{
|
|
|
|
|
if (orderList == null) return null;
|
|
|
|
|
List<OrderModel> ListModel = new List<OrderModel>();
|
|
|
|
|
foreach (var item in orderList)
|
|
|
|
|
{
|
|
|
|
|
OrderModel model = item.ToOrderModel();
|
|
|
|
|
|
|
|
|
|
ListModel.Add(model);
|
|
|
|
|
}
|
|
|
|
|
return ListModel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 订单汇总
|
|
|
|
|
public class Alibaba_orderList
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 贷款金额
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Alibaba_loanAmount loanAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 计单明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<Alibaba_product> productList { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 纠纷状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string issueStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 冻结状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string frozenStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 买家登录ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string buyerLoginId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 卖家全名
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerSignerFullname { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 未知
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool hasRequestLoan { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long orderId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 支付金额
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Alibaba_loanAmount payAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单创建
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string gmtCreate { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string orderStatus { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Int32? OrderState { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 买家全名
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string buyerSignerFullname { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 超时剩余时间(毫秒),按当前时间计算
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long timeoutLeftTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 资金状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string fundStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string bizType { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 支付时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string gmtPayTime { get; set; }
|
|
|
|
|
public List<Alibaba_MsgResult_content> msgList { get; set; }
|
|
|
|
|
public List<Alibaba_MsgContentNew> msgListNew { get; set; }
|
|
|
|
|
public Alibaba_Buyers BuyersInfo { get; set; }
|
|
|
|
|
public Alibaba_OrderXXInfo buyerInfo { get; set; }
|
|
|
|
|
|
|
|
|
|
public Alibaba_orderList Copy()
|
|
|
|
|
{
|
|
|
|
|
Alibaba_orderList Model = new Alibaba_orderList();
|
|
|
|
|
Model.loanAmount = loanAmount;
|
|
|
|
|
Model.productList = productList;
|
|
|
|
|
Model.issueStatus = issueStatus;
|
|
|
|
|
Model.frozenStatus = frozenStatus;
|
|
|
|
|
Model.buyerLoginId = buyerLoginId;
|
|
|
|
|
Model.sellerSignerFullname = sellerSignerFullname;
|
|
|
|
|
Model.hasRequestLoan = hasRequestLoan;
|
|
|
|
|
Model.orderId = orderId;
|
|
|
|
|
Model.payAmount = payAmount;
|
|
|
|
|
Model.gmtCreate = gmtCreate;
|
|
|
|
|
Model.orderStatus = orderStatus;
|
|
|
|
|
Model.buyerSignerFullname = buyerSignerFullname;
|
|
|
|
|
Model.timeoutLeftTime = timeoutLeftTime;
|
|
|
|
|
Model.fundStatus = fundStatus;
|
|
|
|
|
Model.bizType = bizType;
|
|
|
|
|
Model.gmtPayTime = gmtPayTime;
|
|
|
|
|
Model.msgList = msgList;
|
|
|
|
|
Model.BuyersInfo = BuyersInfo;
|
|
|
|
|
Model.buyerInfo = buyerInfo;
|
|
|
|
|
Model.msgListNew = msgListNew;
|
|
|
|
|
return Model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DateTime getCreateDate()
|
|
|
|
|
{
|
|
|
|
|
//20130307164931000+0800
|
|
|
|
|
string dt = this.gmtCreate.Insert(12, ":").Insert(10, ":").Insert(8, " ").Insert(6, "-").Insert(4, "-").Substring(0, 19);
|
|
|
|
|
return Convert.ToDateTime(dt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DateTime getPayTime()
|
|
|
|
|
{
|
|
|
|
|
//20130307164931000+0800
|
|
|
|
|
string dt = this.gmtPayTime.Insert(12, ":").Insert(10, ":").Insert(8, " ").Insert(6, "-").Insert(4, "-").Substring(0, 19);
|
|
|
|
|
return Convert.ToDateTime(dt);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DateTime getOutTime()
|
|
|
|
|
{
|
|
|
|
|
if (this.timeoutLeftTime / 1000 <= 172800)
|
|
|
|
|
return DateTime.Now.AddDays(7);
|
|
|
|
|
|
|
|
|
|
return DateTime.Now.AddSeconds(this.timeoutLeftTime / 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 转换成统一的订单对象
|
|
|
|
|
public OrderModel ToOrderModel()
|
|
|
|
|
{
|
|
|
|
|
OrderModel model = new OrderModel();
|
|
|
|
|
//if (this.orderId.ToString() == "72860947447064")
|
|
|
|
|
//{
|
|
|
|
|
// string treqq = "72860947447064";
|
|
|
|
|
//}
|
|
|
|
|
model.OrderCode = this.orderId.ToString();
|
|
|
|
|
model.TotalPrice = this.payAmount.amount;
|
|
|
|
|
model.MoneyCode = this.payAmount.currencyCode;
|
|
|
|
|
model.OrderDate = this.getCreateDate();
|
|
|
|
|
model.BuyerID = this.buyerSignerFullname;
|
|
|
|
|
if (model.BuyerID.Length > 50) model.BuyerID = model.BuyerID.Substring(0,50);
|
|
|
|
|
model.OrderState = this.OrderState;
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerName = this.buyerInfo.receiptAddress.contactPerson;
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerCountry = this.buyerInfo.receiptAddress.country;
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerAddr = this.buyerInfo.receiptAddress.detailAddress;
|
|
|
|
|
if (this.buyerInfo != null && string.IsNullOrEmpty(this.buyerInfo.receiptAddress.address2) == false) model.BuyerAddr += "," + this.buyerInfo.receiptAddress.address2;
|
|
|
|
|
model.BuyerPhone = "";
|
|
|
|
|
if (this.buyerInfo != null && this.buyerInfo.receiptAddress.phoneCountry != null)
|
|
|
|
|
model.BuyerPhone = this.buyerInfo.receiptAddress.phoneCountry + "-";
|
|
|
|
|
if (this.buyerInfo != null && this.buyerInfo.receiptAddress.phoneArea != null)
|
|
|
|
|
model.BuyerPhone += this.buyerInfo.receiptAddress.phoneArea + "-";
|
|
|
|
|
if (this.buyerInfo != null && this.buyerInfo.receiptAddress.phoneNumber != null)
|
|
|
|
|
model.BuyerPhone +=this.buyerInfo.receiptAddress.phoneNumber;
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerMobile = this.buyerInfo.receiptAddress.mobileNo;
|
|
|
|
|
if (this.buyerInfo != null && this.buyerInfo.buyerInfo !=null&& this.buyerInfo.buyerInfo.email != null)
|
|
|
|
|
model.BuyerMail = this.buyerInfo.buyerInfo.email;
|
|
|
|
|
//model.logisticsAmount = this.buyerInfo.logisticsAmount;
|
|
|
|
|
// model.escrowFee = this.buyerInfo.escrowFee;
|
|
|
|
|
|
|
|
|
|
model.BuyerFax = "";
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerZip = this.buyerInfo.receiptAddress.zip;
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerProvince = this.buyerInfo.receiptAddress.province;
|
|
|
|
|
if (this.buyerInfo != null)
|
|
|
|
|
model.BuyerCity = this.buyerInfo.receiptAddress.city;
|
|
|
|
|
model.BuyerArea = "";
|
|
|
|
|
model.OrderRemark = ""; //memo
|
|
|
|
|
model.LeaveWord = "";
|
|
|
|
|
if (this.msgListNew != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item2 in this.msgListNew)
|
|
|
|
|
{
|
|
|
|
|
model.LeaveWord += item2.content + System.Environment.NewLine;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
model.PayDate = this.getPayTime();
|
|
|
|
|
model.OutOrderDate = this.getOutTime();
|
|
|
|
|
if (this.productList != null) model.PostInfo = this.productList[0].logisticsServiceName;
|
|
|
|
|
model.ListModel = new List<OrderDetailModel>();
|
|
|
|
|
//Alibaba_productAttributes pmd = null;
|
|
|
|
|
//if (this.buyerInfo != null&&this.buyerInfo.childOrderList!=null)
|
|
|
|
|
// {
|
|
|
|
|
// if (this.buyerInfo.childOrderList.productAttributes != null && this.buyerInfo.childOrderList.productAttributes != "")
|
|
|
|
|
// {
|
|
|
|
|
// JavaScriptSerializer JsonConvert = new JavaScriptSerializer();
|
|
|
|
|
|
|
|
|
|
// pmd = JsonConvert.Deserialize<Alibaba_productAttributes>(this.buyerInfo.childOrderList.productAttributes);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if (this.productList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item2 in this.productList)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(item2.memo) == false) model.OrderRemark += item2.memo + System.Environment.NewLine;
|
|
|
|
|
OrderDetailModel model2 = new OrderDetailModel();
|
|
|
|
|
string GoodsDesc = "";
|
|
|
|
|
if (this.buyerInfo != null && this.buyerInfo.childOrderList != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var pmd in this.buyerInfo.childOrderList)
|
|
|
|
|
{
|
|
|
|
|
if (pmd.productId == item2.productId)
|
|
|
|
|
{
|
|
|
|
|
JavaScriptSerializer JsonConvert = new JavaScriptSerializer();
|
|
|
|
|
Alibaba_productAttributes psku = null;
|
|
|
|
|
psku = JsonConvert.Deserialize<Alibaba_productAttributes>(pmd.productAttributes);
|
|
|
|
|
if (psku != null && psku.sku != null && psku.sku.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
string pName = psku.sku[0].pName.Trim();
|
|
|
|
|
string pValue = psku.sku[0].pValue.Trim();
|
|
|
|
|
|
|
|
|
|
if (psku.sku[0].selfDefineValue.ToString() != "")
|
|
|
|
|
pValue = psku.sku[0].selfDefineValue;
|
|
|
|
|
|
|
|
|
|
GoodsDesc += pName + ":" + pValue;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (psku != null && psku.sku != null && psku.sku.Count > 1)
|
|
|
|
|
{
|
|
|
|
|
string pName = psku.sku[1].pName.Trim();
|
|
|
|
|
string pValue = psku.sku[1].pValue.Trim();
|
|
|
|
|
|
|
|
|
|
GoodsDesc += " " + pName + ":" + pValue;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
model2.TypeDesc = GoodsDesc;
|
|
|
|
|
model2.productImgUrl = item2.productImgUrl;
|
|
|
|
|
model2.GoodsNum = item2.productCount;
|
|
|
|
|
model2.GoodsPrice = item2.productUnitPrice.amount;
|
|
|
|
|
model2.MoneyCode = item2.productUnitPrice.currencyCode;
|
|
|
|
|
model2.GoodsName = item2.productName;
|
|
|
|
|
model2.GoodsSKU = item2.skuCode;
|
|
|
|
|
model2.PostInfo = item2.logisticsServiceName;
|
|
|
|
|
model.ListModel.Add(model2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return model;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
public class Alibaba_OrderXXInfo
|
|
|
|
|
{ /// <summary>
|
|
|
|
|
/// 物流金额
|
|
|
|
|
/// </summary>
|
|
|
|
|
//public Decimal? logisticsAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 交易用金
|
|
|
|
|
/// </summary>
|
|
|
|
|
//public Decimal? escrowFee { get; set; }
|
|
|
|
|
public Alibaba_BuyInfo buyerInfo { get; set; }
|
|
|
|
|
|
|
|
|
|
public Alibaba_Addr receiptAddress { get; set; }
|
|
|
|
|
public List<Alibaba_ChildOrder> childOrderList { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 订单地址信息
|
|
|
|
|
public class Alibaba_Addr
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public string zip { get; set; }
|
|
|
|
|
public string phoneNumber { get; set; }
|
|
|
|
|
public string province { get; set; }
|
|
|
|
|
public string address2 { get; set; }
|
|
|
|
|
public string phoneArea { get; set; }
|
|
|
|
|
public string phoneCountry { get; set; }
|
|
|
|
|
public string contactPerson { get; set; }
|
|
|
|
|
public string mobileNo { get; set; }
|
|
|
|
|
public string city { get; set; }
|
|
|
|
|
public string country { get; set; }
|
|
|
|
|
public string detailAddress { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单子信息
|
|
|
|
|
public class Alibaba_ChildOrder
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string productAttributes { get; set; }
|
|
|
|
|
public long productId { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 属性信息
|
|
|
|
|
public class Alibaba_productAttributes
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<Alibaba_SKU> sku { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 属性信息
|
|
|
|
|
public class Alibaba_SKU
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public string pName { get; set; }
|
|
|
|
|
public string pValue { get; set; }
|
|
|
|
|
public string selfDefineValue { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 订单买家信息
|
|
|
|
|
public class Alibaba_BuyInfo
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public string lastName { get; set; }
|
|
|
|
|
public string loginId { get; set; }
|
|
|
|
|
public string email { get; set; }
|
|
|
|
|
public string firstName { get; set; }
|
|
|
|
|
public string country { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 订单明细
|
|
|
|
|
public class Alibaba_product
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long childId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 备货时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long goodsPrepareTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流金额
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Alibaba_loanAmount logisticsAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单备注
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string memo { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 卖家FirstName
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerSignerFirstName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 总产品数量
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Alibaba_loanAmount totalProductAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 限时达
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string freightCommitDay { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 子订单是否能提交纠纷
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool canSubmitIssue { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品单位
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string productUnit { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 纠纷状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string issueStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流类型
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string logisticsType { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long orderId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string logisticsServiceName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 子订单状态
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sonOrderStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品镜像链接
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string productSnapUrl { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 假一赔三
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool moneyBack3x { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// sku码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string skuCode { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long productId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品数量
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int productCount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 妥投时间
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string deliveryTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品单位价格
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Alibaba_loanAmount productUnitPrice { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 卖家LastName
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerSignerLastName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品图片链接
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string productImgUrl { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 未知,文档中不存在
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string showStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 产品名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string productName { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 订单总金额
|
|
|
|
|
public class Alibaba_loanAmount
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单总金额
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal amount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 订单总金额(分)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int cent { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货币代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string currencyCode { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分的定义,1块除100
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int centFactor { get; set; }
|
|
|
|
|
public Alibaba_currency currency { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 货币
|
|
|
|
|
public class Alibaba_currency
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 小数位
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int defaultFractionDigits { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货币符号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string symbol { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 货币代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string currencyCode { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 留言
|
|
|
|
|
public class Alibaba_MsgResult
|
|
|
|
|
{
|
|
|
|
|
public int total { get; set; }
|
|
|
|
|
public bool success { get; set; }
|
|
|
|
|
public List<Alibaba_MsgResult_content> msgList { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 留言内容
|
|
|
|
|
public class Alibaba_MsgResult_content
|
|
|
|
|
{
|
|
|
|
|
public Int64 id { get; set; }
|
|
|
|
|
public string content { get; set; }
|
|
|
|
|
public string orderId { get; set; }
|
|
|
|
|
public string typeId { get; set; }
|
|
|
|
|
public Boolean? read { get; set; }
|
|
|
|
|
public string senderName { get; set; }
|
|
|
|
|
public string senderLoginId { get; set; }
|
|
|
|
|
public string receiverLoginId { get; set; }
|
|
|
|
|
public string fileUrl { get; set; }
|
|
|
|
|
public string gmtCreate { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 留言新
|
|
|
|
|
public class Alibaba_MsgResultNew
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public List<Alibaba_MsgContentNew> result { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 留言内容新
|
|
|
|
|
public class Alibaba_MsgContentNew
|
|
|
|
|
{
|
|
|
|
|
public Int64 id { get; set; }
|
|
|
|
|
public string senderName { get; set; }
|
|
|
|
|
public string content { get; set; }
|
|
|
|
|
public string gmtCreate { get; set; }
|
|
|
|
|
public string typeId { get; set; }
|
|
|
|
|
// public string filePath { get; set; }
|
|
|
|
|
public string messageType { get; set; }
|
|
|
|
|
public Alibaba_MsgResult_summary summary { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 留言内容新
|
|
|
|
|
public class Alibaba_MsgResult_summary
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public string senderName { get; set; }
|
|
|
|
|
public string orderUrl { get; set; }
|
|
|
|
|
public string receiverName { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 站内信
|
|
|
|
|
public class Alibaba_InnerMailResult
|
|
|
|
|
{
|
|
|
|
|
public int total { get; set; }
|
|
|
|
|
public bool success { get; set; }
|
|
|
|
|
public List<Alibaba_InnerMail_content> msgList { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 站内信内容
|
|
|
|
|
public class Alibaba_InnerMail_content
|
|
|
|
|
{
|
|
|
|
|
public Int64 id { get; set; }
|
|
|
|
|
public string content { get; set; }
|
|
|
|
|
public string orderId { get; set; }
|
|
|
|
|
public Boolean? read { get; set; }
|
|
|
|
|
public string senderName { get; set; }
|
|
|
|
|
public string senderLoginId { get; set; }
|
|
|
|
|
public string receiverLoginId { get; set; }
|
|
|
|
|
public string fileUrl { get; set; }
|
|
|
|
|
public string relationId { get; set; }
|
|
|
|
|
public string gmtCreate { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 收货信息
|
|
|
|
|
public class Alibaba_Buyers
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 邮编
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string zip { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 地址2
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string address2 { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 详细地址
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string detailAddress { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国家
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string country { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 城市
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string city { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电话号码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string phoneNumber { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 州
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string province { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 电话区号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string phoneArea { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国家区号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string phoneCountry { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 收件人
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string contactPerson { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 手机号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string mobileNo { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 发货订单
|
|
|
|
|
public class Alibaba_Order
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 交易订单号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string tradeOrderId{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 交易订单来源,AE订单为ESCROW ;国际站订单为“SOURCING”
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string tradeOrderFrom{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据订单号获取线上发货物流方案“API获取用户选择的实际发货物流服务(物流服务key,即仓库服务名称)例如:HRB_WLB_ZTOGZ是 中俄航空 Ruston广州仓库; HRB_WLB_RUSTONHEB为哈尔滨备货仓暂不支持,该渠道请做忽略。
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string warehouseCarrierService{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国内快递ID
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string domesticLogisticsCompanyId{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国内快递公司名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string domesticLogisticsCompany{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国内快递运单号,长度1-32
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string domesticTrackingNo{get;set;}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 发货订单结果
|
|
|
|
|
public class Alibaba_Order_Result
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否成功
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool success{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 结果
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Alibaba_Order_Result_Detail result{get;set;}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 发货订单结果明细
|
|
|
|
|
public class Alibaba_Order_Result_Detail
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流订单号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string warehouseOrderId{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 国际运单号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string intlTracking{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 关联的交易订单号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string tradeOrderId{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 交易订单来源
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string tradeOrderFrom{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否创建成功
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool success{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 错误代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string errorCode{get;set;}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 运费估算
|
|
|
|
|
public class Alibaba_Fee_Result
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否成功
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool success { get; set; }
|
|
|
|
|
public List<Alibaba_Fee> result { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class Alibaba_Fee
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string logisticsServiceName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 币种
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string trialResult { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 时效
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string logisticsTimeliness { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string logisticsServiceId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 估算费用货币代码
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string currencyCode { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 估算费用
|
|
|
|
|
/// </summary>
|
|
|
|
|
public decimal fee { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 仓库地址
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string deliveryAddress { get; set; }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 物流服务
|
|
|
|
|
public class Alibaba_Express_Result
|
|
|
|
|
{
|
|
|
|
|
public List<Alibaba_Express> result{get;set;}
|
|
|
|
|
}
|
|
|
|
|
public class Alibaba_Express
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流公司名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string logisticsCompany{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流服务显示名称
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string displayName{get;set;}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 物流服务key
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string serviceName{get;set;}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ExpressBody
|
|
|
|
|
{
|
|
|
|
|
public string Body { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class logisticsServiceList
|
|
|
|
|
{
|
|
|
|
|
public List<logisticsService> result { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class logisticsService
|
|
|
|
|
{
|
|
|
|
|
public string logisticsServiceName { get; set; }
|
|
|
|
|
public string trialResult { get; set; }
|
|
|
|
|
public string logisticsTimeliness { get; set; }
|
|
|
|
|
public string logisticsServiceId { get; set; }
|
|
|
|
|
|
|
|
|
|
public string deliveryAddress { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class logisticsOrderList
|
|
|
|
|
{
|
|
|
|
|
public List<logisticsOrder> result { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class logisticsOrder
|
|
|
|
|
{
|
|
|
|
|
public string logisticsStatus { get; set; }
|
|
|
|
|
public string internationalLogisticsType { get; set; }
|
|
|
|
|
public string internationallogisticsId { get; set; }
|
|
|
|
|
public string orderId { get; set; }
|
|
|
|
|
|
|
|
|
|
public string onlineLogisticsId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class InnerServiceList
|
|
|
|
|
{
|
|
|
|
|
public List<InnerService> result { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class InnerService
|
|
|
|
|
{
|
|
|
|
|
public string name { get; set; }
|
|
|
|
|
public string companyId { get; set; }
|
|
|
|
|
public string companyCode { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class warehouseList
|
|
|
|
|
{
|
|
|
|
|
public warehouseService result { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class addressDTOs
|
|
|
|
|
{
|
|
|
|
|
public receiverClass receiver { get; set; }
|
|
|
|
|
public senderClass sender { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class warehouseService
|
|
|
|
|
{
|
|
|
|
|
public string warehouseOrderId { get; set; }
|
|
|
|
|
public string intlTracking { get; set; }
|
|
|
|
|
public string tradeOrderId { get; set; }
|
|
|
|
|
public string errorCode { get; set; }
|
|
|
|
|
public string tradeOrderFrom { get; set; }
|
|
|
|
|
|
|
|
|
|
public string success { get; set; }
|
|
|
|
|
|
|
|
|
|
public string errorDesc{ get; set; }
|
|
|
|
|
|
|
|
|
|
public string outOrderId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class receiverClass
|
|
|
|
|
{
|
|
|
|
|
public string city { get; set; }
|
|
|
|
|
public string country { get; set; }
|
|
|
|
|
public string fax { get; set; }
|
|
|
|
|
public string mobile { get; set; }
|
|
|
|
|
public string name { get; set; }
|
|
|
|
|
public string phone { get; set; }
|
|
|
|
|
public string postcode { get; set; }
|
|
|
|
|
public string province { get; set; }
|
|
|
|
|
public string streetAddress { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class senderClass
|
|
|
|
|
{
|
|
|
|
|
public string city { get; set; }
|
|
|
|
|
public string country { get; set; }
|
|
|
|
|
public string fax { get; set; }
|
|
|
|
|
public string mobile { get; set; }
|
|
|
|
|
public string name { get; set; }
|
|
|
|
|
public string phone { get; set; }
|
|
|
|
|
public string postcode { get; set; }
|
|
|
|
|
public string province { get; set; }
|
|
|
|
|
public string streetAddress { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class declareProductDTOs
|
|
|
|
|
{
|
|
|
|
|
public string categoryCnDesc { get; set; }
|
|
|
|
|
public string categoryEnDesc { get; set; }
|
|
|
|
|
public int isContainsBattery { get; set; }
|
|
|
|
|
public decimal productDeclareAmount { get; set; }
|
|
|
|
|
public int productId { get; set; }
|
|
|
|
|
public int productNum { get; set; }
|
|
|
|
|
public decimal productWeight { get; set; }
|
|
|
|
|
public string hsCode { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class OrderLoanList
|
|
|
|
|
{
|
|
|
|
|
public Int32? totalItem { get; set; }
|
|
|
|
|
public List<LoanorderList> orderList { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class LoanorderList
|
|
|
|
|
{
|
|
|
|
|
public LoanorderamountTotal amountTotal { get; set; }
|
|
|
|
|
public string orderId { get; set; }
|
|
|
|
|
public List<sonOrderList> sonOrderList { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class LoanorderamountTotal
|
|
|
|
|
{
|
|
|
|
|
public Decimal? amount { get; set; }
|
|
|
|
|
public string currencyCode { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public class sonOrderList
|
|
|
|
|
{
|
|
|
|
|
public string waitLoanReson { get; set; }
|
|
|
|
|
public string loanStatus { get; set; }
|
|
|
|
|
public LoanorderamountTotal affiliateCommission { get; set; }
|
|
|
|
|
public LoanorderamountTotal escrowFee { get; set; }
|
|
|
|
|
public string childOrderId { get; set; }
|
|
|
|
|
public LoanorderamountTotal realLoanAmount { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 纠纷
|
|
|
|
|
|
|
|
|
|
//列表
|
|
|
|
|
public class IssueList
|
|
|
|
|
{
|
|
|
|
|
public string id { get; set; }
|
|
|
|
|
public DateTime gmtCreate { get; set; }
|
|
|
|
|
public DateTime gmtModified { get; set; }
|
|
|
|
|
public string orderId { get; set; }
|
|
|
|
|
public string issueStatus { get; set; }
|
|
|
|
|
public string reasonChinese { get; set; }
|
|
|
|
|
public string reasonEnglish { get; set; }
|
|
|
|
|
public List<IssueAPIIssueProcessDTO> issueProcessDTOs { get; set; }
|
|
|
|
|
}
|
|
|
|
|
//明细
|
|
|
|
|
public class IssueAPIIssueProcessDTO
|
|
|
|
|
{
|
|
|
|
|
public string snapshotUrl { get; set; }
|
|
|
|
|
|
|
|
|
|
public IssueAPIIssueDTO issueAPIIssueDTO { get; set; }
|
|
|
|
|
}
|
|
|
|
|
public class IssueAPIIssueDTO
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
#region 已导入订单
|
|
|
|
|
public class Alibaba_OrderCode
|
|
|
|
|
{
|
|
|
|
|
public string OrderCode { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|