Files
KJD_WebService/TEMUKJD/WXForms/ShopForms/WXGetTopUpQrCode.cs
T

64 lines
1.7 KiB
C#

using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using Work;
using Work.BLL.Tools;
namespace TemuKJD.WXForms.ShopForms
{
public partial class WXGetTopUpQrCode : Form
{
public WXGetTopUpQrCode()
{
InitializeComponent();
}
public void refreshQrcode()
{
Invoke(new Action(() =>
{
pbLoading.Visible = true;
}));
var url = BaseClass.BuildWXObjString("user/get_top_up_qrcode");
var data = UserLogin.GetSignaturex();
var html = GetHtml.PostUtf8(url, data);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
{
var msg = BaseRegex.GetStringJson(ref html, "msg");
BaseMsgForm.ShowError(msg);
}
else
{
Invoke(new Action(() =>
{
pbLoading.Visible = false;
var base64Str = BaseRegex.GetStringJson(ref html, "qrcode_base64");
if (!string.IsNullOrEmpty(base64Str))
pictureBox1.Image = Base64ChangeImgUrl.Base64ToImage(base64Str);
}));
}
}
private void btnRefresh_Click(object sender, EventArgs e)
{
Task.Run(() => { refreshQrcode(); });
}
private void WXGetTopUpQrCode_Load(object sender, EventArgs e)
{
Task.Run(() => { refreshQrcode(); });
}
}
}