diff --git a/BBWY.1688SDK/APIFacade.cs b/BBWY.1688SDK/APIFacade.cs
new file mode 100644
index 00000000..24a71cbb
--- /dev/null
+++ b/BBWY.1688SDK/APIFacade.cs
@@ -0,0 +1,39 @@
+using com.alibaba.openapi.client;
+using com.alibaba.openapi.client.entity;
+using com.alibaba.openapi.client.policy;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NetSdkClient.sdk
+{
+ public class APIFacade
+ {
+ private ClientPolicy clientPolicy;
+
+ public APIFacade(ClientPolicy clientPolicy)
+ {
+ this.clientPolicy = clientPolicy;
+ }
+
+
+ private SyncAPIClient getAPIClient()
+ {
+ return new SyncAPIClient(clientPolicy);
+ }
+
+ public AuthorizationToken getToken(string code)
+ {
+
+ return getAPIClient().getToken(code);
+
+ }
+
+ public AuthorizationToken refreshToken(String refreshToken)
+ {
+ return getAPIClient().refreshToken(refreshToken);
+ }
+ }
+}
diff --git a/BBWY.1688SDK/APIId.cs b/BBWY.1688SDK/APIId.cs
new file mode 100644
index 00000000..0fefda53
--- /dev/null
+++ b/BBWY.1688SDK/APIId.cs
@@ -0,0 +1,43 @@
+using System;
+
+namespace com.alibaba.openapi.client
+{
+ public class APIId
+ {
+ public APIId()
+ {
+
+ }
+
+ public APIId(String namespaceValue,String name, int version)
+ {
+ this.NamespaceValue = namespaceValue;
+ this.Name = name;
+ this.version = version;
+ }
+
+ private String namespaceValue;
+
+ public String NamespaceValue
+ {
+ get { return namespaceValue; }
+ set { namespaceValue = value; }
+ }
+ private String name;
+
+ public String Name
+ {
+ get { return name; }
+ set { name = value; }
+ }
+ private int version;
+
+ public int Version
+ {
+ get { return version; }
+ set { version = value; }
+ }
+
+
+ }
+}
diff --git a/BBWY.1688SDK/BBWY.1688SDK.csproj b/BBWY.1688SDK/BBWY.1688SDK.csproj
new file mode 100644
index 00000000..4b4233dd
--- /dev/null
+++ b/BBWY.1688SDK/BBWY.1688SDK.csproj
@@ -0,0 +1,16 @@
+
+
+
+ netstandard2.0
+ BBWY._1688SDK
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BBWY.1688SDK/GatewayAPIRequest.cs b/BBWY.1688SDK/GatewayAPIRequest.cs
new file mode 100644
index 00000000..8d4508a7
--- /dev/null
+++ b/BBWY.1688SDK/GatewayAPIRequest.cs
@@ -0,0 +1,23 @@
+using com.alibaba.openapi.client.entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client
+{
+ public class GatewayAPIRequest
+ {
+ [DataMember(Order = 0)]
+ private APIId apiId;
+
+ public APIId ApiId
+ {
+ get { return apiId; }
+ set { apiId = value; }
+ }
+
+ }
+}
diff --git a/BBWY.1688SDK/GatewayAPIResponse.cs b/BBWY.1688SDK/GatewayAPIResponse.cs
new file mode 100644
index 00000000..15a3bfe8
--- /dev/null
+++ b/BBWY.1688SDK/GatewayAPIResponse.cs
@@ -0,0 +1,14 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class GatewayAPIResponse
+ {
+ }
+}
diff --git a/BBWY.1688SDK/Request.cs b/BBWY.1688SDK/Request.cs
new file mode 100644
index 00000000..54835073
--- /dev/null
+++ b/BBWY.1688SDK/Request.cs
@@ -0,0 +1,66 @@
+using com.alibaba.openapi.client.entity;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class Request
+ {
+ [DataMember(Order = 0)]
+ private APIId apiId;
+
+ public APIId ApiId
+ {
+ get { return apiId; }
+ set { apiId = value; }
+ }
+ private Dictionary addtionalParams = new Dictionary();
+
+ public Dictionary AddtionalParams
+ {
+ get { return addtionalParams; }
+ set { addtionalParams = value; }
+ }
+ private Object requestEntity;
+
+ public Object RequestEntity
+ {
+ get { return requestEntity; }
+ set { requestEntity = value; }
+ }
+ private Dictionary attachments;
+
+ public Dictionary Attachments
+ {
+ get { return attachments; }
+ set { attachments = value; }
+ }
+ private String authCodeKey;
+
+ public String AuthCodeKey
+ {
+ get { return authCodeKey; }
+ set { authCodeKey = value; }
+ }
+ [DataMember(Order = 1)]
+ private String accessToken;
+
+ public String AccessToken
+ {
+ get { return accessToken; }
+ set { accessToken = value; }
+ }
+ private AuthorizationToken authToken;
+
+ internal AuthorizationToken AuthToken
+ {
+ get { return authToken; }
+ set { authToken = value; }
+ }
+ }
+}
diff --git a/BBWY.1688SDK/Response.cs b/BBWY.1688SDK/Response.cs
new file mode 100644
index 00000000..5db43fa6
--- /dev/null
+++ b/BBWY.1688SDK/Response.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using com.alibaba.openapi.client.entity;
+
+namespace com.alibaba.openapi.client
+{
+ public class Response
+ {
+ private int statusCode;
+
+ public int StatusCode
+ {
+ get { return statusCode; }
+ set { statusCode = value; }
+ }
+ private Object result;
+
+ public Object Result
+ {
+ get { return result; }
+ set { result = value; }
+ }
+ private Exception exception;
+
+ public Exception Exception
+ {
+ get { return exception; }
+ set { exception = value; }
+ }
+ private String charset = "UTF-8";
+
+ public String Charset
+ {
+ get { return charset; }
+ set { charset = value; }
+ }
+ private String encoding;
+
+ public String Encoding
+ {
+ get { return encoding; }
+ set { encoding = value; }
+ }
+
+ private ResponseWrapper responseWrapper;
+
+ internal ResponseWrapper ResponseWrapper
+ {
+ get { return responseWrapper; }
+ set { responseWrapper = value; }
+ }
+ }
+}
diff --git a/BBWY.1688SDK/SyncAPIClient.cs b/BBWY.1688SDK/SyncAPIClient.cs
new file mode 100644
index 00000000..9d49d04a
--- /dev/null
+++ b/BBWY.1688SDK/SyncAPIClient.cs
@@ -0,0 +1,117 @@
+using BBWY.Common.Http;
+using com.alibaba.openapi.client.entity;
+using com.alibaba.openapi.client.http;
+using com.alibaba.openapi.client.policy;
+using Newtonsoft.Json.Linq;
+using System;
+
+namespace com.alibaba.openapi.client
+{
+ public class SyncAPIClient
+ {
+ private ClientPolicy clientPolicy;
+ private RestApiService restApiService;
+ private HttpClient alibabaHttpClient;
+
+ public SyncAPIClient(String appKey, String appSecret)
+ {
+ this.clientPolicy = new ClientPolicy();
+ this.clientPolicy.AppKey = appKey;
+ this.clientPolicy.SecretKey = appSecret;
+ }
+
+ public SyncAPIClient(String appKey, String appSecret, RestApiService restApiService)
+ {
+ this.clientPolicy = new ClientPolicy();
+ this.clientPolicy.AppKey = appKey;
+ this.clientPolicy.SecretKey = appSecret;
+ this.restApiService = restApiService;
+ this.alibabaHttpClient = new HttpClient(clientPolicy, restApiService);
+ }
+
+ public SyncAPIClient(String appKey, String appSecret, String gatewayHost)
+ {
+ this.clientPolicy = new ClientPolicy();
+ this.clientPolicy.AppKey = appKey;
+ this.clientPolicy.SecretKey = appSecret;
+ this.clientPolicy.ServerHost = gatewayHost;
+ }
+
+ public SyncAPIClient(ClientPolicy clientPolicy)
+ {
+ this.clientPolicy = clientPolicy;
+ }
+
+ public JObject NewRequest(Request request, RequestPolicy policy)
+ {
+ return alibabaHttpClient.NewRequest(request, policy);
+ }
+
+ public T send(Request request, RequestPolicy policy)
+ {
+ HttpClient httpClient = new HttpClient(clientPolicy);
+ T result = httpClient.request(request, policy);
+ return result;
+ }
+
+ public Res execute(GatewayAPIRequest gatewayAPIRequest, String accessToken)
+ {
+ HttpClient httpClient = new HttpClient(clientPolicy);
+ RequestPolicy policy = new RequestPolicy();
+ policy.UseHttps = true;
+ Request request = new Request();
+ request.ApiId = gatewayAPIRequest.ApiId;
+ request.RequestEntity = gatewayAPIRequest;
+ request.AccessToken = accessToken;
+ Res result = httpClient.request(request, policy);
+ return result;
+ }
+
+ public AuthorizationToken getToken(String code)
+ {
+
+ APIId apiId = new APIId();
+ apiId.Name = "getToken";
+ apiId.NamespaceValue = "system.oauth2";
+ apiId.Version = 1;
+
+ Request request = new Request();
+ request.ApiId = apiId;
+
+ request.AddtionalParams["code"] = code;
+ request.AddtionalParams["grant_type"] = "authorization_code";
+ request.AddtionalParams["need_refresh_token"] = true;
+ request.AddtionalParams["client_id"] = clientPolicy.AppKey;
+ request.AddtionalParams["client_secret"] = clientPolicy.SecretKey;
+ request.AddtionalParams["redirect_uri"] = "default";
+ RequestPolicy oauthPolicy = new RequestPolicy();
+ oauthPolicy.UseHttps = true;
+
+ return this.send(request, oauthPolicy);
+ }
+
+ public AuthorizationToken refreshToken(String refreshToken)
+ {
+
+ APIId apiId = new APIId();
+ apiId.Name = "getToken";
+ apiId.NamespaceValue = "system.oauth2";
+ apiId.Version = 1;
+
+ Request request = new Request();
+ request.ApiId = apiId;
+
+ request.AddtionalParams["refreshToken"] = refreshToken;
+ request.AddtionalParams["grant_type"] = "refresh_token";
+ request.AddtionalParams["client_id"] = clientPolicy.AppKey;
+ request.AddtionalParams["client_secret"] = clientPolicy.SecretKey;
+ request.AddtionalParams["redirect_uri"] = "default";
+ RequestPolicy oauthPolicy = new RequestPolicy();
+ oauthPolicy.UseHttps = true;
+ return this.send(request, oauthPolicy);
+
+
+ }
+ }
+}
+
diff --git a/BBWY.1688SDK/entity/AuthorizationToken.cs b/BBWY.1688SDK/entity/AuthorizationToken.cs
new file mode 100644
index 00000000..15163a7b
--- /dev/null
+++ b/BBWY.1688SDK/entity/AuthorizationToken.cs
@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.entity
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class AuthorizationToken
+ {
+ [DataMember(Order = 0)]
+ private String access_token;
+ [DataMember(Order = 1)]
+ private String refresh_token;
+ [DataMember(Order = 2)]
+ private long expires_in;
+ [DataMember(Order = 3)]
+ private DateTime expires_time;
+ [DataMember(Order = 4)]
+ private DateTime refresh_token_timeout;
+ [DataMember(Order = 5)]
+ private String resource_owner;
+ [DataMember(Order = 6)]
+ private String uid;
+ [DataMember(Order = 7)]
+ private long aliId;
+ [DataMember(Order = 8)]
+ private String memberId;
+
+ /**
+ * 获取access_token
+ *
+ * @return the accessToken
+ */
+ public String getAccess_token()
+ {
+ return access_token;
+ }
+
+ /**
+ * 获取access_token过期时间
+ *
+ * @return the accessTokenTimeout
+ */
+ public long getExpires_in()
+ {
+ return expires_in;
+ }
+
+ /**
+ * 获取refresh_token
+ *
+ * @return the refreshToken
+ */
+ public String getRefresh_token()
+ {
+ return refresh_token;
+ }
+
+ /**
+ * 获取refresh_token过期时间
+ *
+ * @return the refreshTokenTimeout
+ */
+ public DateTime getRefresh_token_timeout()
+ {
+ return refresh_token_timeout;
+ }
+
+ public String getMemberId()
+ {
+ return memberId;
+ }
+
+ public void setMemberId(String memberId)
+ {
+ this.memberId = memberId;
+ }
+
+ /**
+ * 获取resource_owner
+ *
+ * @return the resourceOwnerId
+ */
+ public String getResource_owner()
+ {
+ return resource_owner;
+ }
+
+ /**
+ * 获取uid
+ *
+ * @return the uid
+ */
+ public String getUid()
+ {
+ return uid;
+ }
+
+ /**
+ * 获取aliId
+ *
+ * @return the aliId
+ */
+ public long getAliId()
+ {
+ return aliId;
+ }
+
+ public void setAccess_token(String accessToken)
+ {
+ this.access_token = accessToken;
+ }
+
+ public void setRefresh_token(String refreshToken)
+ {
+ this.refresh_token = refreshToken;
+ }
+
+ public void setExpires_in(long accessTokenTimeout)
+ {
+ this.expires_in = accessTokenTimeout;
+ DateTime now = new DateTime();
+ this.expires_time = now.AddSeconds(accessTokenTimeout);
+ }
+
+ public void setRefresh_token_timeout(DateTime refresh_token_timeout)
+ {
+ this.refresh_token_timeout = refresh_token_timeout;
+ }
+
+ public void setResource_owner(String resourceOwnerId)
+ {
+ this.resource_owner = resourceOwnerId;
+ }
+
+ public void setUid(String uid)
+ {
+ this.uid = uid;
+ }
+
+ public void setAliId(long aliId)
+ {
+ this.aliId = aliId;
+ }
+
+ /**
+ * 获取access_token过期时间,Date格式
+ *
+ * @return the accessTokenTimeout
+ */
+ public DateTime getExpires_time()
+ {
+ return expires_time;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/entity/ErrorExceptionDesc.cs b/BBWY.1688SDK/entity/ErrorExceptionDesc.cs
new file mode 100644
index 00000000..62fce097
--- /dev/null
+++ b/BBWY.1688SDK/entity/ErrorExceptionDesc.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.entity
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ErrorExceptionDesc
+ {
+ [DataMember(Order = 0)]
+ private string error_code;
+ [DataMember(Order = 1)]
+ private string error_message;
+ [DataMember(Order = 2)]
+ private string exception;
+
+ public string getError_code()
+ {
+ return this.error_code;
+ }
+
+ public string getError_message()
+ {
+ return this.error_message;
+ }
+
+ public string getException()
+ {
+ return this.exception;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/entity/OrderPreview/CreateOrderPreview.cs b/BBWY.1688SDK/entity/OrderPreview/CreateOrderPreview.cs
new file mode 100644
index 00000000..20533221
--- /dev/null
+++ b/BBWY.1688SDK/entity/OrderPreview/CreateOrderPreview.cs
@@ -0,0 +1,49 @@
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+
+namespace BBWY._1688SDK.entity.OrderPreview
+{
+ [DataContract]
+ public class CreateOrderPreview
+ {
+ [DataMember]
+ public AddressParam addressParam { get; set; }
+ [DataMember]
+ public IList cargoParamList { get; set; }
+ [DataMember]
+ public string flow { get; set; }
+ }
+ [DataContract]
+ public class AddressParam
+ {
+ [DataMember]
+ public string fullName { get; set; }
+ [DataMember]
+ public string mobile { get; set; }
+ [DataMember]
+ public string phone { get; set; }
+ [DataMember]
+ public string postCode { get; set; }
+ [DataMember]
+ public string address { get; set; }
+ [DataMember]
+ public string provinceText { get; set; }
+ [DataMember]
+ public string cityText { get; set; }
+ [DataMember]
+ public string areaText { get; set; }
+ [DataMember]
+ public string townText { get; set; }
+
+ }
+ [DataContract]
+ public class CargoParam
+ {
+ [DataMember]
+ public long offerId { get; set; }
+ [DataMember]
+ public string specId { get; set; }
+ [DataMember]
+ public int quantity { get; set; }
+ }
+}
diff --git a/BBWY.1688SDK/entity/ResponseStatus.cs b/BBWY.1688SDK/entity/ResponseStatus.cs
new file mode 100644
index 00000000..139a9572
--- /dev/null
+++ b/BBWY.1688SDK/entity/ResponseStatus.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.entity
+{
+ public class ResponseStatus
+ {
+ private String code;
+
+ public String Code
+ {
+ get { return code; }
+ set { code = value; }
+ }
+ private String message;
+
+ public String Message
+ {
+ get { return message; }
+ set { message = value; }
+ }
+
+
+ }
+}
diff --git a/BBWY.1688SDK/entity/ResponseWrapper.cs b/BBWY.1688SDK/entity/ResponseWrapper.cs
new file mode 100644
index 00000000..2d9f868a
--- /dev/null
+++ b/BBWY.1688SDK/entity/ResponseWrapper.cs
@@ -0,0 +1,40 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.entity
+{
+ public class ResponseWrapper
+ {
+ private String invokeStartTime;
+
+ public String InvokeStartTime
+ {
+ get { return invokeStartTime; }
+ set { invokeStartTime = value; }
+ }
+ private long invokeCostTime;
+
+ public long InvokeCostTime
+ {
+ get { return invokeCostTime; }
+ set { invokeCostTime = value; }
+ }
+ private ResponseStatus status;
+
+ internal ResponseStatus Status
+ {
+ get { return status; }
+ set { status = value; }
+ }
+ private Object result;
+
+ public Object Result
+ {
+ get { return result; }
+ set { result = value; }
+ }
+ }
+}
diff --git a/BBWY.1688SDK/example/ExampleFacade.cs b/BBWY.1688SDK/example/ExampleFacade.cs
new file mode 100644
index 00000000..7cce8ab5
--- /dev/null
+++ b/BBWY.1688SDK/example/ExampleFacade.cs
@@ -0,0 +1,88 @@
+using com.alibaba.openapi.client;
+using com.alibaba.openapi.client.entity;
+using com.alibaba.openapi.client.policy;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+using com.alibaba.china.openapi.client.example.param.apiexample;
+
+namespace com.alibaba.china.openapi.client.example
+{
+
+ public class ExampleFacade
+ {
+ private ClientPolicy clientPolicy;
+
+ public ExampleFacade(ClientPolicy clientPolicy)
+ {
+ this.clientPolicy = clientPolicy;
+ }
+
+ private SyncAPIClient getAPIClient()
+ {
+ return new SyncAPIClient(clientPolicy);
+ }
+
+ public AuthorizationToken getToken(string code)
+ {
+
+ return getAPIClient().getToken(code);
+
+ }
+
+ public AuthorizationToken refreshToken(String refreshToken)
+ {
+ return getAPIClient().refreshToken(refreshToken);
+ }
+
+
+
+
+ public ExampleFamilyGetResult exampleFamilyGet(ExampleFamilyGetParam param) {
+ RequestPolicy reqPolicy = new RequestPolicy();
+ reqPolicy.HttpMethod="POST";
+ reqPolicy.NeedAuthorization=false;
+ reqPolicy.RequestSendTimestamp=false;
+ reqPolicy.UseHttps=false;
+ reqPolicy.UseSignture=false;
+ reqPolicy.AccessPrivateApi=false;
+
+ Request request = new Request ();
+ APIId apiId = new APIId();
+ apiId.Name = "example.family.get";
+ apiId.NamespaceValue = "api.example";
+ apiId.Version = 1;
+ request.ApiId = apiId;
+
+ request.RequestEntity=param;
+
+ return this.getAPIClient().send(request, reqPolicy);
+ }
+
+
+
+ public ExampleFamilyPostResult exampleFamilyPost(ExampleFamilyPostParam param, string accessToken) {
+ RequestPolicy reqPolicy = new RequestPolicy();
+ reqPolicy.HttpMethod="POST";
+ reqPolicy.NeedAuthorization=false;
+ reqPolicy.RequestSendTimestamp=false;
+ reqPolicy.UseHttps=false;
+ reqPolicy.UseSignture=true;
+ reqPolicy.AccessPrivateApi=false;
+
+ Request request = new Request ();
+ APIId apiId = new APIId();
+ apiId.Name = "example.family.post";
+ apiId.NamespaceValue = "api.example";
+ apiId.Version = 1;
+ request.ApiId = apiId;
+
+ request.RequestEntity=param;
+ request.AccessToken=accessToken;
+ return this.getAPIClient().send(request, reqPolicy);
+ }
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleCar.cs b/BBWY.1688SDK/example/param/apiexample/ExampleCar.cs
new file mode 100644
index 00000000..4b9fe3b4
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleCar.cs
@@ -0,0 +1,160 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+[DataContract(Namespace = "com.alibaba.openapi.client")]
+public class ExampleCar {
+
+ [DataMember(Order = 1)]
+ private string builtDate;
+
+ /**
+ * @return
+ */
+ public DateTime? getBuiltDate() {
+ if (builtDate != null)
+ {
+ DateTime datetime = DateUtil.formatFromStr(builtDate);
+ return datetime;
+ }
+ return null;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setBuiltDate(DateTime builtDate) {
+ this.builtDate = DateUtil.format(builtDate);
+ }
+
+ [DataMember(Order = 2)]
+ private string boughtDate;
+
+ /**
+ * @return
+ */
+ public DateTime? getBoughtDate() {
+ if (boughtDate != null)
+ {
+ DateTime datetime = DateUtil.formatFromStr(boughtDate);
+ return datetime;
+ }
+ return null;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setBoughtDate(DateTime boughtDate) {
+ this.boughtDate = DateUtil.format(boughtDate);
+ }
+
+ [DataMember(Order = 3)]
+ private string name;
+
+ /**
+ * @return
+ */
+ public string getName() {
+ return name;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setName(string name) {
+ this.name = name;
+ }
+
+ [DataMember(Order = 4)]
+ private string builtArea;
+
+ /**
+ * @return
+ */
+ public string getBuiltArea() {
+ return builtArea;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setBuiltArea(string builtArea) {
+ this.builtArea = builtArea;
+ }
+
+ [DataMember(Order = 5)]
+ private string carNumber;
+
+ /**
+ * @return
+ */
+ public string getCarNumber() {
+ return carNumber;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setCarNumber(string carNumber) {
+ this.carNumber = carNumber;
+ }
+
+ [DataMember(Order = 6)]
+ private double? price;
+
+ /**
+ * @return
+ */
+ public double? getPrice() {
+ return price;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setPrice(double price) {
+ this.price = price;
+ }
+
+ [DataMember(Order = 7)]
+ private int? seats;
+
+ /**
+ * @return
+ */
+ public int? getSeats() {
+ return seats;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setSeats(int seats) {
+ this.seats = seats;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleFamily.cs b/BBWY.1688SDK/example/param/apiexample/ExampleFamily.cs
new file mode 100644
index 00000000..51580a39
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleFamily.cs
@@ -0,0 +1,144 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExampleFamily
+ {
+
+ [DataMember(Order = 1)]
+ private int? familyNumber;
+
+ /**
+ * @return 家庭编号
+ */
+ public int? getFamilyNumber()
+ {
+ return familyNumber;
+ }
+
+ /**
+ * 设置家庭编号 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setFamilyNumber(int familyNumber)
+ {
+ this.familyNumber = familyNumber;
+ }
+
+ [DataMember(Order = 2)]
+ private ExamplePerson father;
+
+ /**
+ * @return 父亲对象,可以为空
+ */
+ public ExamplePerson getFather()
+ {
+ return father;
+ }
+
+ /**
+ * 设置父亲对象,可以为空 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setFather(ExamplePerson father)
+ {
+ this.father = father;
+ }
+
+ [DataMember(Order = 3)]
+ private ExamplePerson mother;
+
+ /**
+ * @return 母亲对象,可以为空
+ */
+ public ExamplePerson getMother()
+ {
+ return mother;
+ }
+
+ /**
+ * 设置母亲对象,可以为空 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setMother(ExamplePerson mother)
+ {
+ this.mother = mother;
+ }
+
+ [DataMember(Order = 4)]
+ private ExamplePerson[] children;
+
+ /**
+ * @return 孩子列表
+ */
+ public ExamplePerson[] getChildren()
+ {
+ return children;
+ }
+
+ /**
+ * 设置孩子列表 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setChildren(ExamplePerson[] children)
+ {
+ this.children = children;
+ }
+
+ [DataMember(Order = 5)]
+ private ExampleCar[] ownedCars;
+
+ /**
+ * @return 拥有的汽车信息
+ */
+ public ExampleCar[] getOwnedCars()
+ {
+ return ownedCars;
+ }
+
+ /**
+ * 设置拥有的汽车信息 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setOwnedCars(ExampleCar[] ownedCars)
+ {
+ this.ownedCars = ownedCars;
+ }
+
+ [DataMember(Order = 6)]
+ private ExampleHouse myHouse;
+
+ /**
+ * @return 所住的房屋信息
+ */
+ public ExampleHouse getMyHouse()
+ {
+ return myHouse;
+ }
+
+ /**
+ * 设置所住的房屋信息 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setMyHouse(ExampleHouse myHouse)
+ {
+ this.myHouse = myHouse;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleFamilyGetParam.cs b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyGetParam.cs
new file mode 100644
index 00000000..f2318237
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyGetParam.cs
@@ -0,0 +1,41 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using com.alibaba.openapi.client;
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+[DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExampleFamilyGetParam : GatewayAPIRequest
+ {
+ public ExampleFamilyGetParam()
+ {
+ this.ApiId = new APIId("api.example", "example.family.get",1);
+ }
+
+ [DataMember(Order = 1)]
+ private int? familyNumber;
+
+ /**
+ * @return 可接受参数1或者2,其余参数无法找到family对象
+ */
+ public int? getFamilyNumber() {
+ return familyNumber;
+ }
+
+ /**
+ * 设置可接受参数1或者2,其余参数无法找到family对象 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setFamilyNumber(int familyNumber) {
+ this.familyNumber = familyNumber;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleFamilyGetResult.cs b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyGetResult.cs
new file mode 100644
index 00000000..36d53bab
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyGetResult.cs
@@ -0,0 +1,37 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using com.alibaba.openapi.client;
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+[DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExampleFamilyGetResult : GatewayAPIResponse
+ {
+
+ [DataMember(Order = 1)]
+ private ExampleFamily result;
+
+ /**
+ * @return
+ */
+ public ExampleFamily getResult() {
+ return result;
+ }
+
+ /**
+ * 设置 *
+
+ * 此参数必填
+ */
+ public void setResult(ExampleFamily result) {
+ this.result = result;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleFamilyPostParam.cs b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyPostParam.cs
new file mode 100644
index 00000000..087c88a8
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyPostParam.cs
@@ -0,0 +1,81 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExampleFamilyPostParam
+ {
+
+ [DataMember(Order = 1)]
+ private ExampleFamily family;
+
+ /**
+ * @return 上传Family对象信息
+ */
+ public ExampleFamily getFamily()
+ {
+ return family;
+ }
+
+ /**
+ * 设置上传Family对象信息 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setFamily(ExampleFamily family)
+ {
+ this.family = family;
+ }
+
+ [DataMember(Order = 2)]
+ private string comments;
+
+ /**
+ * @return 备注信息
+ */
+ public string getComments()
+ {
+ return comments;
+ }
+
+ /**
+ * 设置备注信息 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setComments(string comments)
+ {
+ this.comments = comments;
+ }
+
+ [DataMember(Order = 3)]
+ private byte[] houseImg;
+
+ /**
+ * @return 房屋信息
+ */
+ public byte[] getHouseImg()
+ {
+ return houseImg;
+ }
+
+ /**
+ * 设置房屋信息 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setHouseImg(byte[] houseImg)
+ {
+ this.houseImg = houseImg;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleFamilyPostResult.cs b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyPostResult.cs
new file mode 100644
index 00000000..7ef81163
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleFamilyPostResult.cs
@@ -0,0 +1,56 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+[DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExampleFamilyPostResult
+ {
+
+ [DataMember(Order = 1)]
+ private ExampleFamily result;
+
+ /**
+ * @return 返回的接听信息
+ */
+ public ExampleFamily getResult() {
+ return result;
+ }
+
+ /**
+ * 设置返回的接听信息 *
+
+ * 此参数必填
+ */
+ public void setResult(ExampleFamily result) {
+ this.result = result;
+ }
+
+ [DataMember(Order = 2)]
+ private string resultDesc;
+
+ /**
+ * @return 返回结果描述
+ */
+ public string getResultDesc() {
+ return resultDesc;
+ }
+
+ /**
+ * 设置返回结果描述 *
+
+ * 此参数必填
+ */
+ public void setResultDesc(string resultDesc) {
+ this.resultDesc = resultDesc;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExampleHouse.cs b/BBWY.1688SDK/example/param/apiexample/ExampleHouse.cs
new file mode 100644
index 00000000..728a04de
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExampleHouse.cs
@@ -0,0 +1,102 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+ [DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExampleHouse
+ {
+
+ [DataMember(Order = 1)]
+ private string location;
+
+ /**
+ * @return
+ */
+ public string getLocation()
+ {
+ return location;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setLocation(string location)
+ {
+ this.location = location;
+ }
+
+ [DataMember(Order = 2)]
+ private int? areaSize;
+
+ /**
+ * @return
+ */
+ public int? getAreaSize()
+ {
+ return areaSize;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setAreaSize(int areaSize)
+ {
+ this.areaSize = areaSize;
+ }
+
+ [DataMember(Order = 3)]
+ private bool? rent;
+
+ /**
+ * @return
+ */
+ public bool? getRent()
+ {
+ return rent;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setRent(bool rent)
+ {
+ this.rent = rent;
+ }
+
+ [DataMember(Order = 4)]
+ private int? rooms;
+
+ /**
+ * @return
+ */
+ public int? getRooms()
+ {
+ return rooms;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setRooms(int rooms)
+ {
+ this.rooms = rooms;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/example/param/apiexample/ExamplePerson.cs b/BBWY.1688SDK/example/param/apiexample/ExamplePerson.cs
new file mode 100644
index 00000000..636baff1
--- /dev/null
+++ b/BBWY.1688SDK/example/param/apiexample/ExamplePerson.cs
@@ -0,0 +1,99 @@
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+
+
+namespace com.alibaba.china.openapi.client.example.param.apiexample
+{
+[DataContract(Namespace = "com.alibaba.openapi.client")]
+ public class ExamplePerson
+ {
+
+ [DataMember(Order = 1)]
+ private string name;
+
+ /**
+ * @return
+ */
+ public string getName() {
+ return name;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setName(string name) {
+ this.name = name;
+ }
+
+ [DataMember(Order = 2)]
+ private int? age;
+
+ /**
+ * @return
+ */
+ public int? getAge() {
+ return age;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ [DataMember(Order = 3)]
+ private string birthday;
+
+ /**
+ * @return
+ */
+ public DateTime? getBirthday() {
+ if (birthday != null)
+ {
+ DateTime datetime = DateUtil.formatFromStr(birthday);
+ return datetime;
+ }
+ return null;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setBirthday(DateTime birthday) {
+ this.birthday = DateUtil.format(birthday);
+ }
+
+ [DataMember(Order = 4)]
+ private string mobileNumber;
+
+ /**
+ * @return
+ */
+ public string getMobileNumber() {
+ return mobileNumber;
+ }
+
+ /**
+ * 设置 *
+ * 参数示例:
+ * 此参数必填
+ */
+ public void setMobileNumber(string mobileNumber) {
+ this.mobileNumber = mobileNumber;
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/BBWY.1688SDK/exception/OceanException.cs b/BBWY.1688SDK/exception/OceanException.cs
new file mode 100644
index 00000000..fcf0d9a3
--- /dev/null
+++ b/BBWY.1688SDK/exception/OceanException.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.exception
+{
+ public class OceanException : Exception
+ {
+ public OceanException(string mess)
+ : base(mess)
+ {
+
+ }
+ public OceanException()
+ {
+
+ }
+ private string error_code;
+
+ private string error_message;
+
+ private string exception;
+
+ public string getError_code()
+ {
+ return this.error_code;
+ }
+
+ public void setError_code(string error_code)
+ {
+ this.error_code = error_code;
+ }
+
+ public string getError_message()
+ {
+ return this.error_message;
+ }
+
+ public void setError_message(string error_message)
+ {
+ this.error_message = error_message;
+ }
+
+ public string getException()
+ {
+ return this.exception;
+ }
+
+ public void setException(String exception)
+ {
+ this.exception = exception;
+ }
+
+ }
+}
diff --git a/BBWY.1688SDK/http/HttpClient.cs b/BBWY.1688SDK/http/HttpClient.cs
new file mode 100644
index 00000000..658f6994
--- /dev/null
+++ b/BBWY.1688SDK/http/HttpClient.cs
@@ -0,0 +1,243 @@
+using BBWY.Common.Http;
+using com.alibaba.openapi.client.entity;
+using com.alibaba.openapi.client.policy;
+using com.alibaba.openapi.client.serialize;
+using com.alibaba.openapi.client.util;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Net.Http;
+using System.Text;
+using System.Web;
+
+namespace com.alibaba.openapi.client.http
+{
+ public class HttpClient
+ {
+ private ClientPolicy clientPolicy;
+ private RestApiService restApiService;
+ private IDictionary requestHeader;
+
+ public HttpClient(ClientPolicy clientPolicy)
+ {
+ this.clientPolicy = clientPolicy;
+ }
+
+ public HttpClient(ClientPolicy clientPolicy, RestApiService restApiService)
+ {
+ this.clientPolicy = clientPolicy;
+ this.restApiService = restApiService;
+ this.requestHeader = new Dictionary()
+ {
+ { "User-Agent","Ocean/NET-SDKClient"}
+ };
+ }
+
+ public JObject NewRequest(Request request, RequestPolicy requestPolicy)
+ {
+ StringBuilder path = createProtocolRequestPath(requestPolicy, request);
+ Dictionary parameters = createParameterDictionary(requestPolicy, request);
+ signature(path.ToString(), parameters, requestPolicy, clientPolicy);
+ string paramString = createParameterStr(parameters);
+ Uri uri = new Uri(buildRequestUri(requestPolicy, request));
+
+ var result = restApiService.SendRequest($"{uri.Scheme}://{uri.Host}",
+ uri.LocalPath,
+ paramString,
+ requestHeader,
+ requestPolicy.HttpMethod.Equals("GET") ? HttpMethod.Get : HttpMethod.Post,
+ RestApiService.ContentType_Form);
+ if (result.StatusCode != HttpStatusCode.OK)
+ throw new Exception(result.Content.ToString());
+ return JObject.Parse(result.Content);
+ }
+
+ public T request(Request request, RequestPolicy requestPolicy)
+ {
+ StringBuilder path = createProtocolRequestPath(requestPolicy, request);
+ Dictionary parameters = createParameterDictionary(requestPolicy, request);
+ StringBuilder queryBuilder = new StringBuilder();
+ signature(path.ToString(), parameters, requestPolicy, clientPolicy);
+ if ("GET".Equals(requestPolicy.HttpMethod))
+ {
+
+ String queryString = createParameterStr(parameters);
+ String uriStr = buildRequestUri(requestPolicy, request);
+ uriStr = uriStr + "?" + queryString;
+ Uri uri = new Uri(uriStr);
+ HttpWebRequest httpWebRequest = WebRequest.Create(uri) as HttpWebRequest;
+
+ httpWebRequest.Method = "GET";
+ httpWebRequest.KeepAlive = false;
+ httpWebRequest.AllowAutoRedirect = true;
+ httpWebRequest.ContentType = "application/x-www-form-urlencoded";
+ httpWebRequest.UserAgent = "Ocean/NET-SDKClient";
+
+ HttpWebResponse response = httpWebRequest.GetResponse() as HttpWebResponse;
+ Stream responseStream = response.GetResponseStream();
+
+ DeSerializer deSerializer = SerializerProvider.getInstance().getDeSerializer(requestPolicy.ResponseProtocol);
+ ResponseWrapper rw = deSerializer.deSerialize(responseStream, typeof(T), Encoding.UTF8.EncodingName);
+ return (T)rw.Result;
+ }
+ else
+ {
+ String postString = createParameterStr(parameters);
+ byte[] postData = Encoding.UTF8.GetBytes(postString);
+ String uriStr = buildRequestUri(requestPolicy, request);
+ Uri uri = new Uri(uriStr);
+ HttpWebRequest httpWebRequest = WebRequest.Create(uri) as HttpWebRequest;
+
+ httpWebRequest.Method = "POST";
+ httpWebRequest.KeepAlive = false;
+ httpWebRequest.AllowAutoRedirect = true;
+ httpWebRequest.ContentType = "application/x-www-form-urlencoded";
+ httpWebRequest.UserAgent = "Ocean/NET-SDKClient";
+ httpWebRequest.ContentLength = postData.Length;
+
+ System.IO.Stream outputStream = httpWebRequest.GetRequestStream();
+ outputStream.Write(postData, 0, postData.Length);
+ outputStream.Close();
+ try
+ {
+ HttpWebResponse response = httpWebRequest.GetResponse() as HttpWebResponse;
+ Stream responseStream = response.GetResponseStream();
+
+
+ DeSerializer deSerializer = SerializerProvider.getInstance().getDeSerializer(requestPolicy.ResponseProtocol);
+ ResponseWrapper rw = deSerializer.deSerialize(responseStream, typeof(T), Encoding.UTF8.EncodingName);
+ return (T)rw.Result;
+ }
+ catch (System.Net.WebException webException)
+ {
+ HttpWebResponse response = webException.Response as HttpWebResponse;
+ Stream responseStream = response.GetResponseStream();
+ DeSerializer deSerializer = SerializerProvider.getInstance().getDeSerializer(requestPolicy.ResponseProtocol);
+ Exception rw = deSerializer.buildException(responseStream, 500, Encoding.UTF8.EncodingName);
+ throw rw;
+ }
+ }
+ }
+
+ private String buildRequestUri(RequestPolicy requestPolicy, Request request)
+ {
+ String schema = "http";
+ int port = clientPolicy.HttpPort;
+ if (requestPolicy.UseHttps)
+ {
+ schema = "https";
+ port = clientPolicy.HttpsPort;
+ }
+ StringBuilder relativeBuilder = new StringBuilder(schema);
+ relativeBuilder.Append("://");
+ relativeBuilder.Append(clientPolicy.ServerHost);
+ if (port != 80 && port != 443)
+ {
+ relativeBuilder.Append(":");
+ relativeBuilder.Append(port);
+ }
+
+ if (requestPolicy.AccessPrivateApi)
+ {
+ relativeBuilder.Append("/api");
+ }
+ else
+ {
+ relativeBuilder.Append("/openapi");
+ }
+
+ relativeBuilder.Append("/");
+ relativeBuilder.Append(createProtocolRequestPath(requestPolicy, request));
+ return relativeBuilder.ToString();
+ }
+
+ private StringBuilder createProtocolRequestPath(RequestPolicy requestPolicy, Request request)
+ {
+
+ StringBuilder relativeBuilder = new StringBuilder();
+
+ relativeBuilder.Append(requestPolicy.RequestProtocol);
+ relativeBuilder.Append("/").Append(request.ApiId.Version);
+ relativeBuilder.Append("/").Append(request.ApiId.NamespaceValue);
+ relativeBuilder.Append("/").Append(request.ApiId.Name);
+ relativeBuilder.Append("/").Append(clientPolicy.AppKey);
+ return relativeBuilder;
+
+ }
+
+ private String createParameterStr(Dictionary parameters)
+ {
+ StringBuilder paramBuilder = new StringBuilder();
+ foreach (KeyValuePair kvp in parameters)
+ {
+ String encodedValue = null;
+ if (kvp.Value != null)
+ {
+ String tempValue = kvp.Value.ToString();
+ byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(tempValue);
+ encodedValue = HttpUtility.UrlEncode(byteArray, 0, byteArray.Length);
+ }
+ paramBuilder.Append(kvp.Key).Append("=").Append(encodedValue);
+ paramBuilder.Append("&");
+ }
+ return paramBuilder.ToString();
+ }
+
+ private Dictionary createParameterDictionary(RequestPolicy requestPolicy, Request request)
+ {
+
+ Serializer serializer = SerializerProvider.getInstance().getSerializer(requestPolicy.RequestProtocol);
+
+ Dictionary parameters = serializer.serialize(request.RequestEntity);
+ if (!requestPolicy.RequestProtocol.Equals(requestPolicy.ResponseProtocol))
+ {
+ parameters.Add("_aop_responseFormat", requestPolicy.ResponseProtocol);
+ }
+ if (requestPolicy.RequestSendTimestamp)
+ {
+ parameters.Add("_aop_timestamp", DateUtil.currentTimeMillis());
+ }
+ parameters.Add("_aop_datePattern", DateUtil.getDatePattern());
+ foreach (KeyValuePair kvp in request.AddtionalParams)
+ {
+ parameters.Add(kvp.Key, kvp.Value);
+ }
+ if (request.AccessToken != null)
+ {
+ parameters.Add("access_token", request.AccessToken);
+ }
+ return parameters;
+ }
+
+ private void signature(String path, Dictionary parameters, RequestPolicy requestPolicy, ClientPolicy clientPolicy)
+ {
+ if (!requestPolicy.UseSignture)
+ {
+ return;
+ }
+ if (clientPolicy.AppKey == null
+ || clientPolicy.SecretKey == null)
+ {
+ return;
+ }
+ byte[] sign = SignatureUtil.hmacSha1(path, parameters, clientPolicy.SecretKey);
+ String signStr = SignatureUtil.toHex(sign);
+ if (signStr != null)
+ {
+ parameters.Add("_aop_signature", signStr);
+ }
+ }
+
+
+ private WebClient createWebClient()
+ {
+
+ WebClient client = new WebClient();
+ client.Headers.Add("user-agent", "Ocean/SDK Client");
+
+ return client;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/policy/ClientPolicy.cs b/BBWY.1688SDK/policy/ClientPolicy.cs
new file mode 100644
index 00000000..15a98f55
--- /dev/null
+++ b/BBWY.1688SDK/policy/ClientPolicy.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.policy
+{
+ public class ClientPolicy
+ {
+ private string serverHost = "gw.open.1688.com";
+
+ public string ServerHost
+ {
+ get { return serverHost; }
+ set { serverHost = value; }
+ }
+ private int httpPort = 80;
+
+ public int HttpPort
+ {
+ get { return httpPort; }
+ set { httpPort = value; }
+ }
+ private int httpsPort = 443;
+
+ public int HttpsPort
+ {
+ get { return httpsPort; }
+ set { httpsPort = value; }
+ }
+ private string appKey;
+
+ public string AppKey
+ {
+ get { return appKey; }
+ set { appKey = value; }
+ }
+ private string secretKey;
+
+ public string SecretKey
+ {
+ get { return secretKey; }
+ set { secretKey = value; }
+ }
+ private int defaultTimeout = 5000;
+
+ public int DefaultTimeout
+ {
+ get { return defaultTimeout; }
+ set { defaultTimeout = value; }
+ }
+ private string defaultContentCharset = "UTF-8";
+
+ public string DefaultContentCharset
+ {
+ get { return defaultContentCharset; }
+ set { defaultContentCharset = value; }
+ }
+ private bool defaultUseHttps = true;
+
+ public bool DefaultUseHttps
+ {
+ get { return defaultUseHttps; }
+ set { defaultUseHttps = value; }
+ }
+
+
+ }
+}
diff --git a/BBWY.1688SDK/policy/GrantType.cs b/BBWY.1688SDK/policy/GrantType.cs
new file mode 100644
index 00000000..4f4e0397
--- /dev/null
+++ b/BBWY.1688SDK/policy/GrantType.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.policy
+{
+ public class GrantType
+ {
+ public const string refresh_token="refresh_token";
+ /**
+ * 请求参数通过json串的方式传递,默认格式_data_={"key":"value"}
+ */
+ public const string get_token = "get_token";
+ }
+}
diff --git a/BBWY.1688SDK/policy/Protocol.cs b/BBWY.1688SDK/policy/Protocol.cs
new file mode 100644
index 00000000..3b7a5a4c
--- /dev/null
+++ b/BBWY.1688SDK/policy/Protocol.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.policy
+{
+ public class Protocol
+ {
+ public const string param2 = "param2";
+ /**
+ * 请求参数通过json串的方式传递,默认格式_data_={"key":"value"}
+ */
+ public const string json2 = "json2";
+ /**
+ *
+ * 请求参数通过xml的方式传递,默认格式_data_=<test>data</test>
+ */
+ public const string xml2 = "xml2";
+ public const string param = "param";
+ public const string json = "json";
+ public const string xml = "xml";
+ public const string http = "http";
+ }
+}
diff --git a/BBWY.1688SDK/policy/RequestPolicy.cs b/BBWY.1688SDK/policy/RequestPolicy.cs
new file mode 100644
index 00000000..762226e7
--- /dev/null
+++ b/BBWY.1688SDK/policy/RequestPolicy.cs
@@ -0,0 +1,113 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.policy
+{
+ public class RequestPolicy
+ {
+ private bool requestSendTimestamp = false;
+
+ public bool RequestSendTimestamp
+ {
+ get { return requestSendTimestamp; }
+ set { requestSendTimestamp = value; }
+ }
+ private bool useHttps = false;
+
+ public bool UseHttps
+ {
+ get { return useHttps; }
+ set { useHttps = value; }
+ }
+ private string requestProtocol = Protocol.param2;
+
+ internal string RequestProtocol
+ {
+ get { return requestProtocol; }
+ set { requestProtocol = value; }
+ }
+ private string responseProtocol = Protocol.json2;
+
+ internal string ResponseProtocol
+ {
+ get { return responseProtocol; }
+ set { responseProtocol = value; }
+ }
+ private bool responseCompress = true;
+
+ public bool ResponseCompress
+ {
+ get { return responseCompress; }
+ set { responseCompress = value; }
+ }
+ private int requestCompressThreshold = -1;
+
+ public int RequestCompressThreshold
+ {
+ get { return requestCompressThreshold; }
+ set { requestCompressThreshold = value; }
+ }
+ private int timeout = 5000;
+
+ public int Timeout
+ {
+ get { return timeout; }
+ set { timeout = value; }
+ }
+ private string httpMethod = "POST";
+
+ public string HttpMethod
+ {
+ get { return httpMethod; }
+ set { httpMethod = value; }
+ }
+ private String queryStringCharset = "GB18030";
+
+ public String QueryStringCharset
+ {
+ get { return queryStringCharset; }
+ set { queryStringCharset = value; }
+ }
+ private String contentCharset = "UTF-8";
+
+ public String ContentCharset
+ {
+ get { return contentCharset; }
+ set { contentCharset = value; }
+ }
+ private bool useSignture = true;
+
+ public bool UseSignture
+ {
+ get { return useSignture; }
+ set { useSignture = value; }
+ }
+ private bool needAuthorization = false;
+
+ public bool NeedAuthorization
+ {
+ get { return needAuthorization; }
+ set { needAuthorization = value; }
+ }
+ private bool accessPrivateApi = false;
+
+ public bool AccessPrivateApi
+ {
+ get { return accessPrivateApi; }
+ set { accessPrivateApi = value; }
+ }
+ private int defaultApiVersion = 1;
+
+ public int DefaultApiVersion
+ {
+ get { return defaultApiVersion; }
+ set { defaultApiVersion = value; }
+ }
+
+
+
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableBool.cs b/BBWY.1688SDK/primitive/NullableBool.cs
new file mode 100644
index 00000000..63caafdb
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableBool.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableBool : NullablePrimitiveObject
+ {
+ public NullableBool(bool value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ bool value;
+ private Boolean isNull = true;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(bool value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public bool getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableByte.cs b/BBWY.1688SDK/primitive/NullableByte.cs
new file mode 100644
index 00000000..4d73775d
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableByte.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableByte : NullablePrimitiveObject
+ {
+ public NullableByte(byte value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ byte value;
+ private Boolean isNull;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(byte value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public byte getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableChar.cs b/BBWY.1688SDK/primitive/NullableChar.cs
new file mode 100644
index 00000000..f7375045
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableChar.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableChar : NullablePrimitiveObject
+ {
+ public NullableChar(char value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ char value;
+ private Boolean isNull = true;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(char value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public char getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableDateTime.cs b/BBWY.1688SDK/primitive/NullableDateTime.cs
new file mode 100644
index 00000000..1b621c05
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableDateTime.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableDateTime : NullablePrimitiveObject
+ {
+ public NullableDateTime(DateTime value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ DateTime value;
+ private Boolean isNull;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(DateTime value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public DateTime getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableDouble.cs b/BBWY.1688SDK/primitive/NullableDouble.cs
new file mode 100644
index 00000000..2bd5c3cf
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableDouble.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableDouble : NullablePrimitiveObject
+ {
+ public NullableDouble(double value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ double value;
+ private Boolean isNull;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(double value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public double getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableFloat.cs b/BBWY.1688SDK/primitive/NullableFloat.cs
new file mode 100644
index 00000000..8a294cf3
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableFloat.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableFloat : NullablePrimitiveObject
+ {
+ public NullableFloat(float value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ float value;
+ private Boolean isNull;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(float value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public float getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableInt.cs b/BBWY.1688SDK/primitive/NullableInt.cs
new file mode 100644
index 00000000..a9fd6def
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableInt.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableInt : NullablePrimitiveObject
+ {
+ public NullableInt(int value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ int value;
+ private Boolean isNull;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(int value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public int getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullableLong.cs b/BBWY.1688SDK/primitive/NullableLong.cs
new file mode 100644
index 00000000..1dfd55ac
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullableLong.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullableLong : NullablePrimitiveObject
+ {
+ public NullableLong(long value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ long value;
+ private Boolean isNull;
+
+ public Boolean IsNull
+ {
+ get { return isNull; }
+ }
+
+ public void setValue(long value)
+ {
+ this.value = value;
+ this.isNull = false;
+ }
+
+ public long getValue()
+ {
+ return this.value;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/primitive/NullablePrimitiveObject.cs b/BBWY.1688SDK/primitive/NullablePrimitiveObject.cs
new file mode 100644
index 00000000..e9a4ef41
--- /dev/null
+++ b/BBWY.1688SDK/primitive/NullablePrimitiveObject.cs
@@ -0,0 +1,12 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.primitive
+{
+ public class NullablePrimitiveObject
+ {
+ }
+}
diff --git a/BBWY.1688SDK/serialize/DeSerializer.cs b/BBWY.1688SDK/serialize/DeSerializer.cs
new file mode 100644
index 00000000..332ed39f
--- /dev/null
+++ b/BBWY.1688SDK/serialize/DeSerializer.cs
@@ -0,0 +1,21 @@
+using com.alibaba.openapi.client.entity;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.serialize
+{
+ public interface DeSerializer
+ {
+ //返回该反序列化接口支持的数据协议.
+ String supportedContentType();
+
+ ResponseWrapper deSerialize(Stream istream, Type resultType, String charSet);
+
+ Exception buildException(Stream inputStream, int statusCode, String charSet);
+
+ }
+}
diff --git a/BBWY.1688SDK/serialize/Json2Deserializer.cs b/BBWY.1688SDK/serialize/Json2Deserializer.cs
new file mode 100644
index 00000000..2b12b423
--- /dev/null
+++ b/BBWY.1688SDK/serialize/Json2Deserializer.cs
@@ -0,0 +1,56 @@
+using com.alibaba.openapi.client.entity;
+using com.alibaba.openapi.client.exception;
+using com.alibaba.openapi.client.policy;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.serialize
+{
+ public class Json2Deserializer : DeSerializer
+ {
+ //返回该反序列化接口支持的数据协议.
+ public String supportedContentType()
+ {
+ return Protocol.json2;
+ }
+
+ public ResponseWrapper deSerialize(Stream istream, Type resultType, String charSet)
+ {
+ StreamReader sr = new StreamReader(istream, Encoding.UTF8);
+ string strhtml = sr.ReadToEnd();
+ using (MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(strhtml)))
+ {
+ DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(resultType);
+ object result = jsonSerializer.ReadObject(ms);
+ ResponseWrapper responseWrapper = new ResponseWrapper();
+ responseWrapper.Result = result;
+
+ return responseWrapper;
+ }
+ }
+
+ public Exception buildException(Stream istream, int statusCode, String charSet)
+ {
+
+
+ //istream.Position = 0;
+ DataContractJsonSerializer jsonSerializer = new DataContractJsonSerializer(typeof(ErrorExceptionDesc));
+ object resultObj = jsonSerializer.ReadObject(istream);
+ ErrorExceptionDesc result = (ErrorExceptionDesc)resultObj;
+ String errorCodeStr = result.getError_code();
+ String errorMesage = result.getError_message();
+
+ OceanException oceanException = new OceanException(errorMesage);
+ oceanException.setError_code(errorCodeStr);
+ oceanException.setError_message(errorMesage);
+ return oceanException;
+
+
+ }
+ }
+}
diff --git a/BBWY.1688SDK/serialize/Param2RequestSerializer.cs b/BBWY.1688SDK/serialize/Param2RequestSerializer.cs
new file mode 100644
index 00000000..29093c7d
--- /dev/null
+++ b/BBWY.1688SDK/serialize/Param2RequestSerializer.cs
@@ -0,0 +1,137 @@
+using com.alibaba.openapi.client.policy;
+using com.alibaba.openapi.client.primitive;
+using com.alibaba.openapi.client.util;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.Serialization.Json;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.serialize
+{
+ public class Param2RequestSerializer : Serializer
+ {
+ public String supportedContentType()
+ {
+ return Protocol.param2;
+ }
+
+ public Dictionary serialize(Object serializer)
+ {
+ //Dictionary result = serializeNest(serializer);
+ //return result;
+ return serializeParam(serializer);
+ }
+
+ private Dictionary serializeNest(Object serializer)
+ {
+ Dictionary result = new Dictionary();
+ if (serializer == null)
+ {
+ return result;
+ }
+ Type type = serializer.GetType();
+
+ IEnumerable fis = type.GetRuntimeFields();
+ TextInfo tInfo = Thread.CurrentThread.CurrentCulture.TextInfo;
+
+ foreach (FieldInfo fi in fis)
+ {
+ Type fieldType = fi.FieldType;
+
+ String piName = fi.Name;
+ String firstCharacter = piName.Substring(0, 1);
+ String upperFirstCharacter = firstCharacter.ToUpper(Thread.CurrentThread.CurrentCulture);
+ String tempName = upperFirstCharacter + piName.Substring(1);
+ if (!"ApiId".Equals(tempName))
+ {
+ MethodInfo mi = type.GetMethod("get" + tempName);
+ object value = mi.Invoke(serializer, null);
+ if (value != null)
+ {
+ object trueValue = null;
+ if (fieldType.IsAssignableFrom(typeof(bool?))
+ || fieldType.IsAssignableFrom(typeof(byte?))
+ || fieldType.IsAssignableFrom(typeof(char?))
+ || fieldType.IsAssignableFrom(typeof(double?))
+ || fieldType.IsAssignableFrom(typeof(float?))
+ || fieldType.IsAssignableFrom(typeof(int?))
+ || fieldType.IsAssignableFrom(typeof(long?)))
+ {
+ trueValue = value;
+ }
+ else if (fieldType.IsAssignableFrom(typeof(String)))
+ {
+ if (value.GetType().IsAssignableFrom(typeof(DateTime)))
+ {
+ DateTime dateTime = (DateTime)value;
+ trueValue = DateUtil.formatForOcean(dateTime);
+ }
+ else
+ {
+ trueValue = value;
+ }
+ }
+ else if (fieldType.IsAssignableFrom(typeof(DateTime?)))
+ {
+ DateTime dateTime = (DateTime)value;
+ trueValue = DateUtil.format(dateTime);
+ }
+ else if (fieldType.IsAssignableFrom(typeof(Byte[])) || fieldType.IsAssignableFrom(typeof(byte[])))
+ {
+ trueValue = Convert.ToBase64String((byte[])value);
+ }
+ else
+ {
+ DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(fieldType);
+ MemoryStream stream = new MemoryStream();
+ dataContractJsonSerializer.WriteObject(stream, value);
+ byte[] dataBytes = new byte[stream.Length];
+ stream.Position = 0;
+ stream.Read(dataBytes, 0, (int)stream.Length);
+
+ string dataString = Encoding.UTF8.GetString(dataBytes);
+ trueValue = dataString;
+ }
+ result.Add(piName, trueValue);
+ }
+
+ }
+ }
+ return result;
+ }
+
+ private Dictionary serializeParam(object param)
+ {
+ Dictionary result = new Dictionary();
+ Type type = param.GetType();
+ var properties = type.GetProperties();
+ foreach (var property in properties)
+ {
+ var value = property.GetValue(param);
+ var valueType = value.GetType();
+ if (valueType.IsAssignableFrom(typeof(string)) ||
+ valueType.IsAssignableFrom(typeof(bool?)) ||
+ valueType.IsAssignableFrom(typeof(byte?)) ||
+ valueType.IsAssignableFrom(typeof(char?)) ||
+ valueType.IsAssignableFrom(typeof(double?)) ||
+ valueType.IsAssignableFrom(typeof(float?)) ||
+ valueType.IsAssignableFrom(typeof(int?)) ||
+ valueType.IsAssignableFrom(typeof(long?)))
+ result.Add(property.Name, value);
+ else
+ {
+ result.Add(property.Name, JsonConvert.SerializeObject(value));
+ }
+ }
+ return result;
+ }
+
+ }
+}
diff --git a/BBWY.1688SDK/serialize/Serializer.cs b/BBWY.1688SDK/serialize/Serializer.cs
new file mode 100644
index 00000000..7dfba74c
--- /dev/null
+++ b/BBWY.1688SDK/serialize/Serializer.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.serialize
+{
+ public interface Serializer
+ {
+
+ //返回该反序列化接口支持的数据协议.
+ String supportedContentType();
+
+ //序列化方法
+ Dictionary serialize(Object serializer);
+ }
+}
diff --git a/BBWY.1688SDK/serialize/SerializerProvider.cs b/BBWY.1688SDK/serialize/SerializerProvider.cs
new file mode 100644
index 00000000..86249f53
--- /dev/null
+++ b/BBWY.1688SDK/serialize/SerializerProvider.cs
@@ -0,0 +1,60 @@
+using com.alibaba.openapi.client.policy;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.serialize
+{
+ public class SerializerProvider
+ {
+ private static SerializerProvider instance;
+ private static Object lockObject=new Object();
+ public static SerializerProvider getInstance()
+ {
+ if (instance == null)
+ {
+ lock (lockObject)
+ {
+ if (instance == null)
+ {
+ instance = new SerializerProvider();
+ instance.initial();
+ }
+ }
+ }
+ return instance;
+ }
+
+ private SerializerProvider()
+ {
+
+ }
+
+ private void initial()
+ {
+ serializerStore.Add(Protocol.param2, new Param2RequestSerializer());
+ deSerializerStore.Add(Protocol.param2, new Json2Deserializer());
+ deSerializerStore.Add(Protocol.json2, new Json2Deserializer());
+ }
+
+ private Dictionary serializerStore = new Dictionary();
+
+ public Serializer getSerializer(String contentType)
+ {
+ return serializerStore[contentType];
+ }
+
+ private Dictionary deSerializerStore = new Dictionary();
+
+ public DeSerializer getDeSerializer(String contentType)
+ {
+ return deSerializerStore[contentType];
+ }
+
+
+
+
+ }
+}
diff --git a/BBWY.1688SDK/util/DateUtil.cs b/BBWY.1688SDK/util/DateUtil.cs
new file mode 100644
index 00000000..242fd011
--- /dev/null
+++ b/BBWY.1688SDK/util/DateUtil.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.util
+{
+ public class DateUtil
+ {
+ //这里定义两个日期格式,由于.Net平台的毫秒格式用fff表示,Ocean平台(Java)的毫秒格式用SSS表示。
+ private static string Date_Pattern = "yyyyMMddHHmmssfff";
+
+ private static string Date_PatternForOcean = "yyyyMMddHHmmssSSS";
+
+
+ public static String getDatePattern()
+ {
+ return Date_PatternForOcean;
+ }
+
+ public static String format(DateTime date)
+ {
+ return date.ToString(Date_Pattern);
+ }
+
+ public static String formatForOcean(DateTime date)
+ {
+ String value = date.ToString("yyyyMMddHHmmssfffzzz");
+ String newValue = value.Replace(":", "");
+ return newValue;
+ }
+
+ public static DateTime formatFromStr(String dateDesc)
+ {
+ if (dateDesc.Contains("+") || dateDesc.Contains("-"))
+ {
+ try
+ {
+ IFormatProvider culture = new CultureInfo("zh-CN", true);
+ DateTime datetime = DateTime.ParseExact(dateDesc, "yyyyMMddHHmmssfffzzz", culture);
+ return datetime;
+ }
+ catch (Exception x)
+ {
+ String message = x.Message;
+ }
+ }
+ IFormatProvider newculture = new CultureInfo("zh-CN", true);
+ DateTime newdatetime = DateTime.ParseExact(dateDesc, Date_Pattern, newculture);
+ return newdatetime;
+ }
+
+
+
+ public static long currentTimeMillis()
+ {
+ System.DateTime current = new DateTime();
+ System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
+ double ms = (current - startTime).TotalMilliseconds;
+ long b = Convert.ToInt64(ms);
+ return b;
+ }
+ }
+}
diff --git a/BBWY.1688SDK/util/SignatureUtil.cs b/BBWY.1688SDK/util/SignatureUtil.cs
new file mode 100644
index 00000000..ceb22a28
--- /dev/null
+++ b/BBWY.1688SDK/util/SignatureUtil.cs
@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace com.alibaba.openapi.client.util
+{
+ public class SignatureUtil
+ {
+ public static byte[] hmacSha1(String path, Dictionary parameters, String signingKey)
+ {
+ List lists = new List();
+ foreach (KeyValuePair kvp in parameters)
+ {
+ lists.Add(kvp.Key + kvp.Value);
+ }
+ lists.Sort(StringComparer.Ordinal);
+ StringBuilder sb = new StringBuilder();
+ sb.Append(path);
+ foreach (String param in lists)
+ {
+ sb.Append(param);
+ }
+ String contentToHmac = sb.ToString();
+ byte[] byteToHmac = System.Text.Encoding.UTF8.GetBytes(contentToHmac);
+ byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(signingKey);
+ HMACSHA1 hmac = new HMACSHA1(byteArray);
+ byte[] hashValue = hmac.ComputeHash(byteToHmac, 0, byteToHmac.Length);
+ return hashValue;
+ }
+
+ public static string toHex( byte[] bytes)
+ {
+ char[] c = new char[bytes.Length * 2];
+
+ byte b;
+
+ for (int bx = 0, cx = 0; bx < bytes.Length; ++bx, ++cx)
+ {
+ b = ((byte)(bytes[bx] >> 4));
+ c[cx] = (char)(b > 9 ? b + 0x37 + 0x20 : b + 0x30);
+
+ b = ((byte)(bytes[bx] & 0x0F));
+ c[++cx] = (char)(b > 9 ? b + 0x37 + 0x20 : b + 0x30);
+ }
+
+ return new string(c).ToUpper();
+ }
+
+ public static byte[] hexToBytes( string str)
+ {
+ if (str.Length == 0 || str.Length % 2 != 0)
+ return new byte[0];
+
+ byte[] buffer = new byte[str.Length / 2];
+ char c;
+ for (int bx = 0, sx = 0; bx < buffer.Length; ++bx, ++sx)
+ {
+ // Convert first half of byte
+ c = str[sx];
+ buffer[bx] = (byte)((c > '9' ? (c > 'Z' ? (c - 'a' + 10) : (c - 'A' + 10)) : (c - '0')) << 4);
+
+ // Convert second half of byte
+ c = str[++sx];
+ buffer[bx] |= (byte)(c > '9' ? (c > 'Z' ? (c - 'a' + 10) : (c - 'A' + 10)) : (c - '0'));
+ }
+
+ return buffer;
+ }
+ }
+}
diff --git a/BBWY.Client/APIServices/OrderService.cs b/BBWY.Client/APIServices/OrderService.cs
index a170b632..b164607f 100644
--- a/BBWY.Client/APIServices/OrderService.cs
+++ b/BBWY.Client/APIServices/OrderService.cs
@@ -33,7 +33,7 @@ namespace BBWY.Client.APIServices
{
orderId,
startDate,
- EndDate = endDate.Date.AddDays(1).AddSeconds(-1),
+ endDate,
orderState,
pageIndex,
pageSize,
diff --git a/BBWY.Client/APIServices/PurchaseOrderService.cs b/BBWY.Client/APIServices/PurchaseOrderService.cs
index ba7d78e7..b6c37501 100644
--- a/BBWY.Client/APIServices/PurchaseOrderService.cs
+++ b/BBWY.Client/APIServices/PurchaseOrderService.cs
@@ -2,6 +2,7 @@
using BBWY.Common.Http;
using BBWY.Common.Models;
using System.Collections.Generic;
+using System.Linq;
using System.Net.Http;
namespace BBWY.Client.APIServices
@@ -48,5 +49,83 @@ namespace BBWY.Client.APIServices
null,
HttpMethod.Delete);
}
+
+ ///
+ /// 预览订单
+ ///
+ ///
+ ///
+ ///
+ public ApiResponse PreviewPurchaseOrder(Consignee consignee, IList purchaseSchemeProductSkuList, Platform purchasePlatform, PurchaseAccount purchaseAccount, PurchaseOrderMode purchaseOrderMode)
+ {
+ return SendRequest(globalContext.BBYWApiHost, "api/purchaseOrder/PreviewPurchaseOrder", new
+ {
+ purchaseOrderMode,
+ consignee,
+ CargoParamList = purchaseSchemeProductSkuList.Select(sku => new
+ {
+ ProductId = sku.PurchaseProductId,
+ SkuId = sku.PurchaseSkuId,
+ SpecId = sku.PurchaseSkuSpecId,
+ Quantity = sku.ItemTotal
+ }),
+ Platform = purchasePlatform,
+ AppKey = purchaseAccount.AppKey,
+ AppSecret = purchaseAccount.AppSecret,
+ AppToken = purchaseAccount.AppToken,
+ SaveResponseLog = true
+ }, null, HttpMethod.Post);
+ }
+
+ ///
+ /// 创建采购单
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public ApiResponse