1.易转发 host屏蔽删除

2.抖音同步
3.QQ增加扫码前输入QQ号码
This commit is contained in:
老道 2023-03-06 08:49:40 +08:00
parent d22a3b16b2
commit 9d7a615a7f
23 changed files with 369 additions and 108 deletions

Binary file not shown.

View File

@ -166,8 +166,7 @@
</Reference> </Reference>
<Reference Include="Robot.Framework, Version=4.5.2101.7, Culture=neutral, processorArchitecture=x86"> <Reference Include="Robot.Framework, Version=4.5.2101.7, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\Debug\Robot.Framework.dll</HintPath> <HintPath>..\DLL\Robot.Framework.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="SqlSugar, Version=4.9.9.3, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SqlSugar, Version=4.9.9.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@ -208,6 +208,7 @@
<DependentUpon>UpdateForm.cs</DependentUpon> <DependentUpon>UpdateForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Util.cs" /> <Compile Include="Util.cs" />
<Compile Include="Utils\CacheHelper.cs" />
<Compile Include="Utils\Common.cs" /> <Compile Include="Utils\Common.cs" />
<Compile Include="Utils\ProtoBufExtension.cs" /> <Compile Include="Utils\ProtoBufExtension.cs" />
<Compile Include="Utils\RegistryHelper.cs" /> <Compile Include="Utils\RegistryHelper.cs" />

View File

@ -39,18 +39,6 @@ namespace PCRobot
private void PCRobotForm_Load(object sender, EventArgs e) private void PCRobotForm_Load(object sender, EventArgs e)
{ {
try
{
WeChatActivateHelper.Set_Hosts("", "");
//WeChatActivateHelper.Set_Hosts("dldir1v6.qq.com", "127.0.0.1");
//WeChatActivateHelper.Set_Hosts("dldir1.qq.com", "127.0.0.1");
//LogHelper.GetSingleObj().Info("屏蔽", "屏蔽微信自动更新成功");
}
catch (Exception exception)
{
LogHelper.GetSingleObj().Info("屏蔽", "屏蔽微信自动更新异常");
}
try try
{ {
WeChatActivateHelperV2.Init(2); WeChatActivateHelperV2.Init(2);

View File

@ -288,14 +288,22 @@ namespace PCRobot.PCWechat.Enterprise
do do
{ {
Thread.Sleep(200); Thread.Sleep(200);
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
object item = cache[RemoteCache]; //object item = cache[RemoteCache];
if (item != null) //if (item != null)
//{
// cache.Remove(RemoteCache);
// var r = item as RemoteLoginCode;
// return r;
//}
if (CacheHelper.Exist(RemoteCache))
{ {
cache.Remove(RemoteCache); CacheHelper.Remove(RemoteCache);
var r = item as RemoteLoginCode; var r = CacheHelper.Get<RemoteLoginCode>(RemoteCache);
return r; return r;
} }
} while (awaitTime >= DateTime.Now); } while (awaitTime >= DateTime.Now);
return null; return null;
}).Result; }).Result;

View File

@ -110,7 +110,7 @@ namespace PCRobot.PCWechat.Enterprise
{ {
return; return;
} }
//获取机器人对象 //获取机器人对象
WechatUser user = WechatClient.GetUser(dwClientid, WechatType.Xiaoxie_QY); WechatUser user = WechatClient.GetUser(dwClientid, WechatType.Xiaoxie_QY);
@ -161,10 +161,12 @@ namespace PCRobot.PCWechat.Enterprise
var codeInfo = new RemoteLoginCode() { pid = MT_APP_READY_MSG_BIND[dwClientid], cImgB64 = cfBase64, b64Md5 = HttpHelper.ToMD5(cfBase64), rType = RobotType., t = HttpExtend.GetTimeStamp(DateTime.Now) }; var codeInfo = new RemoteLoginCode() { pid = MT_APP_READY_MSG_BIND[dwClientid], cImgB64 = cfBase64, b64Md5 = HttpHelper.ToMD5(cfBase64), rType = RobotType., t = HttpExtend.GetTimeStamp(DateTime.Now) };
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
////查找 md5 的缓存,不存在则返回null
//cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
//查找 md5 的缓存,不存在则返回null //查找 md5 的缓存,不存在则返回null
object item = cache[RemoteCache]; CacheHelper.Add(RemoteCache, codeInfo, 5);
cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
RemoteLoginCodes.Add(codeInfo); RemoteLoginCodes.Add(codeInfo);
} }

View File

@ -369,14 +369,22 @@ namespace PCRobot.PCWechat.Routine
do do
{ {
Thread.Sleep(200); Thread.Sleep(200);
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
object item = cache[RemoteCache]; //object item = cache[RemoteCache];
if (item != null) //if (item != null)
//{
// cache.Remove(RemoteCache);
// var r = item as RemoteLoginCode;
// return r;
//}
if (CacheHelper.Exist(RemoteCache))
{ {
cache.Remove(RemoteCache); CacheHelper.Remove(RemoteCache);
var r = item as RemoteLoginCode; var r = CacheHelper.Get<RemoteLoginCode>(RemoteCache);
return r; return r;
} }
} while (awaitTime >= DateTime.Now); } while (awaitTime >= DateTime.Now);
return null; return null;
}).Result; }).Result;

View File

