Merge branch 'master' of github.com:KJD2025/KJD

This commit is contained in:
wule committed 2026-09-16 15:16:37 +08:00
commit 1d8ad2c412
7 files changed
+337 -200

No files matched your search

+10 -3
View File
@@ -1166,7 +1166,14 @@ Mozilla/5.0+(Windows+NT+6.3;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.1+(KHTML,+like+Gecko)+Chrome/21.0.1180.89+Safari/537.1
Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/45.0.2454.101+Safari/537.36
Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.104 Safari/537.36 Core/1.53.2372.400 QQBrowser/9.5.10548.400";
public static async Task<string> PostJsonAsync(string url, object postData, int? timeOut = null)
{
return await PostUtf8Async(url, JsonHelper.SerializeObject(postData), contentType: "application/json", timeOut: timeOut);
}
public static async Task<string> PostJsonAsync(string url, string postData, int? timeOut = null)
{
return await PostUtf8Async(url, postData, contentType: "application/json", timeOut: timeOut);
}
/// <summary>
/// post 数据
/// </summary>
@@ -1297,7 +1304,7 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom
{
requestStream.Write(byteData, 0, byteData.Length);
}
HttpWebResponse response = (HttpWebResponse) await request.GetResponseAsync();
HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync();
Stream receiveStream = response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.GetEncoding(codeType));
@@ -1558,7 +1565,7 @@ Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrom
mywebclient.DownloadFile(Urlstring, FilePath);
return true;
}
catch(Exception ex)
catch (Exception ex)
{
return false;
}
@@ -16,6 +16,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
@@ -1605,6 +1606,9 @@ namespace TemuKJD.WXForms.ProductForms
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
{
PlatformType Platform = (dbProd.product_get_type_text == "多多" ? PlatformType.PDD : PlatformType.None);
#region 初始化上传商品对象
// 生成初始化上传商品对象
var upProdInitParam = new WXUploadProductInitParam();
@@ -2053,7 +2057,7 @@ namespace TemuKJD.WXForms.ProductForms
// 同颜色规格向上浮动同价格
if (chkSameSpecPriceUp.Checked)
{
var priceTextLst = dbProd.price_text.Split('-');
var priceTextLst = dbProd.price_text.ParseToString().Split('-');
if (priceTextLst.Length != 2 || priceTextLst[0] != priceTextLst[1])
{
Dictionary<string, int> specPriceDic = new Dictionary<string, int>();
@@ -2091,7 +2095,7 @@ namespace TemuKJD.WXForms.ProductForms
// 同颜色规格向下浮动同价格
if (chkSameSpecPriceDown.Checked)
{
var priceTextLst = dbProd.price_text.Split('-');
var priceTextLst = dbProd.price_text.ParseToString().Split('-');
if (priceTextLst.Length != 2 || priceTextLst[0] != priceTextLst[1])
{
Dictionary<string, int> specPriceDic = new Dictionary<string, int>();
@@ -2261,26 +2265,31 @@ namespace TemuKJD.WXForms.ProductForms
}
#endregion
var prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
#region 图片盗链映射生成字典(如果有)
Dictionary<string, ImageCache> wxImgMapDic = new Dictionary<string, ImageCache>(StringComparer.OrdinalIgnoreCase);
bool isChangeImgDic = false;
Dictionary<string, string> wxImgMapDic = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(dbProd.wx_img_map_json))
{
try
{
wxImgMapDic = JsonHelper.DeserializeJsonToObject<Dictionary<string, string>>(dbProd.wx_img_map_json);
}
catch
{
isChangeImgDic = true;
wxImgMapDic = new Dictionary<string, string>();
}
}
wxImgMapDic = GetImageCaches(prodInfo);
//Dictionary<string, string> wxImgMapDic = new Dictionary<string, string>();
//if (!string.IsNullOrEmpty(dbProd.wx_img_map_json))
//{
// try
// {
// wxImgMapDic = JsonHelper.DeserializeJsonToObject<Dictionary<string, string>>(dbProd.wx_img_map_json);
// }
// catch
// {
// isChangeImgDic = true;
// wxImgMapDic = new Dictionary<string, string>();
// }
//}
#endregion
#region 提取源商品详情,根据需要生成sku货号
var prodInfo = JsonHelper.DeserializeJsonToObject<PDDProductInfo>(dbProd.product_json);
// 如果没有货号或有相同货号无法区分sku,自定义货号
if (dbProd.db_type == "云端数据")
{
@@ -2522,8 +2531,10 @@ namespace TemuKJD.WXForms.ProductForms
// 获取缓存盗链 主图
if (wxImgMapDic.ContainsKey(BaseClass.GetMd5(gallery_item.url)))
{
upProdInitParam.product.info.headImg.Add(wxImgMapDic[BaseClass.GetMd5(gallery_item.url)]);
upProdParam.product.info.headImg.Add(wxImgMapDic[BaseClass.GetMd5(gallery_item.url)]);
Debug.WriteLine("主图:缓存");
var image = wxImgMapDic[BaseClass.GetMd5(gallery_item.url)];
upProdInitParam.product.info.headImg.Add(image.PlatformUrl);
upProdParam.product.info.headImg.Add(image.PlatformUrl);
continue;
}
@@ -2533,6 +2544,7 @@ namespace TemuKJD.WXForms.ProductForms
}
else
{
Debug.WriteLine("主图:上传");
// 使用接口链接传主图
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
@@ -2560,7 +2572,11 @@ namespace TemuKJD.WXForms.ProductForms
{
upProdInitParam.product.info.headImg.Add(upImgUrl);
upProdParam.product.info.headImg.Add(upImgUrl);
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = new ImageCache
{
Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl,
};
isChangeImgDic = true;
continue;
}
@@ -2615,7 +2631,12 @@ namespace TemuKJD.WXForms.ProductForms
{
upProdInitParam.product.info.headImg.Add(upImgUrl);
upProdParam.product.info.headImg.Add(upImgUrl);
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = new ImageCache
{
Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl,
};
isChangeImgDic = true;
continue;
}
@@ -2706,24 +2727,14 @@ namespace TemuKJD.WXForms.ProductForms
}
#endregion
#region 保存缓存盗链图片
if (isChangeImgDic && dbProd.db_type != "云端数据")
{
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex();
data += "&spu_id=" + dbProd.spu_id;
data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic);
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
SaveImageCaches(Platform, wxImgMapDic.Values);
isChangeImgDic = false;
}
#endregion
#region 识别类目
@@ -3464,7 +3475,9 @@ namespace TemuKJD.WXForms.ProductForms
// 获取缓存盗链 详情图
if (wxImgMapDic.ContainsKey(BaseClass.GetMd5(gallery_item.url)))
{
upProdParam.product.info.detail.detailImg.Add(wxImgMapDic[BaseClass.GetMd5(gallery_item.url)]);
Debug.WriteLine("详情图:缓存");
var image = wxImgMapDic[BaseClass.GetMd5(gallery_item.url)];
upProdParam.product.info.detail.detailImg.Add(image.PlatformUrl);
continue;
}
@@ -3474,6 +3487,7 @@ namespace TemuKJD.WXForms.ProductForms
}
else
{
Debug.WriteLine("详情图:上传");
// 使用接口链接传详情图
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
@@ -3500,7 +3514,11 @@ namespace TemuKJD.WXForms.ProductForms
if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl))
{
upProdParam.product.info.detail.detailImg.Add(upImgUrl);
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = new ImageCache
{
Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl,
};
isChangeImgDic = true;
continue;
}
@@ -3554,7 +3572,11 @@ namespace TemuKJD.WXForms.ProductForms
if (apiUpImgFileRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl))
{
upProdParam.product.info.detail.detailImg.Add(upImgUrl);
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = upImgUrl;
wxImgMapDic[BaseClass.GetMd5(gallery_item.url)] = new ImageCache
{
Md5 = BaseClass.GetMd5(gallery_item.url),
PlatformUrl = upImgUrl,
};
isChangeImgDic = true;
continue;
}
@@ -3584,21 +3606,8 @@ namespace TemuKJD.WXForms.ProductForms
#endregion
#region 保存缓存盗链图片
if (isChangeImgDic && dbProd.db_type != "云端数据")
{
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex();
data += "&spu_id=" + dbProd.spu_id;
data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic);
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
SaveImageCaches(Platform, wxImgMapDic.Values);
isChangeImgDic = false;
}
#endregion
@@ -4531,12 +4540,15 @@ namespace TemuKJD.WXForms.ProductForms
// 获取缓存盗链 sku图
if (wxImgMapDic.ContainsKey(BaseClass.GetMd5(sku.thumb_url)))
{
attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)], });
Debug.WriteLine("SKU图:缓存");
var image = wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)];
attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = image.PlatformUrl, });
continue;
}
// 使用接口链接传sku图
if (1 == 1 && !sku.thumb_url.Contains("wst.wxapp.tc.qq.com"))
{
Debug.WriteLine("SKU图:上传");
var urlImg = BaseClass.BuildWXImgObjString("product/wx_api_upload_image");
var upDate = UserLogin.GetSignaturex();
upDate += "&token=" + token.accessToken;
@@ -4562,7 +4574,11 @@ namespace TemuKJD.WXForms.ProductForms
if (upDateRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl))
{
attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = upImgUrl, });
wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)] = upImgUrl;
wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)] = new ImageCache
{
Md5 = BaseClass.GetMd5(sku.thumb_url),
PlatformUrl = upImgUrl,
};
isChangeImgDic = true;
continue; // 传图成功跳过模拟上传
}
@@ -4612,7 +4628,11 @@ namespace TemuKJD.WXForms.ProductForms
if (apiUpImgFileRst.Contains("\"errcode\":0") && !string.IsNullOrEmpty(upImgUrl))
{
attrParam.items.Add(new productSaleAttrItemParam() { value = spec.spec_name, imgUrl = upImgUrl, });
wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)] = upImgUrl;
wxImgMapDic[BaseClass.GetMd5(sku.thumb_url)] = new ImageCache
{
Md5 = BaseClass.GetMd5(sku.thumb_url),
PlatformUrl = upImgUrl,
};
isChangeImgDic = true;
continue;
}
@@ -4658,21 +4678,8 @@ namespace TemuKJD.WXForms.ProductForms
#endregion
#region 保存缓存盗链图片
if (isChangeImgDic && dbProd.db_type != "云端数据")
{
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex();
data += "&spu_id=" + dbProd.spu_id;
data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic);
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
SaveImageCaches(Platform, wxImgMapDic.Values);
isChangeImgDic = false;
}
#endregion
@@ -5798,21 +5805,8 @@ namespace TemuKJD.WXForms.ProductForms
}
#region 保存缓存盗链图片
if (isChangeImgDic && dbProd.db_type != "云端数据")
{
var url = BaseClass.BuildObjString("product/mdy_pdd_product");
var data = "";
Invoke(new Action(() =>
{
data = UserLogin.GetSignaturex();
data += "&spu_id=" + dbProd.spu_id;
data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic);
}));
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url, data);
SaveImageCaches(Platform, wxImgMapDic.Values);
isChangeImgDic = false;
}
#endregion
@@ -7363,6 +7357,101 @@ namespace TemuKJD.WXForms.ProductForms
{
globalShopUploadCntLimitRetryTimes = numJumpCnt.Value.ParseToInt();
}
/// <summary>
/// 获取图片缓存
/// </summary>
/// <param name="product"></param>
private Dictionary<string, ImageCache> GetImageCaches(PDDProductInfo product)
{
Dictionary<string, ImageCache> wxImgMapDic = new Dictionary<string, ImageCache>(StringComparer.OrdinalIgnoreCase);
if (EnvironmentHelper.IsProduction)
{
return wxImgMapDic;
}
List<string> imageUrls = new List<string>();
imageUrls.AddRange(product.detail.galleries.Where(g => g.type == 1).Take(9).Select(a => a.url));
var temp_detailGalleries = product.detail.galleries.Where(g => g.type == 2).ToList();
if (temp_detailGalleries.Count == 0)
temp_detailGalleries.Add(new gallery_item() { type = 2, url = product.detail.galleries.FirstOrDefault(g => g.type == 1)?.url });
imageUrls.AddRange(temp_detailGalleries.Select(a => a.url));
if (product.detail.sku.FirstOrDefault()?.spec?.Count > 0)
{
imageUrls.AddRange(product.detail.sku.Select(a => a.thumb_url));
}
List<string> imageUrlMd5s = imageUrls.Select(a => BaseClass.GetMd5(a)).ToList();
var url = BaseClass.BuildObjString("ImageCache/GetImageCache");//获取缓存
var data = JsonConvert.SerializeObject(new
{
md5s = imageUrlMd5s
});
var html = GetHtml.PostUtf8(url, data, contentType: "application/json");
if (string.IsNullOrEmpty(html))
html = GetHtml.PostUtf8(url, data);
var ret = JsonConvert.DeserializeObject<Result<List<ImageCache>>>(html);
if (ret.Code == 200)
{
foreach (var item in ret.Data)
{
item.IsCache = true;
wxImgMapDic[item.Md5] = item;
}
}
return wxImgMapDic;
}
/// <summary>
/// 保存缓存图片
/// </summary>
/// <param name="platform"></param>
/// <param name="images"></param>
private void SaveImageCaches(PlatformType platform, IEnumerable<ImageCache> images)
{
if (EnvironmentHelper.IsProduction)
{
return;
}
var url = BaseClass.BuildObjString("ImageCache/AddOrUpdate");
var data = "";
data = JsonHelper.SerializeObject(images.Where(a => a.IsCache == false).Select(a =>
new
{
md5 = a.Md5,
Platform = platform,
PlatformUrl = a.PlatformUrl
}
));
var html = GetHtml.PostUtf8(url, data, contentType: "application/json");
if (string.IsNullOrEmpty(html))
html = GetHtml.PostUtf8(url, data);
var ret = JsonConvert.DeserializeObject<Result<JToken>>(html);
List<string> failed = new List<string>();
if (ret.Code == 500)
{
if (ret.Data is JArray jArray)
{
failed = jArray.ToObject<List<string>>() ?? new List<string>();
}
else if (ret.Data is JValue jValue && jValue.Value is string str)
{
failed.Add(str);
}
}
foreach (ImageCache item in images)
{
item.IsCache = !failed.Contains(item.Md5, StringComparer.OrdinalIgnoreCase);
}
}
}
public class WXUpload
@@ -7868,4 +7957,13 @@ Content-Type: application/octet-stream
/// </summary>
public bool IsUseShanghaiReturnOrderAddress { get; set; } = false;
}
class ImageCache
{
public string Md5 { get; set; }
public int Platform { get; set; }
[JsonProperty("platform_url")]
public string PlatformUrl { get; set; }
public bool IsCache { get; set; }
}
}
+57 -56
View File
@@ -29,14 +29,14 @@ namespace TemuKJD.WXForms.ShopForms
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle();
this.splitContainer5 = new System.Windows.Forms.SplitContainer();
this.pnlSuperManage = new System.Windows.Forms.Panel();
this.label10 = new System.Windows.Forms.Label();
@@ -115,6 +115,7 @@ namespace TemuKJD.WXForms.ShopForms
this.btnTopUpCancel = new DevComponents.DotNetBar.PanelEx();
this.btnTopUpOK = new DevComponents.DotNetBar.PanelEx();
this.dgvUser = new TemuKJD.UserComponent.DataGridViewEx();
this.btnExportShopErp = new DevComponents.DotNetBar.PanelEx();
this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.UserIdColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.UserNickNameColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -143,7 +144,6 @@ namespace TemuKJD.WXForms.ShopForms
this.colChangeGiftOemAmountPerOrder = new System.Windows.Forms.DataGridViewLinkColumn();
this.editColumn = new System.Windows.Forms.DataGridViewLinkColumn();
this.deleteColumn = new System.Windows.Forms.DataGridViewLinkColumn();
this.btnExportShopErp = new DevComponents.DotNetBar.PanelEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer5)).BeginInit();
this.splitContainer5.Panel1.SuspendLayout();
this.splitContainer5.Panel2.SuspendLayout();
@@ -1249,20 +1249,20 @@ namespace TemuKJD.WXForms.ShopForms
//
this.dgvUser.AllowUserToAddRows = false;
this.dgvUser.AllowUserToDeleteRows = false;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(249)))), ((int)(((byte)(249)))));
this.dgvUser.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(249)))), ((int)(((byte)(249)))), ((int)(((byte)(249)))));
this.dgvUser.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.dgvUser.AutoRowNumber = true;
this.dgvUser.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvUser.BackgroundColor = System.Drawing.Color.White;
this.dgvUser.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvUser.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvUser.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.dgvUser.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvUser.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colCheck,
@@ -1304,6 +1304,31 @@ namespace TemuKJD.WXForms.ShopForms
this.dgvUser.TabIndex = 1;
this.dgvUser.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvUser_CellContentClick);
//
// btnExportShopErp
//
this.btnExportShopErp.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnExportShopErp.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExportShopErp.DisabledBackColor = System.Drawing.Color.Empty;
this.btnExportShopErp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExportShopErp.Location = new System.Drawing.Point(0, 1);
this.btnExportShopErp.Name = "btnExportShopErp";
this.btnExportShopErp.Size = new System.Drawing.Size(140, 25);
this.btnExportShopErp.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportShopErp.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportShopErp.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportShopErp.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnExportShopErp.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnExportShopErp.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnExportShopErp.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnExportShopErp.Style.GradientAngle = 90;
this.btnExportShopErp.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportShopErp.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportShopErp.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportShopErp.TabIndex = 439;
this.btnExportShopErp.Text = "导出用户到后台系统";
this.btnExportShopErp.Visible = false;
this.btnExportShopErp.Click += new System.EventHandler(this.btnExportShopErp_Click);
//
// colCheck
//
this.colCheck.FillWeight = 30F;
@@ -1417,12 +1442,13 @@ namespace TemuKJD.WXForms.ShopForms
//
// colPlus
//
dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colPlus.DefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colPlus.DefaultCellStyle = dataGridViewCellStyle3;
this.colPlus.FillWeight = 22F;
this.colPlus.HeaderText = "+";
this.colPlus.Name = "colPlus";
this.colPlus.ReadOnly = true;
this.colPlus.Visible = false;
//
// colShopPointsPerMonth
//
@@ -1433,8 +1459,8 @@ namespace TemuKJD.WXForms.ShopForms
//
// colChangePointsPerMonth
//
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangePointsPerMonth.DefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangePointsPerMonth.DefaultCellStyle = dataGridViewCellStyle4;
this.colChangePointsPerMonth.FillWeight = 25F;
this.colChangePointsPerMonth.HeaderText = "改";
this.colChangePointsPerMonth.Name = "colChangePointsPerMonth";
@@ -1450,8 +1476,8 @@ namespace TemuKJD.WXForms.ShopForms
//
// colBalancePlus
//
dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colBalancePlus.DefaultCellStyle = dataGridViewCellStyle13;
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colBalancePlus.DefaultCellStyle = dataGridViewCellStyle5;
this.colBalancePlus.FillWeight = 22F;
this.colBalancePlus.HeaderText = "+";
this.colBalancePlus.Name = "colBalancePlus";
@@ -1467,8 +1493,8 @@ namespace TemuKJD.WXForms.ShopForms
//
// colChangePostagePerOrder
//
dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangePostagePerOrder.DefaultCellStyle = dataGridViewCellStyle14;
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangePostagePerOrder.DefaultCellStyle = dataGridViewCellStyle6;
this.colChangePostagePerOrder.FillWeight = 25F;
this.colChangePostagePerOrder.HeaderText = "改";
this.colChangePostagePerOrder.Name = "colChangePostagePerOrder";
@@ -1483,8 +1509,8 @@ namespace TemuKJD.WXForms.ShopForms
//
// colChangeRefundPostagePerOrder
//
dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangeRefundPostagePerOrder.DefaultCellStyle = dataGridViewCellStyle15;
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangeRefundPostagePerOrder.DefaultCellStyle = dataGridViewCellStyle7;
this.colChangeRefundPostagePerOrder.FillWeight = 25F;
this.colChangeRefundPostagePerOrder.HeaderText = "改";
this.colChangeRefundPostagePerOrder.Name = "colChangeRefundPostagePerOrder";
@@ -1501,8 +1527,8 @@ namespace TemuKJD.WXForms.ShopForms
//
// colChangeGiftOemAmountPerOrder
//
dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangeGiftOemAmountPerOrder.DefaultCellStyle = dataGridViewCellStyle16;
dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight;
this.colChangeGiftOemAmountPerOrder.DefaultCellStyle = dataGridViewCellStyle8;
this.colChangeGiftOemAmountPerOrder.FillWeight = 25F;
this.colChangeGiftOemAmountPerOrder.HeaderText = "改";
this.colChangeGiftOemAmountPerOrder.Name = "colChangeGiftOemAmountPerOrder";
@@ -1528,31 +1554,6 @@ namespace TemuKJD.WXForms.ShopForms
this.deleteColumn.ReadOnly = true;
this.deleteColumn.Visible = false;
//
// btnExportShopErp
//
this.btnExportShopErp.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnExportShopErp.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExportShopErp.DisabledBackColor = System.Drawing.Color.Empty;
this.btnExportShopErp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExportShopErp.Location = new System.Drawing.Point(0, 1);
this.btnExportShopErp.Name = "btnExportShopErp";
this.btnExportShopErp.Size = new System.Drawing.Size(140, 25);
this.btnExportShopErp.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportShopErp.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportShopErp.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportShopErp.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnExportShopErp.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnExportShopErp.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnExportShopErp.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnExportShopErp.Style.GradientAngle = 90;
this.btnExportShopErp.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportShopErp.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportShopErp.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportShopErp.TabIndex = 439;
this.btnExportShopErp.Text = "导出用户到后台系统";
this.btnExportShopErp.Visible = false;
this.btnExportShopErp.Click += new System.EventHandler(this.btnExportShopErp_Click);
//
// WXOemAccountForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@@ -332,8 +332,11 @@ namespace TemuKJD.WXForms.ShopForms
this.txtSearch.GotFocus += TxtSearch_GotFocus;
this.txtSearch.LostFocus += TxtSearch_LostFocus;
if (colPoints.Visible == true && colPlus.Visible == true)
{
this.dgvUser.AddMergeColumn(new List<string> { "colPoints", "colPlus" });
this.dgvUser.AddMergeColumnHeader(new List<string> { "colPoints", "colPlus" }, "积分点数");
}
this.dgvUser.AddMergeColumn(new List<string> { "colShopPointsPerMonth", "colChangePointsPerMonth" });
this.dgvUser.AddMergeColumnHeader(new List<string> { "colShopPointsPerMonth", "colChangePointsPerMonth" }, "月费耗点");
this.dgvUser.AddMergeColumn(new List<string> { "colBalance", "colBalancePlus" });
+3 -2
View File
@@ -77,9 +77,10 @@ namespace TemuKJD.WXForms.ShopForms
{
hideNames.Remove("评分考核");
}
if (BaseClass.UserAuthority.Contains("充值用户") && BaseClass.GroupId == 3 && BaseClass.AgentCode.IsNullOrEmpty() && BaseClass.OemId.IsNullOrEmpty())
//if (BaseClass.UserAuthority.Contains("充值用户") && BaseClass.GroupId == 3 && BaseClass.AgentCode.IsNullOrEmpty() && BaseClass.OemId.IsNullOrEmpty())
if (BaseClass.UserAuthority.Contains("充值用户") && BaseClass.GroupId == 3)
{
//hideNames.Remove("积分充值");
hideNames.Remove("积分充值");
}
if (!BaseClass.OemId.IsNullOrEmpty() && BaseClass.IsOemOwner)
{
+26 -15
View File
@@ -28,8 +28,8 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
@@ -358,7 +358,7 @@
this.cmbGroup.DropDownWidth = 1;
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.IntegralHeight = false;
this.cmbGroup.Location = new System.Drawing.Point(385, 8);
this.cmbGroup.Location = new System.Drawing.Point(385, 5);
this.cmbGroup.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(74, 25);
@@ -384,7 +384,7 @@
this.cmbNotes.DropDownWidth = 1;
this.cmbNotes.FormattingEnabled = true;
this.cmbNotes.IntegralHeight = false;
this.cmbNotes.Location = new System.Drawing.Point(276, 8);
this.cmbNotes.Location = new System.Drawing.Point(276, 5);
this.cmbNotes.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbNotes.Name = "cmbNotes";
this.cmbNotes.Size = new System.Drawing.Size(74, 25);
@@ -517,7 +517,7 @@
this.cmbSubAccount.DropDownWidth = 1;
this.cmbSubAccount.FormattingEnabled = true;
this.cmbSubAccount.IntegralHeight = false;
this.cmbSubAccount.Location = new System.Drawing.Point(506, 8);
this.cmbSubAccount.Location = new System.Drawing.Point(506, 5);
this.cmbSubAccount.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbSubAccount.Name = "cmbSubAccount";
this.cmbSubAccount.Size = new System.Drawing.Size(74, 25);
@@ -659,10 +659,21 @@
10000,
0,
0,
0});
this.numAddTopUp.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numAddTopUp.Name = "numAddTopUp";
this.numAddTopUp.ReadOnly = true;
this.numAddTopUp.Size = new System.Drawing.Size(36, 23);
this.numAddTopUp.TabIndex = 1;
this.numAddTopUp.Value = new decimal(new int[] {
1,
0,
0,
0});
this.numAddTopUp.ValueChanged += new System.EventHandler(this.numAddTopUp_ValueChanged);
//
// label8
@@ -771,20 +782,20 @@
//
this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvShop.AutoRowNumber = true;
this.dgvShop.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect,
+57 -41
View File
@@ -3,14 +3,17 @@ using AllBase.Helper;
using AllBase.Model.Result;
using NaiBa.Util;
using NaiBa.Util.Extension;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -18,6 +21,8 @@ using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using Work;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
//using TemuKJD.PDDForms.AdminForms;
namespace TemuKJD.WXForms.ShopForms
@@ -283,7 +288,8 @@ namespace TemuKJD.WXForms.ShopForms
int i = 1;
foreach (var shopInfo in shopInfoLst)
{
Invoke(new Action(() => {
Invoke(new Action(() =>
{
this.statusBar.pgbTaskProgress.Value = i;
this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count;
i++;
@@ -305,7 +311,8 @@ namespace TemuKJD.WXForms.ShopForms
int i = 1;
foreach (var shopInfo in shopInfoLst)
{
Invoke(new Action(() => {
Invoke(new Action(() =>
{
this.statusBar.pgbTaskProgress.Value = i;
this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count;
this.statusBar.pgbTaskProgress.Maximum = shopInfoLst.Count;
@@ -419,7 +426,7 @@ namespace TemuKJD.WXForms.ShopForms
this.btnImport.Enabled = true;
}
private void RefreshDataGridView(bool updateStatus=true, List<ShopLoginInfo> shopUpdateLst = null)
private void RefreshDataGridView(bool updateStatus = true, List<ShopLoginInfo> shopUpdateLst = null)
{
if (isLoading)
{
@@ -454,7 +461,7 @@ namespace TemuKJD.WXForms.ShopForms
}));
var shopList = GlobalConfig.ShopLoginList.Where(s => !string.IsNullOrEmpty(s.ShopId)
|| GlobalConfig.ShopLoginList.Where(ss=>ss.LoginName == s.LoginName).Count() == 1)
|| GlobalConfig.ShopLoginList.Where(ss => ss.LoginName == s.LoginName).Count() == 1)
/*.OrderBy(s=>s.LoginName)*/.ToList();
Invoke(new Action(() =>
@@ -709,7 +716,7 @@ namespace TemuKJD.WXForms.ShopForms
}
else
{
foreach(var sc in campanys)
foreach (var sc in campanys)
{
sc.LoginStatus = "登录成功";
sc.LastRefreshDate = DateTime.Now.ToString("yyyyMMdd");
@@ -858,7 +865,7 @@ namespace TemuKJD.WXForms.ShopForms
foreach (var shopCook in cooks)
{
var cookie = shopCook.Name + "=" + shopCook.Value;
if (!keys.Any(k=>cookie.StartsWith(k)))
if (!keys.Any(k => cookie.StartsWith(k)))
continue;
cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';";
}
@@ -927,7 +934,7 @@ namespace TemuKJD.WXForms.ShopForms
case "续期":
lblShopId.Text = shop.ShopId;
lblShopInfo.Text = shop.ShopAccount;
numAddTopUp.Value = 0;
numAddTopUp.Value = 1;
pnlTopUp.Visible = true;
break;
//case "多重登录":
@@ -968,7 +975,7 @@ namespace TemuKJD.WXForms.ShopForms
List<DataGridViewRow> dgvRows = dgvShop.Rows.Cast<DataGridViewRow>().Where(p =>
p.Cells.GetCellValueFromColumnName("colLoginName").ParseToString() == shopLoginName).ToList();
foreach(var row in dgvRows)
foreach (var row in dgvRows)
dgvShop.Rows.Remove(row);
GlobalConfig.ShopLoginList.RemoveAll(v => v.LoginName == shopLoginName);
}
@@ -1222,52 +1229,47 @@ namespace TemuKJD.WXForms.ShopForms
pnlTopUp.Visible = false;
}
private void btnTopUpOK_Click(object sender, EventArgs e)
private async void btnTopUpOK_Click(object sender, EventArgs e)
{
try
{
//var row = pnlTopUp.Tag as DataGridViewRow;
//if (row == null)
// return;
//var shopId = row.Cells["colShopId"].Value.ParseToString();
//if (shopId == null)
// return;
//var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
//if (shop == null)
// return;
var shopIds = lblShopId.Text.Split(';');
string errMsg = "";
int renew_months = (int)numAddTopUp.Value;//续费月数
renew_months = Math.Max(1, renew_months);
if (BaseMsgForm.ShowConfirm($"[{lblShopInfo.Text}] 店铺续费:{renew_months}个月", "提示").DialogResult == DialogResult.Cancel)
{
return;
}
pbLoading.Visible = true;
pbLoading.BringToFront();
string errMsg = "";
Task.Run(() =>
{
foreach (var shopId in shopIds)
{
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null)
continue;
string url = BaseClass.BuildObjString("user/update_user_points");
string data = UserLogin.GetSignaturex();
data += "&update_user_name=" + BaseClass.UserName;
data += "&update_user_nick=" + BaseClass.NickName;
data += "&option_type=" + "续费";
data += "&operator_type=" + "用户";
data += "&operator_name=" + BaseClass.UserName;
data += "&delta_points=" + (numAddTopUp.Value * BaseClass.ShopPointsPerMonth).ParseToInt();
data += "&shop_id=" + shopId;
data += "&shop_account=" + shop.ShopAccount;
string html = GetHtml.PostUtf8(url, data.ToString()).Trim();
Thread.Sleep(100);
if (!html.Contains("\"code\":200"))
string url = BaseClass.BuildObjString("user/shop_renew");
var data = UserLogin.GetSignPostData(new
{
var msg = BaseRegex.GetStringJsonByRegs(ref html, html, "msg");
errMsg += shop.ShopAccount + ":" + msg + " ";
UserName = BaseClass.UserName,
ShopId = shopId,
RenewDuration = renew_months,
});
string html = await GetHtml.PostJsonAsync(url, data);
var ret = JsonConvert.DeserializeObject<Result<ShopRenewResponse>>(html);
if (ret.Code != 200)
{
errMsg += $"shop.ShopAccount:{ret.Msg}";
continue;
}
shop.expire_time = BaseRegex.GetIntJson(ref html, "newExpireTime");
shop.expire_time = ret.Data.ExpireTime;
shop.is_point_shop_expire = false;
BaseClass.Points = BaseRegex.GetIntJson(ref html, "newUserPoints");
BaseClass.Points = ret.Data.UserPoints;
Invoke(new Action(() =>
{
MainForm.instance.lblPoints.Text = "账户积分:" + BaseClass.Points;
@@ -1287,7 +1289,15 @@ namespace TemuKJD.WXForms.ShopForms
BaseMsgForm.ShowInfo("充值完成 发生以下错误:\r\n" + errMsg);
}
}));
});
}
catch (Exception ex)
{
}
finally
{
pbLoading.Visible = false;
}
}
private void numAddTopUp_ValueChanged(object sender, EventArgs e)
@@ -1302,8 +1312,14 @@ namespace TemuKJD.WXForms.ShopForms
lblShopId.Text = string.Join(";", shops.Select(s => s.ShopId));
lblShopInfo.Text = string.Join(" ", shops.Select(s => s.ShopAccount));
numAddTopUp.Value = 0;
numAddTopUp.Value = 1;
pnlTopUp.Visible = true;
}
}
public class ShopRenewResponse
{
public string ShopId { get; set; }
public int ExpireTime‌ { get; set; }
public int UserPoints { get; set; }
}
}