1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Net.Http;
- using Codeplex.Data;
- namespace LYFZ.Weixin.SDK.Merchant
- {
-
-
-
- public class StockAPI
- {
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static dynamic Add(string access_token, string product_id, string sku_info, int quantity)
- {
- var client = new HttpClient();
- var content = new StringBuilder();
- content.Append("{")
- .Append('"' + "product_id" + '"' + ": " + '"' + product_id + '"').Append(",")
- .Append('"' + "sku_info" + '"' + ": " + '"' + product_id + '"').Append(",")
- .Append('"' + "quantity" + '"' + ": " + quantity).Append(",")
- .Append("}");
- var result = client.PostAsync(string.Format("https://api.weixin.qq.com/merchant/stock/add?access_token={0}", access_token),
- new StringContent(content.ToString())).Result;
- return DynamicJson.Parse(result.Content.ReadAsStringAsync().Result);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
- public static dynamic Reduce(string access_token, string product_id, string sku_info, int quantity)
- {
- var client = new HttpClient();
- var content = new StringBuilder();
- content.Append("{")
- .Append('"' + "product_id" + '"' + ": " + '"' + product_id + '"').Append(",")
- .Append('"' + "sku_info" + '"' + ": " + '"' + product_id + '"').Append(",")
- .Append('"' + "quantity" + '"' + ": " + quantity).Append(",")
- .Append("}");
- var result = client.PostAsync(string.Format("https://api.weixin.qq.com/merchant/stock/reduce?access_token={0}", access_token),
- new StringContent(content.ToString())).Result;
- return DynamicJson.Parse(result.Content.ReadAsStringAsync().Result);
- }
- }
- }
|