1选品数据库及库存上传相关功能 2修复部分商品详情信息特殊符号导致无法上传问题
This commit is contained in:
1 parent
adf75f9fc1
commit
281cf2e338
38 files changed
+1496
-440
No files matched your search
@@ -137,6 +137,7 @@
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
|
||||
@@ -27,8 +27,8 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 372;
|
||||
//public static int VersionCount = 372;
|
||||
public static int VersionCount = 377;
|
||||
//public static int VersionCount = 377;
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
|
||||
@@ -13,10 +13,12 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace AllBase
|
||||
@@ -43,6 +45,74 @@ namespace AllBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取网络图片转为Img以在DataGridView中显示,用于HttpWebRequest直接读取可能403的情况
|
||||
/// </summary>
|
||||
/// <param name="imgUrl"></param>
|
||||
/// <param name="rst"></param>
|
||||
/// <returns></returns>
|
||||
public static Image GetUrlImg(string imgUrl, out string rst)
|
||||
{
|
||||
rst = "";
|
||||
//return LoadImage(imgUrl);
|
||||
Image image = null;
|
||||
HttpWebResponse response = null;
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(imgUrl);
|
||||
|
||||
request.KeepAlive = true;
|
||||
request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0");
|
||||
request.Headers.Add("Upgrade-Insecure-Requests", @"1");
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36";
|
||||
request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7";
|
||||
request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate");
|
||||
request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9");
|
||||
//request.IfModifiedSince = DateTime.Parse("Fri, 18 Jul 2025 06:00:49 GMT"); // 没改动不更新,CS程序无缓存不使用
|
||||
|
||||
response = (HttpWebResponse)request.GetResponse();
|
||||
|
||||
using (Stream stream = response.GetResponseStream())
|
||||
{
|
||||
image = Image.FromStream(stream);
|
||||
}
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
if (ex.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
response = (HttpWebResponse)ex.Response;
|
||||
rst = GetProxyHtml.ReadResponse(response);
|
||||
}
|
||||
if (string.IsNullOrEmpty(rst))
|
||||
rst = ex.Message;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
rst = e.Message;
|
||||
}
|
||||
if (response != null)
|
||||
{
|
||||
response.Close();
|
||||
response.Dispose();
|
||||
}
|
||||
return image;
|
||||
|
||||
//try
|
||||
//{
|
||||
// if (!string.IsNullOrEmpty(prodSelect?.main_img))
|
||||
// {
|
||||
// using (Stream stream = WebRequest.Create(prodSelect.main_img.Replace("https", "http")).GetResponse().GetResponseStream())
|
||||
// {
|
||||
// image = Image.FromStream(stream);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
//}
|
||||
}
|
||||
|
||||
public static Icon LoadIcon(string url)
|
||||
{
|
||||
try
|
||||
|
||||
@@ -24,5 +24,9 @@ namespace AllBase.Model.Result
|
||||
public DateTime add_time { get; set; }
|
||||
public DateTime mdy_time { get; set; }
|
||||
public string notes { get; set; }
|
||||
/// <summary>
|
||||
/// (某个店铺)上传次数
|
||||
/// </summary>
|
||||
public int select_count { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user