@ -95,10 +95,14 @@ namespace PCRobot.PCWechat.Routine
var codeInfo = new RemoteLoginCode() { pid = pid, cImgB64 = cfBase64, b64Md5 = HttpHelper.ToMD5(cfBase64), rType = RobotType., t = HttpExtend.GetTimeStamp(DateTime.Now) }; var codeInfo = new RemoteLoginCode() { pid = pid, cImgB64 = cfBase64, b64Md5 = HttpHelper.ToMD5(cfBase64), rType = RobotType., t = HttpExtend.GetTimeStamp(DateTime.Now) };
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
////查找 md5 的缓存,不存在则返回null
//object item = cache[RemoteCache];
//cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
//查找 md5 的缓存,不存在则返回null //查找 md5 的缓存,不存在则返回null
object item = cache[RemoteCache]; CacheHelper.Add(RemoteCache, codeInfo, 5);
cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
RemoteLoginCodes.Add(codeInfo); RemoteLoginCodes.Add(codeInfo);
} }
@ -1173,10 +1177,12 @@ namespace PCRobot.PCWechat.Routine
if (!string.IsNullOrWhiteSpace(url)) if (!string.IsNullOrWhiteSpace(url))
{ {
//CheckUrlCache.Add(url.Trim(), int.Parse(data["status"].ToString())); //CheckUrlCache.Add(url.Trim(), int.Parse(data["status"].ToString()));
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
//查找 md5 的缓存,不存在则返回null ////查找 md5 的缓存,不存在则返回null
object item = cache[url.Trim()]; //object item = cache[url.Trim()];
cache.Insert(url.Trim(), int.Parse(data["status"].ToString()), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration); //cache.Insert(url.Trim(), int.Parse(data["status"].ToString()), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration);
CacheHelper.Add(url.Trim(), int.Parse(data["status"].ToString()), 10);
} }
} }
} }
@ -1297,10 +1303,13 @@ namespace PCRobot.PCWechat.Routine
var md5Text = Common.GetMD5(string.Join(",", wxids)); var md5Text = Common.GetMD5(string.Join(",", wxids));
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
//查找 md5 的缓存,不存在则返回null ////查找 md5 的缓存,不存在则返回null
object item = cache[md5Text]; //object item = cache[md5Text];
cache.Insert(md5Text, data["room_wxid"].ToString(), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration); //cache.Insert(md5Text, data["room_wxid"].ToString(), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration);
CacheHelper.Add(md5Text, data["room_wxid"].ToString(), 10);
} }
break; break;
case MsgType.MT_ROOM_DEL_NOTIFY_MSG://群成员删除通知 case MsgType.MT_ROOM_DEL_NOTIFY_MSG://群成员删除通知

View File

@ -1268,10 +1268,15 @@ namespace PCRobot.PCWechat.Routine
{ {
Thread.Sleep(200); Thread.Sleep(200);
//if (CheckUrlCache.ContainsKey(url)) return CheckUrlCache[url]; //if (CheckUrlCache.ContainsKey(url)) return CheckUrlCache[url];
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
object item = cache[url]; //object item = cache[url];
if (item != null) //if (item != null)
return int.Parse(item.ToString()); // return int.Parse(item.ToString());
if (CacheHelper.Exist(url))
{
return CacheHelper.Get<int>(url);
}
} while (awaitTime >= DateTime.Now); } while (awaitTime >= DateTime.Now);
return -1; return -1;
}).Result; }).Result;

View File

