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

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

No files matched your search

+8 -1
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.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/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"; 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> /// <summary>
/// post 数据 /// post 数据
/// </summary> /// </summary>
+26 -15
View File
@@ -28,8 +28,8 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
@@ -358,7 +358,7 @@
this.cmbGroup.DropDownWidth = 1; this.cmbGroup.DropDownWidth = 1;
this.cmbGroup.FormattingEnabled = true; this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.IntegralHeight = false; 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.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbGroup.Name = "cmbGroup"; this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(74, 25); this.cmbGroup.Size = new System.Drawing.Size(74, 25);
@@ -384,7 +384,7 @@
this.cmbNotes.DropDownWidth = 1; this.cmbNotes.DropDownWidth = 1;
this.cmbNotes.FormattingEnabled = true; this.cmbNotes.FormattingEnabled = true;
this.cmbNotes.IntegralHeight = false; 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.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbNotes.Name = "cmbNotes"; this.cmbNotes.Name = "cmbNotes";
this.cmbNotes.Size = new System.Drawing.Size(74, 25); this.cmbNotes.Size = new System.Drawing.Size(74, 25);
@@ -517,7 +517,7 @@
this.cmbSubAccount.DropDownWidth = 1; this.cmbSubAccount.DropDownWidth = 1;
this.cmbSubAccount.FormattingEnabled = true; this.cmbSubAccount.FormattingEnabled = true;
this.cmbSubAccount.IntegralHeight = false; 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.Margin = new System.Windows.Forms.Padding(0, 0, 0, 4);
this.cmbSubAccount.Name = "cmbSubAccount"; this.cmbSubAccount.Name = "cmbSubAccount";
this.cmbSubAccount.Size = new System.Drawing.Size(74, 25); this.cmbSubAccount.Size = new System.Drawing.Size(74, 25);
@@ -659,10 +659,21 @@
10000, 10000,
0, 0,
0, 0,
0});
this.numAddTopUp.Minimum = new decimal(new int[] {
1,
0,
0,
0}); 0});
this.numAddTopUp.Name = "numAddTopUp"; this.numAddTopUp.Name = "numAddTopUp";
this.numAddTopUp.ReadOnly = true;
this.numAddTopUp.Size = new System.Drawing.Size(36, 23); this.numAddTopUp.Size = new System.Drawing.Size(36, 23);
this.numAddTopUp.TabIndex = 1; this.numAddTopUp.TabIndex = 1;
this.numAddTopUp.Value = new decimal(new int[] {
1,
0,
0,
0});
this.numAddTopUp.ValueChanged += new System.EventHandler(this.numAddTopUp_ValueChanged); this.numAddTopUp.ValueChanged += new System.EventHandler(this.numAddTopUp_ValueChanged);
// //
// label8 // label8
@@ -771,20 +782,20 @@
// //
this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToAddRows = false;
this.dgvShop.AllowUserToDeleteRows = false; this.dgvShop.AllowUserToDeleteRows = false;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.dgvShop.AutoRowNumber = true; this.dgvShop.AutoRowNumber = true;
this.dgvShop.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; this.dgvShop.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.dgvShop.BackgroundColor = System.Drawing.Color.White; this.dgvShop.BackgroundColor = System.Drawing.Color.White;
this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.colSelect, this.colSelect,
+52 -36
View File
@@ -3,14 +3,17 @@ using AllBase.Helper;
using AllBase.Model.Result; using AllBase.Model.Result;
using NaiBa.Util; using NaiBa.Util;
using NaiBa.Util.Extension; using NaiBa.Util.Extension;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Drawing.Printing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
@@ -18,6 +21,8 @@ using TemuKJD.BaseForms;
using TemuKJD.BLL; using TemuKJD.BLL;
using TemuKJD.Extension; using TemuKJD.Extension;
using Work; using Work;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
//using TemuKJD.PDDForms.AdminForms; //using TemuKJD.PDDForms.AdminForms;
namespace TemuKJD.WXForms.ShopForms namespace TemuKJD.WXForms.ShopForms
@@ -283,7 +288,8 @@ namespace TemuKJD.WXForms.ShopForms
int i = 1; int i = 1;
foreach (var shopInfo in shopInfoLst) foreach (var shopInfo in shopInfoLst)
{ {
Invoke(new Action(() => { Invoke(new Action(() =>
{
this.statusBar.pgbTaskProgress.Value = i; this.statusBar.pgbTaskProgress.Value = i;
this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count; this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count;
i++; i++;
@@ -305,7 +311,8 @@ namespace TemuKJD.WXForms.ShopForms
int i = 1; int i = 1;
foreach (var shopInfo in shopInfoLst) foreach (var shopInfo in shopInfoLst)
{ {
Invoke(new Action(() => { Invoke(new Action(() =>
{
this.statusBar.pgbTaskProgress.Value = i; this.statusBar.pgbTaskProgress.Value = i;
this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count; this.statusBar.pgbTaskProgress.Text = i + "/" + shopInfoLst.Count;
this.statusBar.pgbTaskProgress.Maximum = shopInfoLst.Count; this.statusBar.pgbTaskProgress.Maximum = shopInfoLst.Count;
@@ -927,7 +934,7 @@ namespace TemuKJD.WXForms.ShopForms
case "续期": case "续期":
lblShopId.Text = shop.ShopId; lblShopId.Text = shop.ShopId;
lblShopInfo.Text = shop.ShopAccount; lblShopInfo.Text = shop.ShopAccount;
numAddTopUp.Value = 0; numAddTopUp.Value = 1;
pnlTopUp.Visible = true; pnlTopUp.Visible = true;
break; break;
//case "多重登录": //case "多重登录":
@@ -1222,52 +1229,47 @@ namespace TemuKJD.WXForms.ShopForms
pnlTopUp.Visible = false; 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(';'); 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.Visible = true;
pbLoading.BringToFront(); pbLoading.BringToFront();
string errMsg = "";
Task.Run(() =>
{
foreach (var shopId in shopIds) foreach (var shopId in shopIds)
{ {
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId);
if (shop == null) if (shop == null)
continue; continue;
string url = BaseClass.BuildObjString("user/update_user_points"); string url = BaseClass.BuildObjString("user/shop_renew");
string data = UserLogin.GetSignaturex(); var data = UserLogin.GetSignPostData(new
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"))
{ {
var msg = BaseRegex.GetStringJsonByRegs(ref html, html, "msg"); UserName = BaseClass.UserName,
errMsg += shop.ShopAccount + ":" + msg + " "; 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; continue;
} }
shop.expire_time = BaseRegex.GetIntJson(ref html, "newExpireTime"); shop.expire_time = ret.Data.ExpireTime;
shop.is_point_shop_expire = false; shop.is_point_shop_expire = false;
BaseClass.Points = BaseRegex.GetIntJson(ref html, "newUserPoints"); BaseClass.Points = ret.Data.UserPoints;
Invoke(new Action(() => Invoke(new Action(() =>
{ {
MainForm.instance.lblPoints.Text = "账户积分:" + BaseClass.Points; MainForm.instance.lblPoints.Text = "账户积分:" + BaseClass.Points;
@@ -1287,7 +1289,15 @@ namespace TemuKJD.WXForms.ShopForms
BaseMsgForm.ShowInfo("充值完成 发生以下错误:\r\n" + errMsg); BaseMsgForm.ShowInfo("充值完成 发生以下错误:\r\n" + errMsg);
} }
})); }));
}); }
catch (Exception ex)
{
}
finally
{
pbLoading.Visible = false;
}
} }
private void numAddTopUp_ValueChanged(object sender, EventArgs e) 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)); lblShopId.Text = string.Join(";", shops.Select(s => s.ShopId));
lblShopInfo.Text = string.Join(" ", shops.Select(s => s.ShopAccount)); lblShopInfo.Text = string.Join(" ", shops.Select(s => s.ShopAccount));
numAddTopUp.Value = 0; numAddTopUp.Value = 1;
pnlTopUp.Visible = true; pnlTopUp.Visible = true;
} }
} }
public class ShopRenewResponse
{
public string ShopId { get; set; }
public int ExpireTime‌ { get; set; }
public int UserPoints { get; set; }
}
} }