修改消费记录总金额计算方法
This commit is contained in:
1 parent
107bf82f97
commit
d8064b95ef
5 files changed
+626
-534
No files matched your search
+481
-443
@@ -1,484 +1,522 @@
|
||||
using System;
|
||||
using AllBase;
|
||||
using NaiBa.Util.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using AllBase;
|
||||
using NaiBa.Util.Extension;
|
||||
|
||||
namespace Work
|
||||
{
|
||||
public class UserLogin
|
||||
{
|
||||
public string Mobile;
|
||||
public string Password;
|
||||
public static bool Logining = false, NoRegedit = false, NoFindPass = false, NoBuy = false;
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public bool Get(ref string message, out int lockUserName, out int weakPassword, out string messageInfo)
|
||||
{
|
||||
bool IsLoginDef = false;
|
||||
Logining = true;
|
||||
string mobile = Mobile;
|
||||
string password = Password;
|
||||
string passwordMd5;
|
||||
if (password == "******")
|
||||
passwordMd5 = BaseClass.PassWord;
|
||||
else
|
||||
passwordMd5 = Md5Base.GetMd5(password).ToLower();
|
||||
BaseClass.PassWord = passwordMd5;
|
||||
BaseClass.PassWordBak = BaseClass.PassWord;
|
||||
BaseClass.UserName = Mobile;
|
||||
Random r = new Random();
|
||||
int r2 = r.Next(100000000, 899999999); //生成随机码
|
||||
string url = BaseClass.Build29WxObjString("user/user_login");
|
||||
for (int j = 0; j < 100 && string.IsNullOrEmpty(BaseClass.MacInfo); j++)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
Agian:
|
||||
string data = "mobile=" + mobile + "&r2=" + r2 + "&password=" + passwordMd5 + "&" + GetSignature() + "&mac=" + BaseClass.MacInfo + "&version=" + BaseClass.VersionCount;
|
||||
data += "&from_tool=" + GetHtml.UrlEncodeUtf8(BaseClass.AgentName) + "&client_ip=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddress) + "&client_addr=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddressName);
|
||||
data += "&sub_soft_type=order";
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
lockUserName = -1;
|
||||
weakPassword = -1;
|
||||
messageInfo = "";
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
if (!IsLoginDef)
|
||||
{
|
||||
IsLoginDef = true;
|
||||
url = BaseClass.Build29WxObjString("login");
|
||||
goto Agian;
|
||||
}
|
||||
public class UserLogin
|
||||
{
|
||||
public string Mobile;
|
||||
public string Password;
|
||||
public static bool Logining = false, NoRegedit = false, NoFindPass = false, NoBuy = false;
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public bool Get(ref string message, out int lockUserName, out int weakPassword, out string messageInfo)
|
||||
{
|
||||
bool IsLoginDef = false;
|
||||
Logining = true;
|
||||
string mobile = Mobile;
|
||||
string password = Password;
|
||||
string passwordMd5;
|
||||
if (password == "******")
|
||||
passwordMd5 = BaseClass.PassWord;
|
||||
else
|
||||
passwordMd5 = Md5Base.GetMd5(password).ToLower();
|
||||
BaseClass.PassWord = passwordMd5;
|
||||
BaseClass.PassWordBak = BaseClass.PassWord;
|
||||
BaseClass.UserName = Mobile;
|
||||
Random r = new Random();
|
||||
int r2 = r.Next(100000000, 899999999); //生成随机码
|
||||
string url = BaseClass.Build29WxObjString("user/user_login");
|
||||
for (int j = 0; j < 100 && string.IsNullOrEmpty(BaseClass.MacInfo); j++)
|
||||
{
|
||||
Thread.Sleep(10);
|
||||
}
|
||||
Agian:
|
||||
string data = "mobile=" + mobile + "&r2=" + r2 + "&password=" + passwordMd5 + "&" + GetSignature() + "&mac=" + BaseClass.MacInfo + "&version=" + BaseClass.VersionCount;
|
||||
data += "&from_tool=" + GetHtml.UrlEncodeUtf8(BaseClass.AgentName) + "&client_ip=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddress) + "&client_addr=" + GetHtml.UrlEncodeUtf8(BaseClass.IPAddressName);
|
||||
data += "&sub_soft_type=order";
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
lockUserName = -1;
|
||||
weakPassword = -1;
|
||||
messageInfo = "";
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
if (!IsLoginDef)
|
||||
{
|
||||
IsLoginDef = true;
|
||||
url = BaseClass.Build29WxObjString("login");
|
||||
goto Agian;
|
||||
}
|
||||
|
||||
message = "链接服务器失败\r\n" +
|
||||
"如有问题请联系官方QQ:" + BaseClass.ServiceQQ;
|
||||
return false;
|
||||
}
|
||||
if (html == "need open")
|
||||
{
|
||||
message = "登录失败\r\n请先点击“购买开户”开通本软件使用权限";
|
||||
return false;
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
message = errMsg;
|
||||
return false;
|
||||
}
|
||||
string code = BaseRegex.GetStringJson(ref html, "c");
|
||||
string codex = Encryption(r2);
|
||||
if (code != codex)
|
||||
{
|
||||
message = "登录失败\r\n链接异常请重试";
|
||||
return false;
|
||||
}
|
||||
message = "链接服务器失败\r\n" +
|
||||
"如有问题请联系官方QQ:" + BaseClass.ServiceQQ;
|
||||
return false;
|
||||
}
|
||||
if (html == "need open")
|
||||
{
|
||||
message = "登录失败\r\n请先点击“购买开户”开通本软件使用权限";
|
||||
return false;
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
message = errMsg;
|
||||
return false;
|
||||
}
|
||||
string code = BaseRegex.GetStringJson(ref html, "c");
|
||||
string codex = Encryption(r2);
|
||||
if (code != codex)
|
||||
{
|
||||
message = "登录失败\r\n链接异常请重试";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsLoginDef)
|
||||
{
|
||||
//BaseClass.LoginApiUrl = "http://new.qixiaoke.com/";
|
||||
//BaseClass.ImageApiUrl = BaseClass.LoginApiUrl + "index.php?obj=api/image";
|
||||
}
|
||||
if (IsLoginDef)
|
||||
{
|
||||
//BaseClass.LoginApiUrl = "http://new.qixiaoke.com/";
|
||||
//BaseClass.ImageApiUrl = BaseClass.LoginApiUrl + "index.php?obj=api/image";
|
||||
}
|
||||
|
||||
//BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end");
|
||||
//BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company");
|
||||
//BaseClass.UserId =Convert.ToInt32(BaseRegex.GetStringJson(ref html, "uid"));
|
||||
//BaseClass.UserKey = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "key"));
|
||||
//BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nickname");
|
||||
//BaseClass.UserVersion = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "v"));
|
||||
//BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "vt");
|
||||
//BaseClass.CompanyId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cid"));
|
||||
//BaseClass.GroupId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "groupid"));
|
||||
//BaseClass.Balance = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "balance"));
|
||||
//BaseClass.IsFactory = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "factory")) == 1;
|
||||
//BaseClass.IsCloudBuyOrder = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cloud_buy_order_status")) == 1;
|
||||
//if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11)
|
||||
//{
|
||||
// BaseClass.UserId = 0;
|
||||
// BaseClass.UserKey = 0;
|
||||
// return false;
|
||||
//}
|
||||
//BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end");
|
||||
//BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company");
|
||||
|
||||
//string islock = BaseRegex.GetStringJson(ref html, "is_lock");
|
||||
//int.TryParse(islock, out lockUserName);
|
||||
//string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password");
|
||||
//int.TryParse(isweak, out weakPassword);
|
||||
//messageInfo = BaseRegex.GetStringJson(ref html, "message");
|
||||
//BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end");
|
||||
//BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company");
|
||||
//BaseClass.UserId =Convert.ToInt32(BaseRegex.GetStringJson(ref html, "uid"));
|
||||
//BaseClass.UserKey = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "key"));
|
||||
//BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nickname");
|
||||
//BaseClass.UserVersion = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "v"));
|
||||
//BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "vt");
|
||||
//BaseClass.CompanyId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cid"));
|
||||
//BaseClass.GroupId = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "groupid"));
|
||||
//BaseClass.Balance = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "balance"));
|
||||
//BaseClass.IsFactory = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "factory")) == 1;
|
||||
//BaseClass.IsCloudBuyOrder = Convert.ToInt32(BaseRegex.GetStringJson(ref html, "cloud_buy_order_status")) == 1;
|
||||
//if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11)
|
||||
//{
|
||||
// BaseClass.UserId = 0;
|
||||
// BaseClass.UserKey = 0;
|
||||
// return false;
|
||||
//}
|
||||
//BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end");
|
||||
//BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company");
|
||||
|
||||
//// 代理权限列表
|
||||
//string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth");
|
||||
//string islock = BaseRegex.GetStringJson(ref html, "is_lock");
|
||||
//int.TryParse(islock, out lockUserName);
|
||||
//string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password");
|
||||
//int.TryParse(isweak, out weakPassword);
|
||||
//messageInfo = BaseRegex.GetStringJson(ref html, "message");
|
||||
|
||||
BaseClass.UserId = BaseRegex.GetStringJson(ref html, "id").ParseToInt();
|
||||
BaseClass.UserKey = BaseRegex.GetStringJson(ref html, "user_key").ParseToInt();
|
||||
BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nick_name");
|
||||
BaseClass.UserName = BaseRegex.GetStringJson(ref html, "user_name");
|
||||
BaseClass.ParentUserName = BaseRegex.GetStringJson(ref html, "parent_user_name");
|
||||
BaseClass.SaLevel = BaseRegex.GetIntJson(ref html, "sa_level").ParseToInt();
|
||||
BaseClass.UserAuthority = BaseRegex.GetStringJson(ref html, "authority").ParseToString();
|
||||
BaseClass.ParentAuthority = BaseRegex.GetStringJson(ref html, "parent_authority").ParseToString();
|
||||
BaseClass.ForbiddenPage = BaseRegex.GetStringJson(ref html, "forbidden_page").ParseToString();
|
||||
BaseClass.Mobile = BaseRegex.GetStringJson(ref html, "mobile");
|
||||
BaseClass.UserVersion = BaseRegex.GetStringJson(ref html, "version").ParseToInt();
|
||||
BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "version_s");
|
||||
BaseClass.CompanyId = BaseRegex.GetStringJson(ref html, "company_Id").ParseToInt();
|
||||
BaseClass.GroupId = BaseRegex.GetStringJson(ref html, "group_id").ParseToInt();
|
||||
//BaseClass.AuthorizedAmount = BaseRegex.GetNullableDecimalJson(ref html, "authorized_amount");
|
||||
BaseClass.Points = BaseRegex.GetStringJson(ref html, "points").ParseToInt();
|
||||
BaseClass.ShopPointsPerMonth = BaseRegex.GetStringJson(ref html, "shop_points_per_month").ParseToInt();
|
||||
BaseClass.Balance = BaseRegex.GetDecimalJson(ref html, "balance");
|
||||
//// 代理权限列表
|
||||
//string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth");
|
||||
|
||||
BaseClass.UserId = BaseRegex.GetStringJson(ref html, "id").ParseToInt();
|
||||
BaseClass.UserKey = BaseRegex.GetStringJson(ref html, "user_key").ParseToInt();
|
||||
BaseClass.NickName = BaseRegex.GetStringJson(ref html, "nick_name");
|
||||
BaseClass.UserName = BaseRegex.GetStringJson(ref html, "user_name");
|
||||
BaseClass.ParentUserName = BaseRegex.GetStringJson(ref html, "parent_user_name");
|
||||
BaseClass.SaLevel = BaseRegex.GetIntJson(ref html, "sa_level").ParseToInt();
|
||||
BaseClass.UserAuthority = BaseRegex.GetStringJson(ref html, "authority").ParseToString();
|
||||
BaseClass.ParentAuthority = BaseRegex.GetStringJson(ref html, "parent_authority").ParseToString();
|
||||
BaseClass.ForbiddenPage = BaseRegex.GetStringJson(ref html, "forbidden_page").ParseToString();
|
||||
BaseClass.Mobile = BaseRegex.GetStringJson(ref html, "mobile");
|
||||
BaseClass.UserVersion = BaseRegex.GetStringJson(ref html, "version").ParseToInt();
|
||||
BaseClass.UserVersionString = BaseRegex.GetStringJson(ref html, "version_s");
|
||||
BaseClass.CompanyId = BaseRegex.GetStringJson(ref html, "company_Id").ParseToInt();
|
||||
BaseClass.GroupId = BaseRegex.GetStringJson(ref html, "group_id").ParseToInt();
|
||||
//BaseClass.AuthorizedAmount = BaseRegex.GetNullableDecimalJson(ref html, "authorized_amount");
|
||||
BaseClass.Points = BaseRegex.GetStringJson(ref html, "points").ParseToInt();
|
||||
BaseClass.ShopPointsPerMonth = BaseRegex.GetStringJson(ref html, "shop_points_per_month").ParseToInt();
|
||||
BaseClass.Balance = BaseRegex.GetDecimalJson(ref html, "balance");
|
||||
BaseClass.PostagePerOrder = Math.Max(2.2m, BaseRegex.GetDecimalJson(ref html, "postage_per_order"));
|
||||
BaseClass.RefundPostagePerOrder = Math.Max(2.5m, BaseRegex.GetDecimalJson(ref html, "refund_postage_per_order"));
|
||||
BaseClass.RechargeAmountTotal = BaseRegex.GetDecimalJson(ref html, "recharge_amount_total");
|
||||
BaseClass.OemGiftAmount = BaseRegex.GetDecimalJson(ref html, "gift_oem_amount_per_order");
|
||||
BaseClass.OemId = BaseRegex.GetStringJson(ref html, "oem_id");
|
||||
BaseClass.OemName = BaseRegex.GetStringJson(ref html, "oem_name");
|
||||
BaseClass.IsOemOwner = BaseRegex.GetBoolJson(ref html, "is_oem_owner");
|
||||
BaseClass.OemName = BaseRegex.GetStringJson(ref html, "oem_name");
|
||||
BaseClass.IsOemOwner = BaseRegex.GetBoolJson(ref html, "is_oem_owner");
|
||||
|
||||
if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11)
|
||||
{
|
||||
message = "该账户禁止登录订单管理";
|
||||
BaseClass.UserId = 0;
|
||||
BaseClass.UserKey = 0;
|
||||
return false;
|
||||
}
|
||||
if (BaseClass.GroupId != 3 && BaseClass.GroupId != 4 && BaseClass.GroupId != 9 && BaseClass.GroupId != 10 && BaseClass.GroupId != 11)
|
||||
{
|
||||
message = "该账户禁止登录订单管理";
|
||||
BaseClass.UserId = 0;
|
||||
BaseClass.UserKey = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (BaseClass.ForbiddenPage.Contains("拍单"))
|
||||
{
|
||||
message = "该账户禁止登录订单管理";
|
||||
BaseClass.UserId = 0;
|
||||
BaseClass.UserKey = 0;
|
||||
return false;
|
||||
}
|
||||
if (BaseClass.ForbiddenPage.Contains("拍单"))
|
||||
{
|
||||
message = "该账户禁止登录订单管理";
|
||||
BaseClass.UserId = 0;
|
||||
BaseClass.UserKey = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end");
|
||||
BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company_name");
|
||||
if (BaseClass.UserVersion == 3)
|
||||
{
|
||||
BaseClass.QqGroupNum = BaseRegex.GetStringJson(ref html, "qq_group_num");
|
||||
BaseClass.QqGroupUrl = BaseRegex.GetStringJson(ref html, "qq_group_url");
|
||||
BaseClass.WechatUrl = BaseRegex.GetStringJson(ref html, "wechat_url");
|
||||
}
|
||||
if (BaseClass.UserVersion == 3 || BaseClass.UserVersion == 4 || BaseClass.UserVersion == 5 || BaseClass.UserVersion == 10 || BaseClass.UserVersion == 9)
|
||||
{
|
||||
BaseClass.IsPinduoduo = BaseRegex.GetStringJson(ref html, "pinduoduo") == "1";
|
||||
BaseClass.AlimamaDomain = BaseRegex.GetStringJson(ref html, "alimama_domain");
|
||||
BaseClass.AlimamaPid = BaseRegex.GetStringJson(ref html, "alimama_pid");
|
||||
}
|
||||
if (!BaseClass.UserApi && BaseClass.UserVersion != 110)
|
||||
BaseClass.UserVersion = 100;
|
||||
//if (BaseClass.UserVersion == 110)
|
||||
// BaseClass.ClientId = BaseSpecialConfig.ToolClientId; // 特别版本,使用指定ClientId
|
||||
BaseClass.EndDate = BaseRegex.GetStringJson(ref html, "end");
|
||||
BaseClass.CompanyName = BaseRegex.GetStringJson(ref html, "company_name");
|
||||
if (BaseClass.UserVersion == 3)
|
||||
{
|
||||
BaseClass.QqGroupNum = BaseRegex.GetStringJson(ref html, "qq_group_num");
|
||||
BaseClass.QqGroupUrl = BaseRegex.GetStringJson(ref html, "qq_group_url");
|
||||
BaseClass.WechatUrl = BaseRegex.GetStringJson(ref html, "wechat_url");
|
||||
}
|
||||
if (BaseClass.UserVersion == 3 || BaseClass.UserVersion == 4 || BaseClass.UserVersion == 5 || BaseClass.UserVersion == 10 || BaseClass.UserVersion == 9)
|
||||
{
|
||||
BaseClass.IsPinduoduo = BaseRegex.GetStringJson(ref html, "pinduoduo") == "1";
|
||||
BaseClass.AlimamaDomain = BaseRegex.GetStringJson(ref html, "alimama_domain");
|
||||
BaseClass.AlimamaPid = BaseRegex.GetStringJson(ref html, "alimama_pid");
|
||||
}
|
||||
if (!BaseClass.UserApi && BaseClass.UserVersion != 110)
|
||||
BaseClass.UserVersion = 100;
|
||||
//if (BaseClass.UserVersion == 110)
|
||||
// BaseClass.ClientId = BaseSpecialConfig.ToolClientId; // 特别版本,使用指定ClientId
|
||||
|
||||
string islock = BaseRegex.GetStringJson(ref html, "is_lock");
|
||||
int.TryParse(islock, out lockUserName);
|
||||
string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password");
|
||||
int.TryParse(isweak, out weakPassword);
|
||||
messageInfo = BaseRegex.GetStringJson(ref html, "message");
|
||||
string islock = BaseRegex.GetStringJson(ref html, "is_lock");
|
||||
int.TryParse(islock, out lockUserName);
|
||||
string isweak = BaseRegex.GetStringJson(ref html, "is_weak_password");
|
||||
int.TryParse(isweak, out weakPassword);
|
||||
messageInfo = BaseRegex.GetStringJson(ref html, "message");
|
||||
|
||||
//// 代理权限列表
|
||||
//string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth");
|
||||
//if (!string.IsNullOrEmpty(agent_auth) && agent_auth != "0")
|
||||
//{
|
||||
// var strArr = agent_auth.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
// foreach (var item in strArr)
|
||||
// {
|
||||
// var itemArr = item.Split(',');
|
||||
// if (itemArr.Length == 2)
|
||||
// {
|
||||
// BaseClass.AgentAuth[itemArr[0]] = itemArr[1];
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//// 代理权限列表
|
||||
//string agent_auth = BaseRegex.GetStringJson(ref html, "agent_auth");
|
||||
//if (!string.IsNullOrEmpty(agent_auth) && agent_auth != "0")
|
||||
//{
|
||||
// var strArr = agent_auth.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
// foreach (var item in strArr)
|
||||
// {
|
||||
// var itemArr = item.Split(',');
|
||||
// if (itemArr.Length == 2)
|
||||
// {
|
||||
// BaseClass.AgentAuth[itemArr[0]] = itemArr[1];
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
BaseClass.IsLoginSuccess = true;
|
||||
BaseClass.IsLoginSuccess = true;
|
||||
|
||||
Initialization i = new Initialization();
|
||||
i.SaveConfig();
|
||||
return true;
|
||||
}
|
||||
Initialization i = new Initialization();
|
||||
i.SaveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册账户
|
||||
/// </summary>
|
||||
/// <param name="mobile">手机</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <param name="code">验证码</param>
|
||||
/// <param name="nickname">昵称</param>
|
||||
/// <param name="email">邮箱</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public bool Regedit(string mobile, string password, string code, string nickname, string email, out string message)
|
||||
{
|
||||
string passwordMd5 = Md5Base.GetMd5(password).ToLower();
|
||||
string url = BaseClass.Build29WxObjString("regedit");
|
||||
string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&nickname=" + GetHtml.UrlEncodeUtf8(nickname) +
|
||||
"&email=" + email + "&" + GetSignature();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" +
|
||||
"1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" +
|
||||
"2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" +
|
||||
"3、请不要使用代理上网,更换为路由或者直接链接\r\n" +
|
||||
"4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" +
|
||||
"5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助";
|
||||
return false;
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
message = errMsg;
|
||||
if (message.Contains("手机号码已被注册"))
|
||||
{
|
||||
message = message.Replace("手机号码已被注册", "手机号码已被注册,请直接登录或找回密码");
|
||||
}
|
||||
if (message.Contains("短信验证码错误"))
|
||||
{
|
||||
message = "短信验证码错误,请重新输入\r\n如果接收不到,请联系客服QQ:" + BaseClass.ServiceQQ + "";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
message = "";
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// 注册账户
|
||||
/// </summary>
|
||||
/// <param name="mobile">手机</param>
|
||||
/// <param name="password">密码</param>
|
||||
/// <param name="code">验证码</param>
|
||||
/// <param name="nickname">昵称</param>
|
||||
/// <param name="email">邮箱</param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public bool Regedit(string mobile, string password, string code, string nickname, string email, out string message)
|
||||
{
|
||||
string passwordMd5 = Md5Base.GetMd5(password).ToLower();
|
||||
string url = BaseClass.Build29WxObjString("regedit");
|
||||
string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&nickname=" + GetHtml.UrlEncodeUtf8(nickname) +
|
||||
"&email=" + email + "&" + GetSignature();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" +
|
||||
"1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" +
|
||||
"2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" +
|
||||
"3、请不要使用代理上网,更换为路由或者直接链接\r\n" +
|
||||
"4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" +
|
||||
"5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助";
|
||||
return false;
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
message = errMsg;
|
||||
if (message.Contains("手机号码已被注册"))
|
||||
{
|
||||
message = message.Replace("手机号码已被注册", "手机号码已被注册,请直接登录或找回密码");
|
||||
}
|
||||
if (message.Contains("短信验证码错误"))
|
||||
{
|
||||
message = "短信验证码错误,请重新输入\r\n如果接收不到,请联系客服QQ:" + BaseClass.ServiceQQ + "";
|
||||
}
|
||||
return false;
|
||||
}
|
||||
message = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public bool ResetPassword(string mobile, string code, string password, out string message)
|
||||
{
|
||||
string passwordMd5 = Md5Base.GetMd5(password).ToLower();
|
||||
string url = BaseClass.Build29WxObjString("reset_password");
|
||||
string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&" + GetSignature();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" +
|
||||
"1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" +
|
||||
"2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" +
|
||||
"3、请不要使用代理上网,更换为路由或者直接链接\r\n" +
|
||||
"4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" +
|
||||
"5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助";
|
||||
return false;
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
message = errMsg;
|
||||
return false;
|
||||
}
|
||||
message = "";
|
||||
return true;
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="message"></param>
|
||||
/// <returns></returns>
|
||||
public bool ResetPassword(string mobile, string code, string password, out string message)
|
||||
{
|
||||
string passwordMd5 = Md5Base.GetMd5(password).ToLower();
|
||||
string url = BaseClass.Build29WxObjString("reset_password");
|
||||
string data = "mobile=" + mobile + "&password=" + passwordMd5 + "&sms_code=" + code + "&" + GetSignature();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
message = "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" +
|
||||
"1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" +
|
||||
"2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" +
|
||||
"3、请不要使用代理上网,更换为路由或者直接链接\r\n" +
|
||||
"4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" +
|
||||
"5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助";
|
||||
return false;
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
message = errMsg;
|
||||
return false;
|
||||
}
|
||||
message = "";
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取签名字符串
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSignature(bool isPhoneOrder = false)
|
||||
{
|
||||
int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
string code = Encryption(time);
|
||||
if (isPhoneOrder)
|
||||
{
|
||||
code = BaseClass.GetMd5(time.ToString() + "8eLg*MDD46YjA_e*onDgnvkdIaGhi=7B").ToUpper();
|
||||
}
|
||||
return "time=" + time + "&code=" + code + "&NbCodeVersion=1";
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取签名字符串
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSignature()
|
||||
{
|
||||
int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
string code = Encryption(time);
|
||||
|
||||
public static bool IsPinduoduo = false;
|
||||
return "time=" + time + "&code=" + code + "&NbCodeVersion=1";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取签名字符串,新版
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSignaturex(bool isPhoneOrder = false, int posttype = 0)
|
||||
{
|
||||
return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName, isPhoneOrder, posttype);
|
||||
}
|
||||
public static bool IsPinduoduo = false;
|
||||
|
||||
public static string GetSignaturex(string shopId, string shopName, bool isPhoneOrder = false, int posttype=0)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopId))
|
||||
shopId = BaseClass.ShopId;
|
||||
if (string.IsNullOrEmpty(shopName))
|
||||
shopName = BaseClass.ShopName;
|
||||
int time = BaseClass.ConvertDateTimeInt(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
string time1 = Encryption(time);
|
||||
if (posttype==1)
|
||||
{
|
||||
return time1;
|
||||
}
|
||||
return GetSignature(isPhoneOrder) + "&version=" + BaseClass.VersionCount + "&uid=" + BaseClass.UserId + "&key=" + BaseClass.UserKey +
|
||||
"&cid=" + BaseClass.CompanyId + "&company=" + GetHtml.UrlEncodeUtf8(BaseClass.CompanyName) + "&user_name=" + BaseClass.UserName +
|
||||
"&sid=" + shopId + "&shop=" + GetHtml.UrlEncodeUtf8(shopName);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取签名字符串,新版
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetSignaturex()
|
||||
{
|
||||
return GetSignaturex(BaseClass.ShopId, BaseClass.ShopName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 签名算法
|
||||
/// </summary>
|
||||
/// <param name="s">随机数</param>
|
||||
/// <returns>加密签名结果</returns>
|
||||
public static string Encryptionxx(int s)
|
||||
{
|
||||
string ss = s.ToString();
|
||||
if (ss.Length > 8)
|
||||
{
|
||||
ss = ss.Substring(ss.Length - 8);
|
||||
s = int.Parse(ss);
|
||||
if (s < 100000000)
|
||||
s += 100000000;
|
||||
}
|
||||
byte[] kb = Encoding.ASCII.GetBytes(s.ToString());
|
||||
if (BaseClass.NewSignatureAuth)
|
||||
{
|
||||
double y = s * 1.6081825125;
|
||||
y += 4582095.48659959;
|
||||
y += kb[3] * 934579.486548;
|
||||
y += kb[7] + 4889894.30184;
|
||||
byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y -= 478735.48548;
|
||||
y -= k[6] * 426720.454545;
|
||||
y -= k[2] * 5667826.96889;
|
||||
byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y += 56979810.2455;
|
||||
y -= k1[1] * 58742.0564845;
|
||||
y -= k1[5] * 1528.487866;
|
||||
string c = ((int)y).ToString();
|
||||
return GetMd5(c); //返回签名的MD5结果
|
||||
}
|
||||
else
|
||||
{
|
||||
double y = s * 1.8061825125;
|
||||
y += 4852095.48659959;
|
||||
y += kb[3] * 943579.486548;
|
||||
y += kb[7] + 4889894.30184;
|
||||
byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y -= 458735.48548;
|
||||
y -= k[6] * 458720.454545;
|
||||
y -= k[2] * 5447826.96889;
|
||||
byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y += 34779810.2455;
|
||||
y -= k1[1] * 57942.0564845;
|
||||
y -= k1[5] * 1548.487866;
|
||||
string c = ((int)y).ToString();
|
||||
return GetMd5(c); //返回签名的MD5结果
|
||||
}
|
||||
//double y = s * 1.8061825125;
|
||||
//y += 4852095.48659959;
|
||||
//y += kb[3] * 943579.486548;
|
||||
//y += kb[7] + 4889894.30184;
|
||||
//byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
||||
//y -= 458735.48548;
|
||||
//y -= k[6] * 458720.454545;
|
||||
//y -= k[2] * 5447826.96889;
|
||||
//byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
||||
//y += 34779810.2455;
|
||||
//y -= k1[1] * 57942.0564845;
|
||||
//y -= k1[5] * 1548.487866;
|
||||
//string c = ((int)y).ToString();
|
||||
//return GetMd5(c); //返回签名的MD5结果
|
||||
}
|
||||
public static string GetSignaturex(string shopId, string shopName)
|
||||
{
|
||||
var dict = GetSignaturexDict(shopId, shopName);
|
||||
return string.Join("&", dict.Select(kv => $"{kv.Key}={kv.Value}"));
|
||||
}
|
||||
public static object GetSignPostData(object data)
|
||||
{
|
||||
var dict = GetSignaturexDict(BaseClass.ShopId, BaseClass.ShopName);
|
||||
|
||||
/// <summary>
|
||||
/// 签名算法
|
||||
/// </summary>
|
||||
/// <param name="s">随机数</param>
|
||||
/// <returns>加密签名结果</returns>
|
||||
public static string Encryption(int s)
|
||||
{
|
||||
//return GetMd5(s + "sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD");
|
||||
var result = new ExpandoObject() as IDictionary<string, object>;
|
||||
|
||||
string sign = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD";
|
||||
return GetMd5(sign);
|
||||
if (data != null)
|
||||
{
|
||||
foreach (var prop in data.GetType().GetProperties())
|
||||
{
|
||||
result[prop.Name] = prop.GetValue(data) ?? string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// 添加sign的属性
|
||||
foreach (var kv in dict)
|
||||
{
|
||||
result[kv.Key] = kv.Value;
|
||||
}
|
||||
|
||||
public string Get(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
return "";
|
||||
byte[] inArray = Convert.FromBase64String(key.Replace("/", "="));
|
||||
string html = Encoding.UTF8.GetString(inArray);
|
||||
return result;
|
||||
}
|
||||
private static Dictionary<string, string> GetSignaturexDict(string shopId, string shopName)
|
||||
{
|
||||
if (string.IsNullOrEmpty(shopId))
|
||||
shopId = BaseClass.ShopId;
|
||||
if (string.IsNullOrEmpty(shopName))
|
||||
shopName = BaseClass.ShopName;
|
||||
|
||||
html = html.Replace("C", "1");
|
||||
html = html.Replace("Q", "6");
|
||||
html = html.Replace("I", "2");
|
||||
html = html.Replace("L", "0");
|
||||
html = html.Replace("Z", "9");
|
||||
html = html.Replace("O", "5");
|
||||
html = html.Replace("P", "8");
|
||||
html = html.Replace("D", "7");
|
||||
html = html.Replace("R", "b");
|
||||
html = html.Replace("S", "c");
|
||||
html = html.Replace("J", "a");
|
||||
return html;
|
||||
}
|
||||
/// <summary>
|
||||
/// MD5加密
|
||||
/// </summary>
|
||||
/// <param name="instring"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMd5(string instring)
|
||||
{
|
||||
byte[] result = Encoding.Default.GetBytes(instring.Trim());
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] output = md5.ComputeHash(result);
|
||||
return BitConverter.ToString(output).Replace("-", "");
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取验证码
|
||||
/// </summary>
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="success"></param>
|
||||
/// <returns></returns>
|
||||
public static string SendCode(string mobile, out bool success)
|
||||
{
|
||||
string url = BaseClass.Build29WxObjString("sms_gate");
|
||||
string data = "mobile=" + mobile + "&" + GetSignature();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
success = false;
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
return "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" +
|
||||
"1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" +
|
||||
"2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" +
|
||||
"3、请不要使用代理上网,更换为路由或者直接链接\r\n" +
|
||||
"4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" +
|
||||
"5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助";
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
return errMsg;
|
||||
}
|
||||
success = true;
|
||||
return "";
|
||||
}
|
||||
int time = BaseClass.DateTimeToTimestampSeconds(DateTime.Now) + BaseClass.TimeDifferent;
|
||||
string time1 = Encryption(time);
|
||||
|
||||
var dict = new Dictionary<string, string>
|
||||
{
|
||||
{ "time", time.ToString() },
|
||||
{ "code", time1 },
|
||||
{ "code_version", "1" },
|
||||
{ "version", BaseClass.VersionCount.ToString() },
|
||||
{ "user_name", BaseClass.UserName },
|
||||
{ "path", BaseClass.MainPath }
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(BaseClass.AgentCode))
|
||||
{
|
||||
dict.Add("agent_code", BaseClass.AgentCode);
|
||||
dict.Add("agent_name", BaseClass.AgentName);
|
||||
}
|
||||
|
||||
return dict;
|
||||
}
|
||||
/// <summary>
|
||||
/// 签名算法
|
||||
/// </summary>
|
||||
/// <param name="s">随机数</param>
|
||||
/// <returns>加密签名结果</returns>
|
||||
public static string Encryptionxx(int s)
|
||||
{
|
||||
string ss = s.ToString();
|
||||
if (ss.Length > 8)
|
||||
{
|
||||
ss = ss.Substring(ss.Length - 8);
|
||||
s = int.Parse(ss);
|
||||
if (s < 100000000)
|
||||
s += 100000000;
|
||||
}
|
||||
byte[] kb = Encoding.ASCII.GetBytes(s.ToString());
|
||||
if (BaseClass.NewSignatureAuth)
|
||||
{
|
||||
double y = s * 1.6081825125;
|
||||
y += 4582095.48659959;
|
||||
y += kb[3] * 934579.486548;
|
||||
y += kb[7] + 4889894.30184;
|
||||
byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y -= 478735.48548;
|
||||
y -= k[6] * 426720.454545;
|
||||
y -= k[2] * 5667826.96889;
|
||||
byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y += 56979810.2455;
|
||||
y -= k1[1] * 58742.0564845;
|
||||
y -= k1[5] * 1528.487866;
|
||||
string c = ((int)y).ToString();
|
||||
return GetMd5(c); //返回签名的MD5结果
|
||||
}
|
||||
else
|
||||
{
|
||||
double y = s * 1.8061825125;
|
||||
y += 4852095.48659959;
|
||||
y += kb[3] * 943579.486548;
|
||||
y += kb[7] + 4889894.30184;
|
||||
byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y -= 458735.48548;
|
||||
y -= k[6] * 458720.454545;
|
||||
y -= k[2] * 5447826.96889;
|
||||
byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
||||
y += 34779810.2455;
|
||||
y -= k1[1] * 57942.0564845;
|
||||
y -= k1[5] * 1548.487866;
|
||||
string c = ((int)y).ToString();
|
||||
return GetMd5(c); //返回签名的MD5结果
|
||||
}
|
||||
//double y = s * 1.8061825125;
|
||||
//y += 4852095.48659959;
|
||||
//y += kb[3] * 943579.486548;
|
||||
//y += kb[7] + 4889894.30184;
|
||||
//byte[] k = Encoding.ASCII.GetBytes(y.ToString());
|
||||
//y -= 458735.48548;
|
||||
//y -= k[6] * 458720.454545;
|
||||
//y -= k[2] * 5447826.96889;
|
||||
//byte[] k1 = Encoding.ASCII.GetBytes(y.ToString());
|
||||
//y += 34779810.2455;
|
||||
//y -= k1[1] * 57942.0564845;
|
||||
//y -= k1[5] * 1548.487866;
|
||||
//string c = ((int)y).ToString();
|
||||
//return GetMd5(c); //返回签名的MD5结果
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 签名算法
|
||||
/// </summary>
|
||||
/// <param name="s">随机数</param>
|
||||
/// <returns>加密签名结果</returns>
|
||||
public static string Encryption(int s)
|
||||
{
|
||||
//return GetMd5(s + "sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD");
|
||||
|
||||
string sign = $"{s}sdhewu*/fhAAue48485ew5+5%@3485esGFFHFD";
|
||||
return GetMd5(sign);
|
||||
|
||||
}
|
||||
|
||||
public string Get(string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key))
|
||||
return "";
|
||||
byte[] inArray = Convert.FromBase64String(key.Replace("/", "="));
|
||||
string html = Encoding.UTF8.GetString(inArray);
|
||||
|
||||
html = html.Replace("C", "1");
|
||||
html = html.Replace("Q", "6");
|
||||
html = html.Replace("I", "2");
|
||||
html = html.Replace("L", "0");
|
||||
html = html.Replace("Z", "9");
|
||||
html = html.Replace("O", "5");
|
||||
html = html.Replace("P", "8");
|
||||
html = html.Replace("D", "7");
|
||||
html = html.Replace("R", "b");
|
||||
html = html.Replace("S", "c");
|
||||
html = html.Replace("J", "a");
|
||||
return html;
|
||||
}
|
||||
/// <summary>
|
||||
/// MD5加密
|
||||
/// </summary>
|
||||
/// <param name="instring"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMd5(string instring)
|
||||
{
|
||||
byte[] result = Encoding.Default.GetBytes(instring.Trim());
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] output = md5.ComputeHash(result);
|
||||
return BitConverter.ToString(output).Replace("-", "");
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取验证码
|
||||
/// </summary>
|
||||
/// <param name="mobile"></param>
|
||||
/// <param name="success"></param>
|
||||
/// <returns></returns>
|
||||
public static string SendCode(string mobile, out bool success)
|
||||
{
|
||||
string url = BaseClass.Build29WxObjString("sms_gate");
|
||||
string data = "mobile=" + mobile + "&" + GetSignature();
|
||||
string html = GetHtml.PostUtf8(url, data);
|
||||
success = false;
|
||||
if (string.IsNullOrEmpty(html) || html.Contains("Error No File"))
|
||||
{
|
||||
return "提交请求失败,请重试,如仍失败请尝试以下方法:\r\n" +
|
||||
"1、Win7、8、10系统请(右击)使用管理员权限运行\r\n" +
|
||||
"2、检查网络链接是否正确、杀毒防火墙等是否禁止链接(可卸载后再次登录)\r\n" +
|
||||
"3、请不要使用代理上网,更换为路由或者直接链接\r\n" +
|
||||
"4、可先卸载杀毒软件或者安全卫士,软件正常联网后,重新安装杀毒\r\n" +
|
||||
"5、如以上方法依然无法解决,可联系客服QQ:" + BaseClass.ServiceQQ + " 协助";
|
||||
}
|
||||
if (!html.Contains("\"code\":200"))
|
||||
{
|
||||
var errMsg = BaseRegex.GetStringJson(ref html, "msg");
|
||||
if (string.IsNullOrEmpty(errMsg))
|
||||
errMsg = html;
|
||||
return errMsg;
|
||||
}
|
||||
success = true;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
public static string JsCode = @"var auth = {
|
||||
public static string JsCode = @"var auth = {
|
||||
getPublicKey: function() {
|
||||
var _this = this;
|
||||
Helper.get(""earth/api/queryPasswordEncrypt"", {}).then(function(d) {
|
||||
@@ -767,5 +805,5 @@ namespace Work
|
||||
}
|
||||
};auth.init();";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user