@ -6,6 +6,7 @@ using System.IO;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using WechatHelper;
namespace PCRobot namespace PCRobot
{ {

View File

@ -738,11 +738,18 @@ namespace PCRobot.Utils
{ {
try try
{ {
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
////查找 md5 的缓存,不存在则返回null
//object item = cache[key];
//if (item == null)
// cache.Insert(key, value, null, DateTime.Now.AddSeconds(secondes), System.Web.Caching.Cache.NoSlidingExpiration);
//return true;
//查找 md5 的缓存,不存在则返回null //查找 md5 的缓存,不存在则返回null
object item = cache[key]; if (!CacheHelper.Exist(key))
if (item == null) {
cache.Insert(key, value, null, DateTime.Now.AddSeconds(secondes), System.Web.Caching.Cache.NoSlidingExpiration); CacheHelper.Add(key, value, secondes);
}
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
@ -761,10 +768,15 @@ namespace PCRobot.Utils
{ {
try try
{ {
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
object item = cache[key]; //object item = cache[key];
if (item != null) //if (item != null)
return item as T; // return item as T;
if (CacheHelper.Exist(key))
{
return CacheHelper.Get<T>(key);
}
} }
catch (Exception) catch (Exception)
{ {
@ -781,8 +793,10 @@ namespace PCRobot.Utils
{ {
try try
{ {
Cache cache = HttpRuntime.Cache; //Cache cache = HttpRuntime.Cache;
cache.Remove(key); //cache.Remove(key);
CacheHelper.Remove(key);
return true; return true;
} }
@ -804,10 +818,13 @@ namespace PCRobot.Utils
{ {
try try
{ {
//var MD5 = GetMD5($"{text}");
//Cache cache = HttpRuntime.Cache;
//object item = cache[MD5];
//return item != null ? true : false;
var MD5 = GetMD5($"{text}"); var MD5 = GetMD5($"{text}");
Cache cache = HttpRuntime.Cache; return CacheHelper.Exist(MD5);
object item = cache[MD5];
return item != null ? true : false;
} }
catch (Exception) catch (Exception)
{ {
@ -826,12 +843,19 @@ namespace PCRobot.Utils
{ {
try try
{ {
//var MD5 = GetMD5($"{text}");
//Cache cache = HttpRuntime.Cache;
////查找 md5 的缓存,不存在则返回null
//object item = cache[MD5];
//if (item == null)
// cache.Insert(MD5, 1, null, DateTime.Now.AddSeconds(secondes), System.Web.Caching.Cache.NoSlidingExpiration);
//return true;
var MD5 = GetMD5($"{text}"); var MD5 = GetMD5($"{text}");
Cache cache = HttpRuntime.Cache; if (!CacheHelper.Exist(MD5))
//查找 md5 的缓存,不存在则返回null {
object item = cache[MD5]; CacheHelper.Add(MD5, "", secondes);
if (item == null) }
cache.Insert(MD5, 1, null, DateTime.Now.AddSeconds(secondes), System.Web.Caching.Cache.NoSlidingExpiration);
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
@ -850,10 +874,13 @@ namespace PCRobot.Utils
{ {
try try
{ {
//var MD5 = GetMD5(ToAllTrim($"{robotname}{username}{text}"));
//Cache cache = HttpRuntime.Cache;
//object item = cache[MD5];
//return item != null ? true : false;
var MD5 = GetMD5(ToAllTrim($"{robotname}{username}{text}")); var MD5 = GetMD5(ToAllTrim($"{robotname}{username}{text}"));
Cache cache = HttpRuntime.Cache; return CacheHelper.Exist(MD5);
object item = cache[MD5];
return item != null ? true : false;
} }
catch (Exception) catch (Exception)
{ {
@ -872,12 +899,19 @@ namespace PCRobot.Utils
{ {
try try
{ {
//var MD5 = GetMD5(ToAllTrim($"{robotname}{username}{text}"));
//Cache cache = HttpRuntime.Cache;
////查找 md5 的缓存,不存在则返回null
//object item = cache[MD5];
//if (item == null)
// cache.Insert(MD5, 1, null, DateTime.Now.AddSeconds(seconds), System.Web.Caching.Cache.NoSlidingExpiration);
//return true;
var MD5 = GetMD5(ToAllTrim($"{robotname}{username}{text}")); var MD5 = GetMD5(ToAllTrim($"{robotname}{username}{text}"));
Cache cache = HttpRuntime.Cache; if (!CacheHelper.Exist(MD5))
//查找 md5 的缓存,不存在则返回null {
object item = cache[MD5]; CacheHelper.Add(MD5, "", seconds);
if (item == null) }
cache.Insert(MD5, 1, null, DateTime.Now.AddSeconds(seconds), System.Web.Caching.Cache.NoSlidingExpiration);
return true; return true;
} }
catch (Exception ex) catch (Exception ex)

View File

@ -324,6 +324,10 @@ namespace WechatHelper
public static void Remove_Hosts(string hosts_str) public static void Remove_Hosts(string hosts_str)
{ {
string path = System.Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\drivers\\etc\\hosts"; string path = System.Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\drivers\\etc\\hosts";
if (File.GetAttributes(path) == (FileAttributes.ReadOnly | FileAttributes.Archive))
{
File.SetAttributes(path, FileAttributes.Archive);
}
string[] hosts = File.ReadAllLines(path); string[] hosts = File.ReadAllLines(path);
List<string> list = hosts.ToList(); List<string> list = hosts.ToList();
//int index = list.FindIndex(x => x.Contains(hosts_str)); //int index = list.FindIndex(x => x.Contains(hosts_str));

View File

@ -223,8 +223,24 @@ namespace PCRobot.Utils
/// </summary> /// </summary>
private static void ShieldingWeChatUpdateFunction() private static void ShieldingWeChatUpdateFunction()
{ {
SetHost("dldir1v6.qq.com", "127.0.0.1"); //SetHost("dldir1v6.qq.com", "127.0.0.1");
SetHost("dldir1.qq.com", "127.0.0.1"); //SetHost("dldir1.qq.com", "127.0.0.1");
DelHost("dldir1v6.qq.com");
DelHost("dldir1.qq.com");
}
public static void DelHost(string hosts_str)
{
string path = System.Environment.GetFolderPath(Environment.SpecialFolder.System) + "\\drivers\\etc\\hosts";
if (File.GetAttributes(path) == (FileAttributes.ReadOnly | FileAttributes.Archive))
{
File.SetAttributes(path, FileAttributes.Archive);
}
string[] hosts = File.ReadAllLines(path);
List<string> list = hosts.ToList();
list.RemoveAll(x => x.Contains(hosts_str));
File.WriteAllLines(path, list.ToArray());
} }
/// <summary> /// <summary>

View File

@ -341,6 +341,7 @@ namespace TBRebate.Uses
var msgid = Guid.NewGuid().ToString(); var msgid = Guid.NewGuid().ToString();
try try
{ {
debug(msgid, e.Message);
var db = ApiClient.GetSession(); var db = ApiClient.GetSession();
var tbinfoTemps = db.FindTbInfoTempGroups(); var tbinfoTemps = db.FindTbInfoTempGroups();
@ -391,7 +392,7 @@ namespace TBRebate.Uses
var tb_cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType. && f.username == pids[1]); var tb_cps = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType. && f.username == pids[1]);
if (tb_cps == null) throw new Exception($"@阿里妈妈推广位异常,请检测后重试!,{pid}"); if (tb_cps == null) throw new Exception($"@阿里妈妈推广位异常,请检测后重试!,{pid}");
debug(msgid, "推广位");
//关键词/标题 //关键词/标题
var keyword = string.Empty; var keyword = string.Empty;
//是否是标题 //是否是标题
@ -425,6 +426,7 @@ namespace TBRebate.Uses
} }
} }
#endregion #endregion
debug(msgid, "找xx");
#region , #region ,
if (string.IsNullOrEmpty(keyword) && Class1.Config.SearchTitleSwitch == SwitchType. && !Regex.IsMatch(message, Tools.Reg_QRCode_Goods))//开启淘宝标题搜索 if (string.IsNullOrEmpty(keyword) && Class1.Config.SearchTitleSwitch == SwitchType. && !Regex.IsMatch(message, Tools.Reg_QRCode_Goods))//开启淘宝标题搜索
{ {
@ -446,7 +448,7 @@ namespace TBRebate.Uses
} }
} }
#endregion #endregion
debug(msgid, "标题");
#region #region
string QRCodeUrl = string.Empty; string QRCodeUrl = string.Empty;
if (Class1.Config.QRCodeSearchSwitch == SwitchType.) if (Class1.Config.QRCodeSearchSwitch == SwitchType.)
@ -459,6 +461,8 @@ namespace TBRebate.Uses
} }
} }
#endregion #endregion
debug(msgid, "二维码");
var tbAnalysis = new TbAnalysis(); var tbAnalysis = new TbAnalysis();
var title = string.Empty;//商品标题 var title = string.Empty;//商品标题
@ -469,7 +473,6 @@ namespace TBRebate.Uses
{ {
item_id = tbAnalysis.FindItemIdByUrlAndTklAndMkl(string.IsNullOrEmpty(QRCodeUrl) ? message : QRCodeUrl, api, pids); item_id = tbAnalysis.FindItemIdByUrlAndTklAndMkl(string.IsNullOrEmpty(QRCodeUrl) ? message : QRCodeUrl, api, pids);
//TODO 淘宝商品Id转成字符串Id //TODO 淘宝商品Id转成字符串Id
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -543,13 +546,13 @@ namespace TBRebate.Uses
#endregion #endregion
} }
#endregion #endregion
#region id搜索 #region id搜索
if (!string.IsNullOrWhiteSpace(title) || !string.IsNullOrEmpty(keyword) || !string.IsNullOrEmpty(item_id)) if (!string.IsNullOrWhiteSpace(title) || !string.IsNullOrEmpty(keyword) || !string.IsNullOrEmpty(item_id))
{ {
if (!ApiClient.Setting.SystemConfig.message_warning_switch) if (!ApiClient.Setting.SystemConfig.message_warning_switch)
e.SendMessage(Class1.Config.SearchingTip); e.SendMessage(Class1.Config.SearchingTip);
debug(msgid, "查询中..");
var titleSuccess = false;//判断是否是标题搜索 var titleSuccess = false;//判断是否是标题搜索
try try
{ {
@ -563,6 +566,8 @@ namespace TBRebate.Uses
//商品的详细信息 //商品的详细信息
Dictionary<string, object> objData = null; Dictionary<string, object> objData = null;
debug(msgid, "累计次数");
if (!string.IsNullOrEmpty(keyword) && IsTitle && string.IsNullOrEmpty(item_id))//符合搜索标题查询宝贝 if (!string.IsNullOrEmpty(keyword) && IsTitle && string.IsNullOrEmpty(item_id))//符合搜索标题查询宝贝
{ {
try try
@ -581,6 +586,7 @@ namespace TBRebate.Uses
objData = api.SendTaobao("taobao.tbk.item.info.get", new { num_iids = item_id, biz_scene_id = biz_scene_id }); objData = api.SendTaobao("taobao.tbk.item.info.get", new { num_iids = item_id, biz_scene_id = biz_scene_id });
} }
debug(msgid, "获取商品信息");
//商品有返利 //商品有返利
if (objData != null && objData.Count != 0) if (objData != null && objData.Count != 0)
{ {
@ -625,6 +631,8 @@ namespace TBRebate.Uses
} }
} }
debug(msgid, "商品信息解析1");
//商品链接 //商品链接
var item_url = tbk_item["item_url"].ToString(); var item_url = tbk_item["item_url"].ToString();
//店铺名称 //店铺名称
@ -688,6 +696,8 @@ namespace TBRebate.Uses
//实时佣金的时候special_id不为空 //实时佣金的时候special_id不为空
var SpecialIdNotNull = false; var SpecialIdNotNull = false;
debug(msgid, "商品信息解析2");
#region () #region ()
switch (Class1.Config.QueryComparisonSwitch) switch (Class1.Config.QueryComparisonSwitch)
{ {
@ -760,10 +770,12 @@ namespace TBRebate.Uses
break; break;
} }
#endregion #endregion
debug(msgid, "商品信息解析3");
if (privilege == null) throw new Exception("申请高佣失败,原因未知"); if (privilege == null) throw new Exception("申请高佣失败,原因未知");
var privilege_data = privilege["data"] as Dictionary<string, object>; var privilege_data = privilege["data"] as Dictionary<string, object>;
debug(msgid, "商品信息解析4");
#region #region
if (commission_rate == 0) if (commission_rate == 0)
{ {
@ -773,7 +785,7 @@ namespace TBRebate.Uses
commission_rate = double.Parse(privilege_data["min_commission_rate"].ToString()); commission_rate = double.Parse(privilege_data["min_commission_rate"].ToString());
} }
#endregion #endregion
debug(msgid, "商品信息解析5");
//新商品ID的话,获取新的字符串IdB段 //新商品ID的话,获取新的字符串IdB段
if (privilege_data.ContainsKey("item_id")) if (privilege_data.ContainsKey("item_id"))
{ {
@ -792,7 +804,7 @@ namespace TBRebate.Uses
var coupon_price = 0.00d; var coupon_price = 0.00d;
//优惠券满减比较的价格(原价和最终的价格,满减金额好像是通过判断原价进行比较的) //优惠券满减比较的价格(原价和最终的价格,满减金额好像是通过判断原价进行比较的)
var coupon_comparison_price = (reserve_price > zk_final_price ? reserve_price : zk_final_price); var coupon_comparison_price = (reserve_price > zk_final_price ? reserve_price : zk_final_price);
debug(msgid, "商品信息解析6");
#region #region
if (Class1.Config.NoCouponModeSwitch == SwitchType.) if (Class1.Config.NoCouponModeSwitch == SwitchType.)
{ {
@ -1090,7 +1102,7 @@ namespace TBRebate.Uses
coupon_price = 0.00d; coupon_price = 0.00d;
} }
#endregion #endregion
debug(msgid, "商品信息解析7");
if (endPrice == -1 && zk_final_price > coupon_price) if (endPrice == -1 && zk_final_price > coupon_price)
endPrice = (double)((decimal)zk_final_price - (decimal)coupon_price); endPrice = (double)((decimal)zk_final_price - (decimal)coupon_price);
else if (zk_final_price <= coupon_price) else if (zk_final_price <= coupon_price)
@ -1104,10 +1116,11 @@ namespace TBRebate.Uses
{ {
throw new Exception("无结果"); throw new Exception("无结果");
} }
debug(msgid, "商品信息解析8");
//用券后 给用户的佣金 //用券后 给用户的佣金
var useCoupon_commFee = db.FindItemPoint(memberTmp, useCoupon_totalCommFee, 1, CpsType., out compute); var useCoupon_commFee = db.FindItemPoint(memberTmp, useCoupon_totalCommFee, 1, CpsType., out compute);
debug(msgid, "商品信息解析9");
Compute compute1 = null; Compute compute1 = null;
//不用券 佣金 //不用券 佣金
@ -1116,7 +1129,7 @@ namespace TBRebate.Uses
{ {
throw new Exception("无结果"); throw new Exception("无结果");
} }
debug(msgid, "商品信息解析10");
//不用券 给用户的佣金 //不用券 给用户的佣金
var unuseCoupon_commFee = db.FindItemPoint(memberTmp, unuseCoupon_totalCommFee, 1, CpsType., out compute1); var unuseCoupon_commFee = db.FindItemPoint(memberTmp, unuseCoupon_totalCommFee, 1, CpsType., out compute1);
@ -1132,13 +1145,13 @@ namespace TBRebate.Uses
pids = _tlj.adzone_pid.Split('_'); pids = _tlj.adzone_pid.Split('_');
} }
#endregion #endregion
debug(msgid, "商品信息解析11");
//判断是否有淘礼金,有淘礼金用淘礼金,没有就用购物地址 //判断是否有淘礼金,有淘礼金用淘礼金,没有就用购物地址
var couponUrl = string.IsNullOrWhiteSpace(tljUrl) ? coupon_click_url : tljUrl; var couponUrl = string.IsNullOrWhiteSpace(tljUrl) ? coupon_click_url : tljUrl;
if (!string.IsNullOrWhiteSpace(activityId)) if (!string.IsNullOrWhiteSpace(activityId))
couponUrl = couponUrl + "&activityId=" + activityId; couponUrl = couponUrl + "&activityId=" + activityId;
debug(msgid, "商品信息解析12");
//更新私域用户备案信息 //更新私域用户备案信息
if (Class1.Config.QueryComparisonSwitch == QueryComparisonType.使 && !SpecialIdNotNull && string.IsNullOrWhiteSpace(e.Groupid)) if (Class1.Config.QueryComparisonSwitch == QueryComparisonType.使 && !SpecialIdNotNull && string.IsNullOrWhiteSpace(e.Groupid))
{ {
@ -1155,6 +1168,7 @@ namespace TBRebate.Uses
plugin.OnLog($"更细私域异常关系 ({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message}"); plugin.OnLog($"更细私域异常关系 ({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message}");
} }
} }
debug(msgid, "商品信息解析13");
#region tkl #region tkl
TklInfo tklInfo = null; TklInfo tklInfo = null;
var tkl = string.Empty; var tkl = string.Empty;
@ -1196,14 +1210,18 @@ namespace TBRebate.Uses
throw new Exception($"@获取淘口令异常:{ex.Message} - {ex.StackTrace}"); throw new Exception($"@获取淘口令异常:{ex.Message} - {ex.StackTrace}");
} }
#endregion #endregion
debug(msgid, "商品信息解析14");
//淘口令的前/后符号有没有设置.有设置将替换掉 //淘口令的前/后符号有没有设置.有设置将替换掉
tkl = tbAnalysis.ReplaceTklModifier(tklInfo.tkl); tkl = tbAnalysis.ReplaceTklModifier(tklInfo.tkl);
debug(msgid, "商品信息解析15");
//中间页地址 //中间页地址
//var composeUrl = api.ComposeTbClick(item_id, pict_url, tklInfo.tkl, couponUrl, true); //var composeUrl = api.ComposeTbClick(item_id, pict_url, tklInfo.tkl, couponUrl, true);
var composeUrl = api.ComposeTbClick(item_id, pict_url, tklInfo.tkl, tklInfo.isoUrl, true, pid, ApiClient.Setting.SystemConfig.ZjyComposeType == ComposeType.); var composeUrl = api.ComposeTbClick(item_id, pict_url, tklInfo.tkl, tklInfo.isoUrl, true, pid, ApiClient.Setting.SystemConfig.ZjyComposeType == ComposeType.);
// 获取短连接 // 获取短连接
//couponUrl = tbAnalysis.FindShortUrlBySrcUrl(couponUrl, api); //couponUrl = tbAnalysis.FindShortUrlBySrcUrl(couponUrl, api);
couponUrl = tklInfo.isoUrl; couponUrl = tklInfo.isoUrl;
debug(msgid, "商品信息解析16");
#region #region
if (!string.IsNullOrWhiteSpace(tljUrl)) if (!string.IsNullOrWhiteSpace(tljUrl))
{ {
@ -1224,12 +1242,11 @@ namespace TBRebate.Uses
.Replace("[商品图片]", mess.Contains("[商品图片]") ? "[图片=" + ApiClient.GetQRImage(title, zk_final_price.ToString(), coupon_price.ToString(), ((decimal)zk_final_price - (decimal)coupon_price).ToString(), pict_url, composeUrl, ApiClient.QrImageType.B, CpsType.) + "]" : string.Empty) .Replace("[商品图片]", mess.Contains("[商品图片]") ? "[图片=" + ApiClient.GetQRImage(title, zk_final_price.ToString(), coupon_price.ToString(), ((decimal)zk_final_price - (decimal)coupon_price).ToString(), pict_url, composeUrl, ApiClient.QrImageType.B, CpsType.) + "]" : string.Empty)
); );
} }
#endregion #endregion
#region #region
else else
{ {
debug(msgid, "商品信息解析17");
//有券的情况 //有券的情况
if (coupon_price != 0) if (coupon_price != 0)
{ {
@ -1266,6 +1283,8 @@ namespace TBRebate.Uses
} }
else//没有券的情况 else//没有券的情况
{ {
debug(msgid, "商品信息解析18");
var mess = string.Empty; var mess = string.Empty;
if (e.ChatType == ChatType. || e.ChatType == ChatType. || (e.ChatType == ChatType.QQ && string.IsNullOrWhiteSpace(Class1.Config.QQSearchSuccessWithoutCouponTip))) if (e.ChatType == ChatType. || e.ChatType == ChatType. || (e.ChatType == ChatType.QQ && string.IsNullOrWhiteSpace(Class1.Config.QQSearchSuccessWithoutCouponTip)))
mess = Class1.Config.SearchSuccessWithoutCouponTip; mess = Class1.Config.SearchSuccessWithoutCouponTip;
@ -1295,6 +1314,7 @@ namespace TBRebate.Uses
} }
} }
#endregion #endregion
debug(msgid, "商品信息解析19");
#region ,,, #region ,,,
db.Insertable(new fl_query_hist() db.Insertable(new fl_query_hist()
{ {
@ -1311,7 +1331,7 @@ namespace TBRebate.Uses
compute_configdic = compute == null ? string.Empty : JsonConvert.SerializeObject(compute) compute_configdic = compute == null ? string.Empty : JsonConvert.SerializeObject(compute)
}).ExecuteCommand(); }).ExecuteCommand();
db.UpdateRecord(memberTmp.id); db.UpdateRecord(memberTmp.id);
debug(msgid, "商品信息解析20");
var shared = new Dictionary<string, object>(); var shared = new Dictionary<string, object>();
shared["msg_type"] = "查询宝贝"; shared["msg_type"] = "查询宝贝";
shared["cps_type"] = CpsType.; shared["cps_type"] = CpsType.;
@ -1325,10 +1345,12 @@ namespace TBRebate.Uses
var sharedEvent = new SharedEvents(shared); var sharedEvent = new SharedEvents(shared);
EventClient.OnEvent(sender, sharedEvent); EventClient.OnEvent(sender, sharedEvent);
#endregion #endregion
debug(msgid, "商品信息解析21");
return true; return true;
} }
else else
{ {
debug(msgid, "商品信息解析22");
if (Class1.Config.ShopAdSwitch == SwitchType.) if (Class1.Config.ShopAdSwitch == SwitchType.)
{ {
#region ,广, #region ,广,
@ -1497,6 +1519,7 @@ namespace TBRebate.Uses
} }
#endregion #endregion
} }
debug(msgid, "商品信息解析23");
#region #region
//判断是否为天猫商品 //判断是否为天猫商品
var flag_tianmao = api.IsTianmao(item_id); var flag_tianmao = api.IsTianmao(item_id);
@ -1633,7 +1656,7 @@ namespace TBRebate.Uses
} }
} }
} }
debug(msgid, "商品信息解析24");
if (string.IsNullOrWhiteSpace(keyword) && !string.IsNullOrWhiteSpace(title) && Class1.Config.SearchTitleSwitch_NoCommission == SwitchType.) if (string.IsNullOrWhiteSpace(keyword) && !string.IsNullOrWhiteSpace(title) && Class1.Config.SearchTitleSwitch_NoCommission == SwitchType.)
{ {
keyword = title; keyword = title;
@ -1643,7 +1666,7 @@ namespace TBRebate.Uses
} }
else else
e.SendMessage(Class1.Config.SearchNoCommissionTip.Replace("[关键词]", keyword).Replace("[商品标题]", title));//未搜索到提示语 e.SendMessage(Class1.Config.SearchNoCommissionTip.Replace("[关键词]", keyword).Replace("[商品标题]", title));//未搜索到提示语
debug(msgid, "商品信息解析25");
db.UpdateRecord(memberTmp.id); db.UpdateRecord(memberTmp.id);
var shared = new Dictionary<string, object>(); var shared = new Dictionary<string, object>();
@ -1665,6 +1688,7 @@ namespace TBRebate.Uses
} }
catch (Exception ex) catch (Exception ex)
{ {
debug(msgid, "商品信息解析26");
if (Regex.IsMatch(ex.Message, @"sub_msg\"":\""无结果", RegexOptions.IgnoreCase) || ex.Message == "无结果" || Regex.IsMatch(ex.Message, @"sub_msg\"":\""非淘客宝贝", RegexOptions.IgnoreCase)) if (Regex.IsMatch(ex.Message, @"sub_msg\"":\""无结果", RegexOptions.IgnoreCase) || ex.Message == "无结果" || Regex.IsMatch(ex.Message, @"sub_msg\"":\""非淘客宝贝", RegexOptions.IgnoreCase))
{ {
if (string.IsNullOrWhiteSpace(keyword) && !string.IsNullOrWhiteSpace(title) && Class1.Config.SearchTitleSwitch_NoCommission == SwitchType.) if (string.IsNullOrWhiteSpace(keyword) && !string.IsNullOrWhiteSpace(title) && Class1.Config.SearchTitleSwitch_NoCommission == SwitchType.)
@ -1713,10 +1737,10 @@ namespace TBRebate.Uses
} }
} }
#endregion #endregion
} }
catch (Exception ex) catch (Exception ex)
{ {
debug(msgid, "商品信息解析27");
if (ex.Message.StartsWith("@")) if (ex.Message.StartsWith("@"))
plugin.OnLog($"E ({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message.Replace("@", "")}"); plugin.OnLog($"E ({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message.Replace("@", "")}");
else else

View File

@ -178,8 +178,7 @@
</Reference> </Reference>
<Reference Include="Robot.Framework, Version=4.5.2101.7, Culture=neutral, processorArchitecture=x86"> <Reference Include="Robot.Framework, Version=4.5.2101.7, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\Debug\Robot.Framework.dll</HintPath> <HintPath>..\..\DLL\Robot.Framework.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="SqlSugar, Version=4.9.9.3, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="SqlSugar, Version=4.9.9.3, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@ -1793,7 +1793,6 @@ t = {target}");
compose = ComposeTbClick(itemId, img, tkl, url, isShortUrl, DwzType, target, isCircleZjy); compose = ComposeTbClick(itemId, img, tkl, url, isShortUrl, DwzType, target, isCircleZjy);
else else
compose = ComposeTbClick(itemId, img, tkl, url, pid, isTuiGuang, target, isCircleZjy); compose = ComposeTbClick(itemId, img, tkl, url, pid, isTuiGuang, target, isCircleZjy);
return GetComposeUrl(compose, isShortUrl, DwzType, target); return GetComposeUrl(compose, isShortUrl, DwzType, target);
} }

View File

@ -985,6 +985,84 @@ html = {html}");
return html; return html;
} }
/// <summary>
/// 检查抖音App授权时间
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="BusinessException"></exception>
/// <exception cref="Exception"></exception>
public static bool CheckAppAuthTime(string cookies,string userAgent)
{
var param = $"page=1&page_size=21&auth_status=0";
var sign = GetSign(param,userAgent);
if (!string.IsNullOrWhiteSpace(sign))
{
param = $"{param}&_signature={sign}";
}
var xb = GetXbogus(param,userAgent);
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = $"https://buyin.jinritemai.com/api/kol/doudian/app/list?{param}&X-Bogus={xb}",
Method = "GET",
Timeout = 5000,
ReadWriteTimeout = 5000 * 2,
IsToLower = false,
Cookie = cookies,
UserAgent = userAgent,
Accept = "text/html, application/xhtml+xml, */*",
ContentType = "application/x-www-form-urlencoded",
Referer = "https://buyin.jinritemai.com/dashboard/shopwindow/goods-list",
Allowautoredirect = false,
AutoRedirectCookie = false,
ResultType = ResultType.String
};
item.Header.Add("Accept-Language", "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2");
item.Header.Add("Accept-Encoding", "deflate");
HttpResult result = http.GetHtml(item);
string html = result.Html;
if (string.IsNullOrWhiteSpace(html))
{
throw new Exception("数据异常");
}
var jObj = JObject.Parse(html);
if (jObj == null)
{
throw new Exception("获取失败");
}
if (jObj["code"]?.Value<int>() == 0)
{
var jArr = jObj["data"].ToArray();
foreach (var tmp in jArr)
{
if (tmp["app_id"]?.Value<string>() == "7066380295942964749")
{
if (DateTime.TryParse(tmp["expire_time"]?.Value<string>(), out var expireTime))
{
if (expireTime > DateTime.Now)
{
return true;
}
}
return false;
}
}
}
return false;
}
public List<string> DownOrder(DateTime start_time, DateTime end_time, int _page_index, DouyinQueryOrderType type) public List<string> DownOrder(DateTime start_time, DateTime end_time, int _page_index, DouyinQueryOrderType type)
{ {
int num = 0; int num = 0;
@ -1035,7 +1113,7 @@ html = {html}");
var html = result.Html; var html = result.Html;
if (result.Header.AllKeys.Contains("Set-Cookie")) if (result.Header.AllKeys.Contains("Set-Cookie") || result.Header.AllKeys.Contains("set-cookie"))
{ {
var msTokenStr = result.Header["set-cookie"].ToString(); var msTokenStr = result.Header["set-cookie"].ToString();
var reg = Regex.Match(msTokenStr, @"(msToken=.+?;)", RegexOptions.IgnoreCase); var reg = Regex.Match(msTokenStr, @"(msToken=.+?;)", RegexOptions.IgnoreCase);

View File

@ -130,6 +130,7 @@
this.groupBox2.TabIndex = 2; this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false; this.groupBox2.TabStop = false;
this.groupBox2.Text = "第二步 填写授权结果"; this.groupBox2.Text = "第二步 填写授权结果";
this.groupBox2.Visible = false;
// //
// simpleButton3 // simpleButton3
// //

View File

@ -122,6 +122,11 @@ namespace Api.Framework.Cps
{ {
webControl1.WebView.EvalScript( webControl1.WebView.EvalScript(
"document.getElementsByClassName('auxo-btn auxo-btn-primary auxo-btn-lg')[0].click()", false); "document.getElementsByClassName('auxo-btn auxo-btn-primary auxo-btn-lg')[0].click()", false);
}
//https://buyin.jinritemai.com/dashboard/institution/through-power?app_id=7066380295942964749&state=160781175b224be294337798d16aa579
else if (e.Url.Contains("https://buyin.jinritemai.com/dashboard/institution/through-power"))
{
} }
//else if (e.Url.ToLower().Contains("cps.api.52cmg.cn/api/douyin.asmx"))//授权成功页面 //else if (e.Url.ToLower().Contains("cps.api.52cmg.cn/api/douyin.asmx"))//授权成功页面
else if (e.Url.ToLower().Contains($"{ApiClient.Setting.SystemConfig.cps_server_api}api/douyin.asmx"))//授权成功页面 else if (e.Url.ToLower().Contains($"{ApiClient.Setting.SystemConfig.cps_server_api}api/douyin.asmx"))//授权成功页面
@ -160,28 +165,72 @@ namespace Api.Framework.Cps
LogHelper.GetSingleObj().Info("抖音登录获取到用户数据", json); LogHelper.GetSingleObj().Info("抖音登录获取到用户数据", json);
CheckLoginCk(json, CK, UserAgent); CheckLoginCk(json, CK, UserAgent);
if (!IsJumpAuthorizationUrl) var isLoadAuthorizationUrl = true;
if (!DouyinApiV2.CheckAppAuthTime(CK ?? ck, UserAgent))
{ {
Task.Run(() => isLoadAuthorizationUrl = false;
Task.Factory.StartNew(() =>
{ {
int num = 0; Thread.Sleep(2000);
do webControl1.WebView.EvalScript("document.getElementsByClassName('auxo-menu-item auxo-menu-item-only-child headerNav-item basicSettings_daren')[0].click()", false);
{ Thread.Sleep(2000);
num++; webControl1.WebView.EvalScript("document.getElementsByClassName('auxo-menu-item auxo-menu-item-only-child')[12].click()", false);
EventClient.OnEvent("抖音登录", $"请求跳转授权页面,第{num}次"); Thread.Sleep(2000);
webControl1.WebView.LoadUrl(AuthorizeLoginUrl); webControl1.WebView.EvalScript(@"var apps = document.getElementsByClassName('app-name text4-weight');
for(var i = 0; i < apps.length; i++)
{
if (apps[i].innerText == '')
{
apps[i].parentNode.getElementsByClassName('auxo-btn auxo-btn-dashed auxo-btn-sm')[0].click();
break;
}
}
", false);
Thread.Sleep(1000);
Thread.Sleep(10000); webControl1.WebView.EvalScript("document.getElementsByClassName('auxo-btn auxo-btn-primary')[0].click()", false);
} while (num < 13 && !IsJumpAuthorizationUrl); Thread.Sleep(1000);
LoadAuthorizationUrl();
}); });
} }
if (isLoadAuthorizationUrl)
{
LoadAuthorizationUrl();
}
//if (!IsJumpAuthorizationUrl)
//{
// Task.Run(() =>
// {
// int num = 0;
// do
// {
// num++;
// EventClient.OnEvent("抖音登录", $"请求跳转授权页面,第{num}次");
// webControl1.WebView.LoadUrl(AuthorizeLoginUrl);
// Thread.Sleep(10000);
// } while (num < 13 && !IsJumpAuthorizationUrl);
// });
//}
} }
} }
catch (Exception) catch (Exception)
{ } { }
} }
/// <summary>
/// 加载授权地址
/// </summary>
private void LoadAuthorizationUrl()
{
this.webView1.LoadUrl(AuthorizeLoginUrl);
//this.webView1.LoadUrl($"https://cps.api.52cmg.cn/api/auth/login?type=5&state={Math.Abs(Guid.NewGuid().GetHashCode())}");
}
private static string AuthorizeLoginUrl => $"{ApiClient.Setting.SystemConfig.cps_server_api}api/douyin.asmx/login"; private static string AuthorizeLoginUrl => $"{ApiClient.Setting.SystemConfig.cps_server_api}api/douyin.asmx/login";
private string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36"; private string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36";
@ -331,6 +380,12 @@ namespace Api.Framework.Cps
LogHelper.GetSingleObj().Info("抖音登录获取到用户数据", json); LogHelper.GetSingleObj().Info("抖音登录获取到用户数据", json);
if (CheckLoginCk(json, this.textBox1.Text, UserAgent)) if (CheckLoginCk(json, this.textBox1.Text, UserAgent))
{ {
IsAuthorization = true;
EventClient.OnEvent("抖音登录", "抖音授权登录成功!");
this.DialogResult = DialogResult.OK;
return;
this.groupBox2.Enabled = true; this.groupBox2.Enabled = true;
BaseForm.ShowSuccessAutoClose("验证成功,您可以继续授权Api"); BaseForm.ShowSuccessAutoClose("验证成功,您可以继续授权Api");
} }
@ -378,6 +433,14 @@ namespace Api.Framework.Cps
} }
} }
} }
else
{
IsAuthorization = true;
EventClient.OnEvent("抖音登录", "抖音授权登录成功!");
flag = true;
this.DialogResult = DialogResult.OK;
}
if (!flag) if (!flag)
throw new Exception("抖音授权登录失败!"); throw new Exception("抖音授权登录失败!");

