596 lines
49 KiB
C#
596 lines
49 KiB
C#
using AllBase;
|
||
using AllBase.Model.Result;
|
||
using AllBase.Model.Param.WXParam;
|
||
using Newtonsoft.Json.Linq;
|
||
using Newtonsoft.Json;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
|
||
namespace Work.Api.Wx
|
||
{
|
||
/// <summary>微信小店商品查询、发布、编辑、库存及清理接口;独立于原窗体,使用 HttpHelper 发送请求。</summary>
|
||
/// <remarks>传入原 ShopLoginInfo 登录信息;方法同步执行,界面调用请置于后台任务。返回原始正文,不自动登录、重试或解释业务状态。</remarks>
|
||
public static class WxProductApi
|
||
{
|
||
/// <summary>获取平台推荐商品及指定时间范围内的推荐表现。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="startMs">统计开始时间的 Unix 毫秒时间戳。</param>
|
||
/// <param name="endMs">统计结束时间的 Unix 毫秒时间戳。</param>
|
||
/// <param name="page">页码,从 1 开始。 默认值:1。</param>
|
||
/// <param name="pageSize">每页条数,默认值沿用原调用。 默认值:10。</param>
|
||
/// <param name="dateRange">统计区间对应的平台日期范围值,原调用使用 30 天。 默认值:30。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\BLL\Wx\WxPlatformRecommendProdManage.cs,WxPlatformRecommendProdManage.getPlatformRecommend。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GetPlatformRecommend(ShopLoginInfo shop, long startMs, long endMs, int page = 1, int pageSize = 10, int dateRange = 30)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradebase/cgi/shop/getShopRecommendProducts?token=&lang=zh_CN";
|
||
string data = @"{""isToday"":false,""offset"":" + Math.Max(0, page - 1) * pageSize + @",""limit"":" + pageSize + @",""sort"":[""product_view_uv"",""desc""]," + @"""time_query"":{""dateFormat"":2,""dateType"":0,""dateRange"":" + dateRange + @",""startMs"":" + startMs + @",""endMs"":" + endMs + @"}}";
|
||
string referer = "https://store.weixin.qq.com/shop/platformrecommend/recommendationFeed";
|
||
var result = WxHttpClient.Post(shop, url, data, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按销售状态查询商品列表,使用原平台推荐页面的排序方式。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="pageNum">页码,从 1 开始。 默认值:1。</param>
|
||
/// <param name="pageSize">每页条数,默认值沿用原调用。 默认值:50。</param>
|
||
/// <param name="status">商品销售状态:-1 全部、5 在售、11 下架,沿用原代码。 默认值:5。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\BLL\Wx\WxPlatformRecommendProdManage.cs,WxPlatformRecommendProdManage.searchProductWithSaleStatus。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchProductWithSaleStatus(ShopLoginInfo shop, int pageNum = 1, int pageSize = 50, int status = 5)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?token=&lang=zh_CN&pageSize=" + pageSize + "&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&fromProductManager=1&pageNum=" + pageNum + "&status[]=" + status + "&sortType=6";
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON¤tPage=" + pageNum;
|
||
var result = WxHttpClient.Get(shop, url, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>批量查询商品指标,用于平台推荐商品的数据分析。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="spuIdLst">微信商品 SPU ID 列表。</param>
|
||
/// <param name="pageNum">页码,从 1 开始。 默认值:1。</param>
|
||
/// <param name="pageSize">每页条数,默认值沿用原调用。 默认值:50。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\BLL\Wx\WxPlatformRecommendProdManage.cs,WxPlatformRecommendProdManage.getProductMetricList。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GetProductMetricList(ShopLoginInfo shop, List<string> spuIdLst, int pageNum = 1, int pageSize = 50)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/getProductMetricList?token=&lang=zh_CN";
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON¤tPage=" + pageNum;
|
||
string body = @"{""spuIds"":[""10000941685997"",""10000941606843"",""10000941606678"",""10000941814176"",""10000941730758"",""10000941794530"",""10000941656198"",""10000941838792"",""10000941813664"",""10000941507483"",""10000941644842"",""10000941511634"",""10000941566070"",""10000941773596"",""10000941605208"",""10000941768333"",""10000941442087"",""10000941595429"",""10000941600162"",""10000941382412"",""10000941506207"",""10000941599882"",""10000941743120"",""10000941708791"",""10000941480748"",""10000941505847"",""10000941377556"",""10000941327242"",""10000941519895"",""10000941574393"",""10000941708024"",""10000941543916"",""10000941445436"",""10000941287155"",""10000941297349"",""10000941543530"",""10000941603084"",""10000941360832"",""10000941484113"",""10000941137242"",""10000941468968"",""10000941271777"",""10000941563120"",""10000941528202"",""10000941226651"",""10000941136287"",""10000940942388"",""10000941389756"",""10000941261318"",""10000940962314""],""limit"":300,""offset"":0,""sortMetricCode"":""shopxspu_growth_pay_product_cnt_30d_2"",""sortRule"":""desc"",""sceneType"":""0""}";
|
||
var data = new Dictionary<string, object>();
|
||
data["spuIds"] = spuIdLst;
|
||
data["limit"] = pageSize * 6;
|
||
data["offset"] = 0;
|
||
data["sortMetricCode"] = "shopxspu_growth_pay_product_cnt_30d_2";
|
||
data["sortRule"] = "desc";
|
||
data["sceneType"] = "0";
|
||
body = JsonHelper.SerializeObject(data);
|
||
var result = WxHttpClient.Post(shop, url, body, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>修改商品 SKU 售价;结构化参数重载可提交完整价格变更列表。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="spuId">微信商品 SPU ID。</param>
|
||
/// <param name="skuId">商品规格 SKU ID。</param>
|
||
/// <param name="newPrice">新的 SKU 售价,单位为分,直接作为 salePrice 发送。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\OrderForms\WXOrderListForm.cs,WXOrderList.EditPrice。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string EditPrice(ShopLoginInfo shop, string spuId, string skuId, int newPrice)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/listingUpdatePrice?token=&lang=zh_CN";
|
||
string body = @"{""skuList"":[{""spuId"":" + spuId + @",""skuId"":""" + skuId + @""",""salePrice"":" + newPrice + @"}],""uploadSource"":6}";
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Post(shop, url, body, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>修改商品 SKU 售价;结构化参数重载可提交完整价格变更列表。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="priceData">包含 skuList 等字段的完整改价 JSON 对象;salePrice 单位为分。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\OrderForms\WXOrderListForm.cs,WXOrderList.EditPrice。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string EditPrice(ShopLoginInfo shop, JObject priceData)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/listingUpdatePrice?token=&lang=zh_CN";
|
||
string body = JsonHelper.SerializeObject(priceData);
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Post(shop, url, body, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按商品 ID 批量查询 SKU 库存明细。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="spuIds">逗号分隔的商品 ID 数值字符串,直接放入 productIdList 数组。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\OrderForms\WXOrderListForm.cs,WXOrderList.getSkuBySpu。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GetSkuBySpu(ShopLoginInfo shop, string spuIds)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/getStockBySpu?token=&lang=zh_CN";
|
||
string body = @"{""productIdList"":[" + spuIds + @"]}";
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Post(shop, url, body, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按增量增加指定 SKU 库存。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="spuId">微信商品 SPU ID。</param>
|
||
/// <param name="skuId">商品规格 SKU ID。</param>
|
||
/// <param name="num">增减库存件数的整数字符串,原代码直接写入 JSON 数值位置。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\OrderForms\WXOrderListForm.cs,WXOrderList.batchUpdateStockAdd。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string BatchUpdateStockAdd(ShopLoginInfo shop, string spuId, string skuId, string num)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/batchUpdateStock?token=&lang=zh_CN";
|
||
string body = @"{""skuList"":[{""spuId"":""" + spuId + @""",""skuId"":""" + skuId + @""",""diffType"":1,""num"":" + num + "}]}";
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Post(shop, url, body, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按减量减少指定 SKU 库存。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="spuId">微信商品 SPU ID。</param>
|
||
/// <param name="skuId">商品规格 SKU ID。</param>
|
||
/// <param name="num">增减库存件数的整数字符串,原代码直接写入 JSON 数值位置。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\OrderForms\WXOrderListForm.cs,WXOrderList.batchUpdateStockReduce。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string BatchUpdateStockReduce(ShopLoginInfo shop, string spuId, string skuId, string num)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/batchUpdateStock?token=&lang=zh_CN";
|
||
string body = @"{""skuList"":[{""spuId"":""" + spuId + @""",""skuId"":""" + skuId + @""",""diffType"":2,""num"":" + num + "}]}";
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Post(shop, url, body, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按商家商品编码查询在售商品,可追加第二个编码。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="extCode">商家商品编码,用于 spuCode 查询。</param>
|
||
/// <param name="extCode2">可选的第二个商家商品编码,非空时与第一个编码用逗号连接。 默认值:""。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.searchProduct。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchProductByCode(ShopLoginInfo shop, string extCode, string extCode2 = "")
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?" + "token=&lang=zh_CN&pageSize=20&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=1&status[]=5&spuCode=" + extCode;
|
||
if (!string.IsNullOrEmpty(extCode2))
|
||
url += "," + extCode2;
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON";
|
||
var result = WxHttpClient.Get(shop, url, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按微信商品 SPU ID 查询商品。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="spuId">微信商品 SPU ID。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.searchProductWithSpuId。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchProductWithSpuId(ShopLoginInfo shop, string spuId)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?" + "token=&lang=zh_CN&pageSize=20&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=1&status[]=-1&spuId=" + spuId;
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Get(shop, url, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>使用已经 URL 编码的标题查询商品。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="urlEncodeTitle">已经执行 UTF-8 URL 编码的商品标题,本方法不会再次编码。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.searchProductWithTitle。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchProductWithTitle(ShopLoginInfo shop, string urlEncodeTitle)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?" + "token=&lang=zh_CN&pageSize=20&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=1&status[]=-1&title=" + urlEncodeTitle;
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Get(shop, url, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>根据商品标题、图片和类目生成短标题。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="getShortTitleParam">短标题生成参数,包含原商品标题、图片及类目。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.genProductShortTitle。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GenProductShortTitle(ShopLoginInfo shop, WXGetShortTitleParam getShortTitleParam)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductupload/common/cgi/goods/genProductShortTitle?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry";
|
||
string body = JsonHelper.SerializeObject(getShortTitleParam);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>保存商品发布草稿;序列化时忽略 null 字段。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodParam">商品发布或编辑参数,沿用 AllBase 中的 WXUploadProductParam。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.uploadProductDraft。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string UploadProductDraft(ShopLoginInfo shop, WXUploadProductParam prodParam)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductupload/common/cgi/goods/uploadProductDraft?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry";
|
||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore
|
||
};
|
||
prodParam.type = 1;
|
||
var prodStr = JsonConvert.SerializeObject(prodParam, jsonSetting);
|
||
JObject jObj = new JObject();
|
||
jObj.Add("data", prodStr);
|
||
string body = JsonHelper.SerializeObject(jObj);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>提交商品发布或更新请求;序列化时忽略 null 字段。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodParam">商品发布或编辑参数,沿用 AllBase 中的 WXUploadProductParam。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.upProductV2。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string UpProductV2(ShopLoginInfo shop, WXUploadProductParam prodParam)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/upProductV2?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry";
|
||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore
|
||
};
|
||
var prodStr = JsonConvert.SerializeObject(prodParam, jsonSetting);
|
||
JObject jObj = new JObject();
|
||
jObj.Add("data", prodStr);
|
||
string body = JsonHelper.SerializeObject(jObj);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>查询商品草稿上传状态。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="productId">微信商品 ID。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.checkProductUpload。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string CheckProductUpload(ShopLoginInfo shop, string productId)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/checkUploadProductDraftStatus?token=&lang=zh_CN&productKey=%7B%22productId%22:" + productId + "%7D&preview=false";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + productId + "&isUpdateAuditFree=0&source=list_edit&continueEditInfo=" + "{%22isEditingContinued%22:false,%22lastEditDraftTime%22:0,%22listingTime%22:0}";
|
||
var result = WxHttpClient.Get(shop, url, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>在编辑状态商品列表中按商品 ID 查询上传结果。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="productId">微信商品 ID。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.SearchProductUpload。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchProductUpload(ShopLoginInfo shop, string productId)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?token=&lang=zh_CN&pageSize=20&productStatus[]=-1" + "&productSource=[1,16,32]&searchSource=1&useNew=true&fromProductManager=1&pageNum=1&status[]=2&spuId=" + productId;
|
||
string referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_EDIT";
|
||
var result = WxHttpClient.Get(shop, url, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>提交原始商品 JSON 发布或更新请求。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodStr">完整商品发布或编辑 JSON 字符串。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.upProductJObjectV2。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string UpProductJObjectV2(ShopLoginInfo shop, string prodStr)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/upProductV2?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry";
|
||
JObject jObj = new JObject();
|
||
jObj.Add("data", prodStr);
|
||
string body = JsonHelper.SerializeObject(jObj);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>获取商品编辑详情,用于在原商品数据基础上修改。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="productId">微信商品 ID。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.getEditProductV2。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GetEditProductV2(ShopLoginInfo shop, string productId)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/getEditProductV2?token=&lang=zh_CN&productKey=%7B%22productId%22:" + productId + "%7D&needRealStock=true&preview=false&release=false";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + productId + "&isUpdateAuditFree=0&source=list_edit&continueEditInfo={%22isEditingContinued%22:false,%22lastEditDraftTime%22:0,%22listingTime%22:0}";
|
||
var result = WxHttpClient.Get(shop, url, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>提交免审商品编辑;支持商品模型或原始 JSON 请求体。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodParam">商品发布或编辑参数,沿用 AllBase 中的 WXUploadProductParam。</param>
|
||
/// <param name="prodId">微信商品 ID。</param>
|
||
/// <param name="time1">原商品 lastEditDraftTime 值,按接口返回值透传到编辑页面上下文。</param>
|
||
/// <param name="time2">原商品 listingTime 值,按接口返回值透传到编辑页面上下文。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.listingAuditFree。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string ListingAuditFree(ShopLoginInfo shop, WXUploadProductParam prodParam, string prodId, int time1, int time2)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/listingAuditFree?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId + "&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" + "{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," + "%22listingTime%22:" + time2 + "}";
|
||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore
|
||
};
|
||
var prodStr = JsonConvert.SerializeObject(prodParam, jsonSetting);
|
||
JObject jObj = new JObject();
|
||
jObj.Add("data", prodStr);
|
||
string body = JsonHelper.SerializeObject(jObj);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>提交免审商品编辑;支持商品模型或原始 JSON 请求体。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodStr">完整商品发布或编辑 JSON 字符串。</param>
|
||
/// <param name="prodId">微信商品 ID。</param>
|
||
/// <param name="time1">原商品 lastEditDraftTime 值,按接口返回值透传到编辑页面上下文。</param>
|
||
/// <param name="time2">原商品 listingTime 值,按接口返回值透传到编辑页面上下文。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.listingAuditFree。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string ListingAuditFree(ShopLoginInfo shop, string prodStr, string prodId, int time1, int time2)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/listingAuditFree?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + prodId + "&isUpdateAuditFree=1&source=list_audit_free&continueEditInfo=" + "{%22isEditingContinued%22:true,%22lastEditDraftTime%22:" + time1 + "," + "%22listingTime%22:" + time2 + "}";
|
||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore
|
||
};
|
||
JObject jObj = new JObject();
|
||
jObj.Add("data", prodStr);
|
||
string body = JsonHelper.SerializeObject(jObj);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>获取商品信息的 AI 推荐内容。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="recommendParam">商品信息推荐参数,包含商品 ID 等原接口字段。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXDBProdUploadForm.cs,WXUpload.generalProductInfoRecommend。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GeneralProductInfoRecommend(ShopLoginInfo shop, WXUploadProductInfoRecommendParam recommendParam)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductupload/aiRecommendCompat/cgi/goods/generalProductInfoRecommend?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/entry?productId=" + recommendParam.productId + "&isUpdateAuditFree=0&source=list_edit&continueEditInfo={%22isEditingContinued%22:false,%22lastEditDraftTime%22:0,%22listingTime%22:0}";
|
||
JsonSerializerSettings jsonSetting = new JsonSerializerSettings
|
||
{
|
||
NullValueHandling = NullValueHandling.Ignore
|
||
};
|
||
string body = JsonConvert.SerializeObject(recommendParam, jsonSetting);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按状态、商品 ID 列表及排序查询商品,用于商品清理页面。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="pageNum">页码,从 1 开始。</param>
|
||
/// <param name="pageSize">每页条数,默认值沿用原调用。 默认值:50。</param>
|
||
/// <param name="prodIds">逗号分隔的商品 ID 字符串;批量操作直接放入 JSON 数组,不含方括号。 默认值:null。</param>
|
||
/// <param name="status">商品销售状态:-1 全部、5 在售、11 下架,沿用原代码。 默认值:5。</param>
|
||
/// <param name="sortType">商品排序的接口值;null 使用平台默认排序。 默认值:null。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisit260606Form.cs,WXClearNoVisit260606.searchProduct。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisitForm.cs,WXClearNoVisit.searchProduct。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchProduct(ShopLoginInfo shop, int pageNum, int pageSize = 50, string prodIds = null, int status = 5, int? sortType = null)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?token=&lang=zh_CN&" + "pageSize=" + pageSize + "&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=" + pageNum + "&status[]=" + status;
|
||
if (prodIds != null)
|
||
url += "&spuId=" + prodIds;
|
||
if (sortType != null)
|
||
url += "&sortType=" + sortType;
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list";
|
||
var result = WxHttpClient.Get(shop, url, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>批量下架商品。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodIds">逗号分隔的商品 ID 字符串;批量操作直接放入 JSON 数组,不含方括号。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisit260606Form.cs,WXClearNoVisit260606.DownProd。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisitForm.cs,WXClearNoVisit.DownProd。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdPreSaleForm.cs,WXProdNoCheckEditHelper.DownProd。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string DownProd(ShopLoginInfo shop, string prodIds)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/BatchUnListing?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/list";
|
||
string body = @"{""ids"":[" + prodIds + @"],""uploadSource"":6}";
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>批量删除商品至回收站。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodIds">逗号分隔的商品 ID 字符串;批量操作直接放入 JSON 数组,不含方括号。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisit260606Form.cs,WXClearNoVisit260606.DelProd。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisitForm.cs,WXClearNoVisit.DelProd。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdPreSaleForm.cs,WXProdNoCheckEditHelper.DelProd。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string DelProd(ShopLoginInfo shop, string prodIds)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/batchDel?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/list";
|
||
string body = @"{""ids"":[" + prodIds + @"],""uploadSource"":6}";
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>从回收站彻底删除商品;调用前由业务方确认目标商品。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodIds">逗号分隔的商品 ID 字符串;批量操作直接放入 JSON 数组,不含方括号。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisit260606Form.cs,WXClearNoVisit260606.RealDelProd。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdClearNoVisitForm.cs,WXClearNoVisit.RealDelProd。
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdPreSaleForm.cs,WXProdNoCheckEditHelper.RealDelProd。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string RealDelProd(ShopLoginInfo shop, string prodIds)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductlist/cgi/goods/batchRealDel?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_RECYCLE_BIN";
|
||
string body = @"{""ids"":[" + prodIds + @"],""uploadSource"":6}";
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>按预售类型、销售状态及排序查询商品。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="pageNum">页码,从 1 开始。</param>
|
||
/// <param name="presaleType">预售类型的接口筛选值;null 不增加预售类型筛选。 默认值:null。</param>
|
||
/// <param name="pageSize">每页条数,默认值沿用原调用。 默认值:50。</param>
|
||
/// <param name="sortType">商品排序的接口值;null 使用平台默认排序。 默认值:null。</param>
|
||
/// <param name="status">商品销售状态:-1 全部、5 在售、11 下架,沿用原代码。 默认值:5。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdPreSaleForm.cs,WXProdNoCheckEditHelper.searchProduct。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string SearchPresaleProduct(ShopLoginInfo shop, int pageNum, int? presaleType = null, int pageSize = 50, int? sortType = null, int status = 5)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?token=&lang=zh_CN&" + "pageSize=" + pageSize + "&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=" + pageNum + "&status[]=" + status;
|
||
if (presaleType != null)
|
||
url += "&presaleType[]=" + presaleType;
|
||
if (sortType != null)
|
||
url += "&sortType=" + sortType;
|
||
string refere = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON";
|
||
var result = WxHttpClient.Get(shop, url, refere);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>使用游标分页扫描商品预览信息。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="page">页码,从 1 开始。</param>
|
||
/// <param name="nextKey">上一页返回的游标,首页传空字符串。 默认值:""。</param>
|
||
/// <param name="pageSize">每页条数,默认值沿用原调用。 默认值:50。</param>
|
||
/// <param name="saleStatus">销售状态筛选值,原商品列表默认 5 表示在售。 默认值:5。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdPreSaleForm.cs,WXProdNoCheckEditHelper.scanProductPreview。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string ScanProductPreview(ShopLoginInfo shop, int page, string nextKey = "", int pageSize = 50, int saleStatus = 5)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/scanProductPreview?token=&lang=zh_CN";
|
||
string referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON";
|
||
if (page > 1)
|
||
referer = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON¤tPage=" + page;
|
||
JObject bodyObj = new JObject();
|
||
bodyObj["pageSize"] = pageSize;
|
||
bodyObj["productStatus"] = new JArray()
|
||
{
|
||
-1
|
||
};
|
||
bodyObj["productSource"] = "[1,16,32]";
|
||
bodyObj["searchSource"] = 1;
|
||
bodyObj["useNew"] = true;
|
||
bodyObj["pageNum"] = page;
|
||
bodyObj["status"] = new JArray()
|
||
{
|
||
saleStatus
|
||
};
|
||
if (!string.IsNullOrEmpty(nextKey))
|
||
{
|
||
bodyObj["nextKey"] = nextKey;
|
||
}
|
||
|
||
string body = JsonHelper.SerializeObject(bodyObj);
|
||
var result = WxHttpClient.Post(shop, url, body, referer);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>获取商品推广素材或链接信息。</summary>
|
||
/// <param name="shop">店铺登录信息;Cookies 为原程序保存的 CefSharp.Cookie 列表 JSON,图片上传还需 openid。</param>
|
||
/// <param name="prodId">微信商品 ID。</param>
|
||
/// <param name="pageId">页码,从 1 开始;部分接口仅用于页面 Referer。</param>
|
||
/// <returns>微信接口原始 JSON 正文;传输或登录参数配置失败可能返回错误文字。调用方须验证响应格式和业务状态,不能仅以非空判断成功。</returns>
|
||
/// <remarks>
|
||
/// 来源:TEMUKJD\WXForms\ProductForms\WXProdPreSaleForm.cs,WXProdNoCheckEditHelper.GetPromotionLink。
|
||
/// 原方法中直接拼接的 ID、JSON 数值片段应按上述格式传入;不会自动转义或转换单位。参数模型构造或序列化失败会向调用方抛出异常。
|
||
/// </remarks>
|
||
public static string GetPromotionLink(ShopLoginInfo shop, string prodId, int pageId)
|
||
{
|
||
string url = "https://store.weixin.qq.com/shop-faas/mmecnodematerial/product?token=&lang=zh_CN&productId=" + prodId;
|
||
string referer = "https://store.weixin.qq.com/shop/goods/list?currentPage=" + pageId;
|
||
var result = WxHttpClient.Get(shop, url, referer);
|
||
return result;
|
||
}
|
||
}
|
||
}
|