修改店铺续费的接口 改为最新接口

This commit is contained in:
chfei committed 2026-09-16 13:45:33 +08:00
1 parent 2e4aeee82f
commit 2f6b0deb1c
3 files changed
+93 -59

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;
}
+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; }
}
}