View File

@ -537,7 +537,7 @@ xml:字符长度:{(string.IsNullOrWhiteSpace(xml) ? "0" : $"{xml.Length}")}");
} }
#endregion #endregion
#region MyRegion #region
[DllImport("PsyQrDcd.dll"), HandleProcessCorruptedStateExceptions] [DllImport("PsyQrDcd.dll"), HandleProcessCorruptedStateExceptions]
private static extern int DecodePictureFile(string filename); private static extern int DecodePictureFile(string filename);

View File

@ -202,6 +202,12 @@
<Compile Include="QQSdk\QPlus\QQLoginForm.Designer.cs"> <Compile Include="QQSdk\QPlus\QQLoginForm.Designer.cs">
<DependentUpon>QQLoginForm.cs</DependentUpon> <DependentUpon>QQLoginForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="QQSdk\QPlus\SetQQForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="QQSdk\QPlus\SetQQForm.Designer.cs">
<DependentUpon>SetQQForm.cs</DependentUpon>
</Compile>
<Compile Include="QQSdk\QQBase.cs" /> <Compile Include="QQSdk\QQBase.cs" />
<Compile Include="QQSdk\QQEventManage.cs" /> <Compile Include="QQSdk\QQEventManage.cs" />
<Compile Include="Utils\Common.cs" /> <Compile Include="Utils\Common.cs" />
@ -294,6 +300,9 @@
<DependentUpon>QQLoginForm.cs</DependentUpon> <DependentUpon>QQLoginForm.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="QQSdk\QPlus\SetQQForm.resx">
<DependentUpon>SetQQForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="WXSdk\UIForm\BrowserForm.resx"> <EmbeddedResource Include="WXSdk\UIForm\BrowserForm.resx">
<DependentUpon>BrowserForm.cs</DependentUpon> <DependentUpon>BrowserForm.cs</DependentUpon>
<SubType>Designer</SubType> <SubType>Designer</SubType>

