Files

89 lines
2.8 KiB
C#

using AllBase;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Work;
using Work.BaseForms;
using Work.Properties;
namespace TemuKJD.WXForms.ShopForms
{
public partial class WXGetTopUpQrCode : Form
{
public WXGetTopUpQrCode()
{
InitializeComponent();
}
public void refreshQrcode()
{
Invoke(new Action(() =>
{
pbLoading.Visible = true;
}));
var url = BaseClass.Build29WxObjString("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);
else
pictureBox1.Image = Resources.errpic;
}));
}
}
private void btnRefresh_Click(object sender, EventArgs e)
{
Task.Run(() => { refreshQrcode(); });
}
private void WXGetTopUpQrCode_Load(object sender, EventArgs e)
{
Task.Run(() => { refreshQrcode(); });
}
private void btnAddPoints_Click(object sender, EventArgs e)
{
try
{
Process.Start(new ProcessStartInfo("https://excashier.alipay.com/standard/auth.htm?payOrderId=5afc56d40af64001ad2a486cce1ca579.25") { UseShellExecute = true });
}
catch (Exception ex)
{
// 处理可能出现的异常,例如找不到浏览器等
MessageBox.Show("无法打开浏览器: " + ex.Message);
}
}
private void btnAddBalance_Click(object sender, EventArgs e)
{
//ShopLoginForm loginForm = new ShopLoginForm(new AllBase.Model.Result.ShopLoginInfo());
//loginForm.InitUrl = "https://excashier.alipay.com/standard/auth.htm?payOrderId=5afc56d40af64001ad2a486cce1ca579.25";
//loginForm.openType = KJDForms.ShopForms.EnumOpenType.manage;
//loginForm.ShowDialog();
}
}
}