88 lines
3.8 KiB
C#
88 lines
3.8 KiB
C#
|
using Api.Framework;
|
|||
|
using Api.Framework.Model;
|
|||
|
using System;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
using UI.Framework.Forms;
|
|||
|
|
|||
|
namespace FLSystem.Forms
|
|||
|
{
|
|||
|
public partial class set_wechat_device : BaseForm
|
|||
|
{
|
|||
|
|
|||
|
public set_wechat_device(string weixinhao)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
this.textEdit1.Text = weixinhao;
|
|||
|
}
|
|||
|
|
|||
|
private void hyperlinkLabelControl1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.textEdit2.Text = Get62Data(CsharpHttpHelper.HttpExtend.GetMD5String(Guid.NewGuid().ToString()));
|
|||
|
}
|
|||
|
|
|||
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!this.textEdit2.Text.StartsWith("62") || this.textEdit2.Text.EndsWith("07f")) throw new Exception("您的设备信息有误,请点击随机生成!");
|
|||
|
if (string.IsNullOrEmpty(this.textEdit2.Text)) throw new Exception("微信号有误,请重新输入!");
|
|||
|
|
|||
|
if (MessageBox.Show("重置设备信息后,回复消息可能提示操作频繁,确定要重置吗?", "请谨慎操作", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var device = session.Queryable<fl_wechat_device>().Where(f => f.weixinhao == this.textEdit1.Text).Single();
|
|||
|
if (device == null)
|
|||
|
device = new fl_wechat_device() { weixinhao =this.textEdit1.Text};
|
|||
|
device.device_info = this.textEdit2.Text;
|
|||
|
if (device.id == 0) session.Insertable<fl_wechat_device>(device).ExecuteCommand();
|
|||
|
else session.Updateable<fl_wechat_device>(device).ExecuteCommand();
|
|||
|
ShowSuccess("重置设备信息成功!\r\n重新登陆微信后生效!");
|
|||
|
}
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
ShowError(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private string Get62Data(string imei)
|
|||
|
{
|
|||
|
string hexStr = CsharpHttpHelper.HttpExtend.ByteToHex(Encoding.UTF8.GetBytes(imei)).Replace(" ", "");
|
|||
|
string str = "62706c6973743030d4010203040506090a582476657273696f6e58246f626a65637473592461726368697665725424746f7012000186a0a2070855246e756c6c5f1020" + hexStr + "5f100f4e534b657965644172636869766572d10b0c54726f6f74800108111a232d32373a406375787d0000000000000101000000000000000d0000000000000000000000000000007f";
|
|||
|
return str;
|
|||
|
}
|
|||
|
|
|||
|
private void textEdit1_EditValueChanged(object sender, EventArgs e)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
if (!string.IsNullOrEmpty(this.textEdit1.Text))
|
|||
|
{
|
|||
|
var session = ApiClient.GetSession();
|
|||
|
var device = session.Queryable<fl_wechat_device>().Where(f => f.weixinhao == this.textEdit1.Text).Single();
|
|||
|
if (device != null)
|
|||
|
{
|
|||
|
if (device.device_info.StartsWith("62") && device.device_info.EndsWith("07f"))
|
|||
|
this.textEdit2.Text = device.device_info;
|
|||
|
else
|
|||
|
{
|
|||
|
var Ime = CsharpHttpHelper.HttpExtend.GetMD5String(this.textEdit1.Text + device.device_info);
|
|||
|
this.textEdit2.Text = Get62Data(device.device_info);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var Ime = CsharpHttpHelper.HttpExtend.GetMD5String(this.textEdit1.Text);
|
|||
|
this.textEdit2.Text = Get62Data(Ime);
|
|||
|
}
|
|||
|
}
|
|||
|
else this.textEdit2.Text = "";
|
|||
|
}
|
|||
|
catch (Exception )
|
|||
|
{}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|