View File

@ -1,7 +1,6 @@
using Chat.Framework.QQSdk.Events; using Chat.Framework.QQSdk.Events;
using Chat.Framework.Utils; using Chat.Framework.Utils;
using Robot.Framework; using Robot.Framework;
using Robot.Framework.Entities;
using Robot.Framework.SDK; using Robot.Framework.SDK;
using System; using System;
using System.Linq; using System.Linq;
@ -9,6 +8,7 @@ using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using LoginStatus = Robot.Framework.Entities.LoginStatus;
namespace Chat.Framework.QQSdk.QPlus namespace Chat.Framework.QQSdk.QPlus
{ {
@ -33,9 +33,9 @@ namespace Chat.Framework.QQSdk.QPlus
internal QQClientImpl_QQPlus(QQClient QQClient) internal QQClientImpl_QQPlus(QQClient QQClient)
{ {
this.QQClient = QQClient; this.QQClient = QQClient;
this.QQ = QQClient.User.QQ; this.QQ = QQClient.User?.QQ ?? 0;
this.Nickname = QQClient.User.NickName; this.Nickname = QQClient.User?.NickName ??string.Empty;
this.IsLogin = QQClient.User.LoginStatus == LoginStatus.Login; this.IsLogin = (QQClient.User?.LoginStatus ?? LoginStatus.Logout) == LoginStatus.Login;
//this.Password = Robot.Framework.Utils.Util.ToHex(QQClient.User.md5_1, "", "{0}"); //this.Password = Robot.Framework.Utils.Util.ToHex(QQClient.User.md5_1, "", "{0}");
//this.Password = QQClient.ToString(); //this.Password = QQClient.ToString();
this.IsEQQ = QQClient.QQProtocol != "PCQQ"; this.IsEQQ = QQClient.QQProtocol != "PCQQ";

View File

@ -30,6 +30,7 @@ namespace Chat.Framework.QQSdk.QPlus
{ {
InitializeComponent(); InitializeComponent();
qClient = new QQClient(); qClient = new QQClient();
qClient.User = new QQUser(0,new byte[0]);
qPlusClient = new QQClientImpl_QQPlus(qClient); qPlusClient = new QQClientImpl_QQPlus(qClient);
qClient.LoginStatusChanged += client_LoginStatusChanged; qClient.LoginStatusChanged += client_LoginStatusChanged;
} }
@ -75,6 +76,7 @@ namespace Chat.Framework.QQSdk.QPlus
} }
qPlusClient.Password = pass; qPlusClient.Password = pass;
qClient.QQProtocol = radioButton1.Checked ? "PCQQ" : "企业QQ"; qClient.QQProtocol = radioButton1.Checked ? "PCQQ" : "企业QQ";
qClient.LoadRobotConfig(qq);
qClient.Login(); qClient.Login();
} }
else else
@ -188,9 +190,20 @@ namespace Chat.Framework.QQSdk.QPlus
} }
} }
private uint QQ = 0;
private void picQR_Click(object sender, EventArgs e) private void picQR_Click(object sender, EventArgs e)
{ {
if (sender == null)
{
var set = new SetQQForm();
if (set.ShowDialog() == DialogResult.OK)
{
QQ = set.QQ;
}
}
qClient.User = new QQUser(0, new byte[0]); qClient.User = new QQUser(0, new byte[0]);
qClient.LoadRobotConfig(QQ);
qClient.Login(); qClient.Login();
} }