diff --git a/AllBase/AllBase.csproj b/AllBase/AllBase.csproj index d5ae41b..7f15f10 100644 --- a/AllBase/AllBase.csproj +++ b/AllBase/AllBase.csproj @@ -128,6 +128,7 @@ ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True + @@ -142,6 +143,7 @@ + False ..\DllReference\zxing.dll diff --git a/AllBase/GetHtml.cs b/AllBase/GetHtml.cs index 68c9f3a..fa6d368 100644 --- a/AllBase/GetHtml.cs +++ b/AllBase/GetHtml.cs @@ -55,6 +55,12 @@ namespace AllBase { rst = ""; //return LoadImage(imgUrl); + + if (imgUrl.Contains("wxapp")) + { + return ImageBuild.LoadBitmapLoadBitmipImageFromUrl(imgUrl, out rst); + } + Image image = null; HttpWebResponse response = null; try diff --git a/AllBase/ImageBuild.cs b/AllBase/ImageBuild.cs index b3da4a6..ceea493 100644 --- a/AllBase/ImageBuild.cs +++ b/AllBase/ImageBuild.cs @@ -5,7 +5,9 @@ using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.IO; using System.Linq; +using System.Net; using System.Runtime.InteropServices; +using System.Windows.Media.Imaging; namespace AllBase { @@ -587,6 +589,89 @@ namespace AllBase fs.Close(); return imgBytes; } + + public static Image LoadBitmapLoadBitmipImageFromUrl(string url, out string error) + { + try + { + BitmapImage bi = LoadBitmipImageFromUrl(url, out error); + return BitmapImageToSystemDrawingImage(bi); + } + catch (Exception e) + { + error = e.Message; + return null; + } + } + + public static Image BitmapImageToSystemDrawingImage(BitmapImage bitmapImage) + { + // 方法1 会乱码花屏 + //int width = bitmapImage.PixelWidth; + //int height = bitmapImage.PixelHeight; + //int stride = width * ((bitmapImage.Format.BitsPerPixel + 7) / 8); + + //byte[] pixels = new byte[stride * height]; + //bitmapImage.CopyPixels(pixels, stride, 0); + + //Bitmap bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); + //BitmapData bmpData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, bitmap.PixelFormat); + + //Marshal.Copy(pixels, 0, bmpData.Scan0, pixels.Length); + //bitmap.UnlockBits(bmpData); + + //return bitmap; + + // 方法2 + using (MemoryStream stream = new MemoryStream()) + { + BitmapEncoder encoder = new BmpBitmapEncoder(); + encoder.Frames.Add(BitmapFrame.Create(bitmapImage)); + encoder.Save(stream); + stream.Position = 0; + Bitmap bitmap = new Bitmap(stream); + stream.Close(); + + //// 现在你可以将这个Bitmap对象用于Windows Forms的PictureBox或其他图像显示控件 + //PictureBox pictureBox = new PictureBox(); + //pictureBox.Image = bitmap; // 或者如果你已经有了一个PictureBox控件,直接设置其Image属性 + return bitmap; + } + } + + public static BitmapImage LoadBitmipImageFromUrl(string url, out string error) + { + BitmapImage bitmap = new BitmapImage(); + error = ""; + + try + { + using (WebClient webClient = new WebClient()) + { + // 下载图片数据到内存流 + using (MemoryStream stream = new MemoryStream(webClient.DownloadData(url))) + { + stream.Position = 0; // 重置流的位置到开始处 + bitmap.BeginInit(); + bitmap.CreateOptions = BitmapCreateOptions.PreservePixelFormat; + bitmap.CacheOption = BitmapCacheOption.OnLoad; // 或者使用 BitmapCacheOption.OnLoad 以减少内存使用 + bitmap.UriSource = null; // 清除可能的旧UriSource,防止缓存问题 + bitmap.StreamSource = stream; + bitmap.EndInit(); + bitmap.Freeze(); // 防止后续更改,提高性能 + } + } + } + catch (Exception ex) + { + // 处理异常,例如打印错误信息或设置一个默认图片等 + //Console.WriteLine("Error loading image: " + ex.Message); + error = ex.Message; + return null; + } + + return bitmap; + } } public class ImagePiex { diff --git a/AllBase/Model/DBModel/user_payment_record.cs b/AllBase/Model/DBModel/user_payment_record.cs index a98a57b..591877b 100644 --- a/AllBase/Model/DBModel/user_payment_record.cs +++ b/AllBase/Model/DBModel/user_payment_record.cs @@ -10,7 +10,7 @@ namespace AllBase.Model.DBModel { public long id { get; set; } /// - /// 变动类型,1:充值,2:采购花费,3:产品退款到账,4:运费退款到账,5:采购收款,6:产品退款扣除,7:运费退款扣除,16:礼物单话费,20:中转运费,23:作废运费返还 + /// 变动类型,1:充值,2:采购花费,3:产品退款到账,4:运费退款到账,5:采购收款,6:产品退款扣除,7:运费退款扣除,16:礼物单话费,20:中转运费,23:作废运费返还 26退货包裹扣费 /// public int? type { get; set; } /// @@ -76,10 +76,12 @@ namespace AllBase.Model.DBModel //采购收款 = 5, //产品退款扣除 = 6, //运费退款扣除 = 7, - //礼物单支出 = 16, + 礼物单支出 = 16, 中转仓扣费支出 = 20, 中转仓作废返还收入 = 23, 中转仓超重支出 = 24, + 退货包裹扣费支出 = 26, 支付宝在线充值 = 30, + 云仓退货支出 = 31, } } diff --git a/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs b/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs index ba30c96..87df5f4 100644 --- a/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs +++ b/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs @@ -2137,6 +2137,12 @@ namespace KJD_Web.BLL.WXXD return_order_status = row["return_order_status"].ParseToNullableInt(), sender_info = row["sender_info"].ParseToNullableString(), sender_name = row["sender_name"].ParseToNullableString(), + sender_phone = row["sender_phone"].ParseToNullableString(), + shop_name = row["shop_name"].ParseToNullableString(), + updated_at = row["updated_at"].ParseToString().ParseToDateTime(), + warehouse_in_time = row["warehouse_in_time"].ParseToString().ParseToDateTime(), + warehouse_out_time = row["warehouse_out_time"].ParseToString().ParseToDateTime(), + warehouse_status = row["warehouse_status"].ParseToNullableInt(), }; orderList.Add(order); } diff --git a/KJDService/KJD_WebService/BLL/WXXD/WXUserManage.cs b/KJDService/KJD_WebService/BLL/WXXD/WXUserManage.cs index cf17158..9377ab2 100644 --- a/KJDService/KJD_WebService/BLL/WXXD/WXUserManage.cs +++ b/KJDService/KJD_WebService/BLL/WXXD/WXUserManage.cs @@ -379,14 +379,18 @@ namespace KJD_Web.BLL.WXXD string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); string sql = "delete from wxxd.user where id='" - + id + "'"; + + id + "' and balance=0"; - var rst = mySql.ExecuteNonQuery(sql); + var rst = mySql.ExecuteAffectedRows(sql); mySql.Close(); - if (rst) + if (rst > 0) { return "{\"code\":200,\"msg\":\"success\"}"; } + if (rst == 0) + { + return "{\"code\":500,\"msg\":\"删除失败,请检查账户拍单余额是否还有剩余\"}"; + } else return "{\"code\":500,\"msg\":\"删除失败,请稍后重试\"}"; } diff --git a/TEMUKJD/ToolForms/ShowImgForm.cs b/TEMUKJD/ToolForms/ShowImgForm.cs index 647a593..686813b 100644 --- a/TEMUKJD/ToolForms/ShowImgForm.cs +++ b/TEMUKJD/ToolForms/ShowImgForm.cs @@ -1,4 +1,5 @@ -using System; +using AllBase; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; @@ -24,7 +25,15 @@ namespace TemuKJD.ToolForms if (!string.IsNullOrEmpty(currentImgUrl)) { - this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + if (currentImgUrl.Contains("wxapp")) + { + string getImgError = ""; + this.pictureBox1.Image = ImageBuild.LoadBitmapLoadBitmipImageFromUrl(currentImgUrl, out getImgError); + } + else + { + this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + } //string getImgError = ""; //var image = AllBase.GetHtml.GetUrlImg(currentImgUrl, out getImgError); @@ -45,7 +54,17 @@ namespace TemuKJD.ToolForms if (!string.IsNullOrEmpty(currentImgUrl)) { if (picDic != null) - this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + { + if (currentImgUrl.Contains("wxapp")) + { + string getImgError = ""; + this.pictureBox1.Image = ImageBuild.LoadBitmapLoadBitmipImageFromUrl(currentImgUrl, out getImgError); + } + else + { + this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + } + } } } @@ -73,30 +92,31 @@ namespace TemuKJD.ToolForms case Keys.Enter: break; case Keys.Escape: this.Close(); break; case Keys.Space: - if (imgDic != null && imgDic.Keys.Count > 0) - { - for (int i = 0; i < imgDic.Keys.ToList().Count; i++) - { - if (imgDic.Keys.ToList()[i] == currentImgUrl) - { - int index = i + 1; - if (index == imgDic.Keys.Count) - index = 0; - currentImgUrl = imgDic.Keys.ToList()[index]; - this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); - break; - } - if (imgDic[imgDic.Keys.ToList()[i]] == currentImgUrl) - { - int index = i + 1; - if (index == imgDic.Keys.Count) - index = 0; - currentImgUrl = imgDic[imgDic.Keys.ToList()[index]]; - this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); - break; - } - } - } + //if (imgDic != null && imgDic.Keys.Count > 0) + //{ + // for (int i = 0; i < imgDic.Keys.ToList().Count; i++) + // { + // if (imgDic.Keys.ToList()[i] == currentImgUrl) + // { + // int index = i + 1; + // if (index == imgDic.Keys.Count) + // index = 0; + // currentImgUrl = imgDic.Keys.ToList()[index]; + // this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + // break; + // } + // if (imgDic[imgDic.Keys.ToList()[i]] == currentImgUrl) + // { + // int index = i + 1; + // if (index == imgDic.Keys.Count) + // index = 0; + // currentImgUrl = imgDic[imgDic.Keys.ToList()[index]]; + // this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + // break; + // } + // } + //} + pictureBox1_Click(null, null); break; } } @@ -175,7 +195,15 @@ namespace TemuKJD.ToolForms if (index == imgDic.Keys.Count) index = 0; currentImgUrl = imgDic.Keys.ToList()[index]; - this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + if (currentImgUrl.Contains("wxapp")) + { + string getImgError = ""; + this.pictureBox1.Image = ImageBuild.LoadBitmapLoadBitmipImageFromUrl(currentImgUrl, out getImgError); + } + else + { + this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + } break; } if (imgDic[imgDic.Keys.ToList()[i]] == currentImgUrl) @@ -184,7 +212,15 @@ namespace TemuKJD.ToolForms if (index == imgDic.Keys.Count) index = 0; currentImgUrl = imgDic[imgDic.Keys.ToList()[index]]; - this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + if (currentImgUrl.Contains("wxapp")) + { + string getImgError = ""; + this.pictureBox1.Image = ImageBuild.LoadBitmapLoadBitmipImageFromUrl(currentImgUrl, out getImgError); + } + else + { + this.pictureBox1.ImageLocation = currentImgUrl.Replace("https", "http"); + } break; } }