优化清理无流量逻辑 修复用户导入商品失败问题 图书上传资质文件逻辑完成
This commit is contained in:
1 parent
7d07c83579
commit
3514be2dba
16 files changed
+705
-340
No files matched your search
@@ -10,6 +10,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Printing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -88,7 +89,9 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
{
|
||||
int pageCount;
|
||||
decimal seconds = 0;
|
||||
var list = AdminGetServerQualificationImageLst(out pageCount, out seconds, page, ucSplitPage1.PageSize);
|
||||
var catName = "";
|
||||
Invoke(new Action(() => { catName = txtCatName.Text.Trim(); }));
|
||||
var list = AdminGetServerQualificationImageLst(out pageCount, out seconds, "", "", page, ucSplitPage1.PageSize);
|
||||
lstWxQualificationImageInfo.AddRange(list);
|
||||
this.ucSplitPage1.TotalPage = pageCount;
|
||||
|
||||
@@ -101,6 +104,7 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
image.cat_name,
|
||||
image.img_md5,
|
||||
Base64ChangeImgUrl.Base64ToImage(image.img_thumb_base64),
|
||||
image.txt_margin,
|
||||
"编辑",
|
||||
"删除");
|
||||
|
||||
@@ -149,28 +153,43 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
|
||||
switch (headerText)
|
||||
{
|
||||
case "进入店铺":
|
||||
//IsOperate = true;
|
||||
//{
|
||||
// WXAdminShopLoginForm adminLoginForm = new WXAdminShopLoginForm(shop);
|
||||
// adminLoginForm.openType = EnumOpenType.manage;
|
||||
// adminLoginForm.WindowState = FormWindowState.Maximized;
|
||||
// adminLoginForm.InitUrl = "https://store.weixin.qq.com/shop/home";
|
||||
// adminLoginForm.Show();
|
||||
//}
|
||||
//IsOperate = false;
|
||||
break;
|
||||
case "删除":
|
||||
if (BaseMsgForm.ShowConfirm("确定删除吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||
return;
|
||||
//if (ShopBLL.AdminDelServerShop(shop))
|
||||
// SearchImg(this.ucSplitPage1.CurrentPage);
|
||||
var url = BaseClass.BuildObjString("product/wx_del_qualification_image");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&img_md5=" + row.Cells["colImgMd5"].Value.ParseToString();
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (!html.Contains("\"code\":200"))
|
||||
BaseMsgForm.ShowError(BaseRegex.GetStringJsonByRegs(ref html, html, "msg"));
|
||||
SearchImg(ucSplitPage1.CurrentPage);
|
||||
break;
|
||||
case "编辑图片":
|
||||
var image = lstWxQualificationImageInfo.FirstOrDefault(i => i.img_md5 == row.Cells["colImgMd5"].Value.ParseToString());
|
||||
if (image != null)
|
||||
{
|
||||
image.img_base64.IsNullOrEmpty();
|
||||
if (image.img_base64.IsNullOrEmpty())
|
||||
{
|
||||
int pageCount;
|
||||
decimal seconds = 0;
|
||||
image.img_base64 = AdminGetServerQualificationImageLst(out pageCount, out seconds, "", image.img_md5).FirstOrDefault()?.img_base64;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (image.txt_margin.ParseToString().Split(',').Select(m => m.ParseToInt()).ToList() is List<int> marginValueList && marginValueList.Count == 4)
|
||||
{
|
||||
txtLeft.Text = marginValueList[0].ToString();
|
||||
txtTop.Text = marginValueList[1].ToString();
|
||||
txtRight.Text = marginValueList[2].ToString();
|
||||
txtBottom.Text = marginValueList[3].ToString();
|
||||
}
|
||||
var imageSource = Base64ChangeImgUrl.Base64ToImage(image.img_base64);
|
||||
LoadImg(imageSource);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
BaseMsgForm.ShowError("加载图片失败" + ex.Message);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
@@ -197,7 +216,7 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
return shopNameList;
|
||||
}
|
||||
|
||||
public List<wx_qualification_image_info> AdminGetServerQualificationImageLst(out int pageCount, out decimal seconds, int page = 1, int pageSize = 50)
|
||||
public static List<wx_qualification_image_info> AdminGetServerQualificationImageLst(out int pageCount, out decimal seconds, string cat_name="", string img_md5 = "", int page = 1, int pageSize = 200)
|
||||
{
|
||||
List<wx_qualification_image_info> list = new List<wx_qualification_image_info>();
|
||||
pageCount = 1;
|
||||
@@ -207,7 +226,15 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
var data = UserLogin.GetSignaturex() +
|
||||
"&page=" + page +
|
||||
"&page_size=" + pageSize;
|
||||
data += "&is_detail=true";
|
||||
if (!string.IsNullOrEmpty(img_md5))
|
||||
{
|
||||
data += "&img_md5=" + img_md5;
|
||||
data += "&is_detail=true";
|
||||
}
|
||||
if (!cat_name.IsNullOrEmpty())
|
||||
{
|
||||
data += "&cat_name=" + cat_name;
|
||||
}
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (!html.Contains("\"code\":200"))
|
||||
return list;
|
||||
@@ -240,33 +267,7 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
{
|
||||
string filePath = openFileDialog.FileName;
|
||||
Image imageSource = Image.FromFile(filePath);
|
||||
EmptyImage = new Bitmap(900, 1200);
|
||||
using (Graphics g = Graphics.FromImage(EmptyImage))
|
||||
{
|
||||
g.DrawImage(imageSource, new Rectangle(0, 0, EmptyImage.Width, EmptyImage.Height), 0, 0, imageSource.Width, imageSource.Height, GraphicsUnit.Pixel);
|
||||
}
|
||||
|
||||
string imgBase64 = "";
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
EmptyImage.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
byte[] imageBytes = memoryStream.ToArray();
|
||||
imgBase64 = Convert.ToBase64String(imageBytes);
|
||||
}
|
||||
|
||||
if (this.pictureBox1.Tag.ParseToString() != imgBase64)
|
||||
{
|
||||
this.pictureBox1.Tag = imgBase64;
|
||||
this.pictureBox1.ImageLocation = "";
|
||||
|
||||
Image image = new Bitmap(900, 1200);
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
{
|
||||
g.DrawImage(EmptyImage, new Rectangle(0, 0, image.Width, image.Height), 0, 0, EmptyImage.Width, EmptyImage.Height, GraphicsUnit.Pixel);
|
||||
}
|
||||
DrawText(image, txtLeft.Text.ParseToInt(), txtTop.Text.ParseToInt(), txtRight.Text.ParseToInt(), txtBottom.Text.ParseToInt());
|
||||
this.pictureBox1.Image = image;
|
||||
}
|
||||
LoadImg(imageSource);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -276,6 +277,32 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string imgBase64 = "";
|
||||
public void LoadImg(Image imageSource)
|
||||
{
|
||||
EmptyImage = new Bitmap(900, 1200);
|
||||
using (Graphics g = Graphics.FromImage(EmptyImage))
|
||||
{
|
||||
g.DrawImage(imageSource, new Rectangle(0, 0, EmptyImage.Width, EmptyImage.Height), 0, 0, imageSource.Width, imageSource.Height, GraphicsUnit.Pixel);
|
||||
}
|
||||
using (MemoryStream memoryStream = new MemoryStream())
|
||||
{
|
||||
EmptyImage.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
byte[] imageBytes = memoryStream.ToArray();
|
||||
imgBase64 = Convert.ToBase64String(imageBytes);
|
||||
}
|
||||
this.pictureBox1.ImageLocation = "";
|
||||
|
||||
Image image = new Bitmap(900, 1200);
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
{
|
||||
g.DrawImage(EmptyImage, new Rectangle(0, 0, image.Width, image.Height), 0, 0, EmptyImage.Width, EmptyImage.Height, GraphicsUnit.Pixel);
|
||||
}
|
||||
DrawText(image, txtLeft.Text.ParseToInt(), txtTop.Text.ParseToInt(), txtRight.Text.ParseToInt(), txtBottom.Text.ParseToInt());
|
||||
this.pictureBox1.Image = image;
|
||||
}
|
||||
|
||||
public static void DrawText(Image img, int _txtLeft, int _txtTop, int _txtRight, int _txtBottom)
|
||||
{
|
||||
if (img == null)
|
||||
@@ -385,6 +412,9 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
|
||||
private void txt_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (EmptyImage == null)
|
||||
return;
|
||||
|
||||
Image image = new Bitmap(900, 1200);
|
||||
using (Graphics g = Graphics.FromImage(image))
|
||||
{
|
||||
@@ -396,7 +426,7 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (pictureBox1.Tag.ParseToString().IsNullOrEmpty())
|
||||
if (imgBase64.IsNullOrEmpty())
|
||||
return;
|
||||
|
||||
var thumbImage = new Bitmap(90, 120);
|
||||
@@ -418,8 +448,8 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
data = UserLogin.GetSignaturex();
|
||||
data += "&img_md5=" + BaseClass.GetMd5(pictureBox1.Tag.ParseToString());
|
||||
data += "&img_base64=" + pictureBox1.Tag.ParseToString();
|
||||
data += "&img_md5=" + BaseClass.GetMd5(imgBase64);
|
||||
data += "&img_base64=" + imgBase64;
|
||||
data += "&txt_margin=" + txtLeft.Text.ParseToInt() + "," + txtTop.Text.ParseToInt() + "," + txtRight.Text.ParseToInt() + "," + txtBottom.Text.ParseToInt();
|
||||
data += "&img_thumb_base64=" + thumbBase64;
|
||||
}));
|
||||
@@ -428,6 +458,8 @@ namespace TemuKJD.WXForms.AdminForms
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
|
||||
SearchImg(ucSplitPage1.CurrentPage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user