diff --git a/DLL/Robot.Framework.dll b/DLL/Robot.Framework.dll
index 994d789..e221150 100644
Binary files a/DLL/Robot.Framework.dll and b/DLL/Robot.Framework.dll differ
diff --git a/FLSystem/FLSystem.csproj b/FLSystem/FLSystem.csproj
index 1938531..a73cba2 100644
--- a/FLSystem/FLSystem.csproj
+++ b/FLSystem/FLSystem.csproj
@@ -166,8 +166,7 @@
False
- ..\Debug\Robot.Framework.dll
- False
+ ..\DLL\Robot.Framework.dll
False
diff --git a/PCRobot/PCRobot.csproj b/PCRobot/PCRobot.csproj
index 9caa499..f787408 100644
--- a/PCRobot/PCRobot.csproj
+++ b/PCRobot/PCRobot.csproj
@@ -208,6 +208,7 @@
UpdateForm.cs
+
diff --git a/PCRobot/PCRobotForm.cs b/PCRobot/PCRobotForm.cs
index 9918f77..d87bba5 100644
--- a/PCRobot/PCRobotForm.cs
+++ b/PCRobot/PCRobotForm.cs
@@ -39,18 +39,6 @@ namespace PCRobot
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
{
WeChatActivateHelperV2.Init(2);
diff --git a/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY.cs b/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY.cs
index 6a14da0..0e85cd7 100644
--- a/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY.cs
+++ b/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY.cs
@@ -288,14 +288,22 @@ namespace PCRobot.PCWechat.Enterprise
do
{
Thread.Sleep(200);
- Cache cache = HttpRuntime.Cache;
- object item = cache[RemoteCache];
- if (item != null)
+ //Cache cache = HttpRuntime.Cache;
+ //object item = cache[RemoteCache];
+ //if (item != null)
+ //{
+ // cache.Remove(RemoteCache);
+ // var r = item as RemoteLoginCode;
+ // return r;
+ //}
+
+ if (CacheHelper.Exist(RemoteCache))
{
- cache.Remove(RemoteCache);
- var r = item as RemoteLoginCode;
+ CacheHelper.Remove(RemoteCache);
+ var r = CacheHelper.Get(RemoteCache);
return r;
}
+
} while (awaitTime >= DateTime.Now);
return null;
}).Result;
diff --git a/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY_Analysis.cs b/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY_Analysis.cs
index e6995ee..0420cd4 100644
--- a/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY_Analysis.cs
+++ b/PCRobot/PCWechat/Enterprise/Wechat_Xiaoxie_QY_Analysis.cs
@@ -110,7 +110,7 @@ namespace PCRobot.PCWechat.Enterprise
{
return;
}
-
+
//获取机器人对象
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) };
- Cache cache = HttpRuntime.Cache;
+ //Cache cache = HttpRuntime.Cache;
+ ////查找 md5 的缓存,不存在则返回null
+ //cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
+
//查找 md5 的缓存,不存在则返回null
- object item = cache[RemoteCache];
- cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
+ CacheHelper.Add(RemoteCache, codeInfo, 5);
RemoteLoginCodes.Add(codeInfo);
}
diff --git a/PCRobot/PCWechat/Routine/Wechat_Xiaoxie.cs b/PCRobot/PCWechat/Routine/Wechat_Xiaoxie.cs
index 523268e..98eb02b 100644
--- a/PCRobot/PCWechat/Routine/Wechat_Xiaoxie.cs
+++ b/PCRobot/PCWechat/Routine/Wechat_Xiaoxie.cs
@@ -369,14 +369,22 @@ namespace PCRobot.PCWechat.Routine
do
{
Thread.Sleep(200);
- Cache cache = HttpRuntime.Cache;
- object item = cache[RemoteCache];
- if (item != null)
+ //Cache cache = HttpRuntime.Cache;
+ //object item = cache[RemoteCache];
+ //if (item != null)
+ //{
+ // cache.Remove(RemoteCache);
+ // var r = item as RemoteLoginCode;
+ // return r;
+ //}
+
+ if (CacheHelper.Exist(RemoteCache))
{
- cache.Remove(RemoteCache);
- var r = item as RemoteLoginCode;
+ CacheHelper.Remove(RemoteCache);
+ var r = CacheHelper.Get(RemoteCache);
return r;
}
+
} while (awaitTime >= DateTime.Now);
return null;
}).Result;
diff --git a/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Analysis.cs b/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Analysis.cs
index e140fbb..ee56160 100644
--- a/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Analysis.cs
+++ b/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Analysis.cs
@@ -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) };
- 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
- object item = cache[RemoteCache];
- cache.Insert(RemoteCache, codeInfo, null, DateTime.Now.AddSeconds(3), Cache.NoSlidingExpiration);
+ CacheHelper.Add(RemoteCache, codeInfo, 5);
RemoteLoginCodes.Add(codeInfo);
}
@@ -1173,10 +1177,12 @@ namespace PCRobot.PCWechat.Routine
if (!string.IsNullOrWhiteSpace(url))
{
//CheckUrlCache.Add(url.Trim(), int.Parse(data["status"].ToString()));
- Cache cache = HttpRuntime.Cache;
- //查找 md5 的缓存,不存在则返回null
- object item = cache[url.Trim()];
- cache.Insert(url.Trim(), int.Parse(data["status"].ToString()), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration);
+ //Cache cache = HttpRuntime.Cache;
+ ////查找 md5 的缓存,不存在则返回null
+ //object item = cache[url.Trim()];
+ //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));
- Cache cache = HttpRuntime.Cache;
- //查找 md5 的缓存,不存在则返回null
- object item = cache[md5Text];
- cache.Insert(md5Text, data["room_wxid"].ToString(), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration);
+ //Cache cache = HttpRuntime.Cache;
+ ////查找 md5 的缓存,不存在则返回null
+ //object item = cache[md5Text];
+ //cache.Insert(md5Text, data["room_wxid"].ToString(), null, DateTime.Now.AddSeconds(8), Cache.NoSlidingExpiration);
+
+ CacheHelper.Add(md5Text, data["room_wxid"].ToString(), 10);
+
}
break;
case MsgType.MT_ROOM_DEL_NOTIFY_MSG://群成员删除通知
diff --git a/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Override.cs b/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Override.cs
index 6ca5c72..bfead33 100644
--- a/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Override.cs
+++ b/PCRobot/PCWechat/Routine/Wechat_Xiaoxie_Override.cs
@@ -1268,10 +1268,15 @@ namespace PCRobot.PCWechat.Routine
{
Thread.Sleep(200);
//if (CheckUrlCache.ContainsKey(url)) return CheckUrlCache[url];
- Cache cache = HttpRuntime.Cache;
- object item = cache[url];
- if (item != null)
- return int.Parse(item.ToString());
+ //Cache cache = HttpRuntime.Cache;
+ //object item = cache[url];
+ //if (item != null)
+ // return int.Parse(item.ToString());
+
+ if (CacheHelper.Exist(url))
+ {
+ return CacheHelper.Get(url);
+ }
} while (awaitTime >= DateTime.Now);
return -1;
}).Result;
diff --git a/PCRobot/Program.cs b/PCRobot/Program.cs
index 79f4683..0dd93c3 100644
--- a/PCRobot/Program.cs
+++ b/PCRobot/Program.cs
@@ -6,6 +6,7 @@ using System.IO;
using System.Text;
using System.Threading;
using System.Windows.Forms;
+using WechatHelper;
namespace PCRobot
{
diff --git a/PCRobot/Utils/Common.cs b/PCRobot/Utils/Common.cs
index cd47aec..6cea36d 100644
--- a/PCRobot/Utils/Common.cs
+++ b/PCRobot/Utils/Common.cs
@@ -738,11 +738,18 @@ namespace PCRobot.Utils
{
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
- object item = cache[key];
- if (item == null)
- cache.Insert(key, value, null, DateTime.Now.AddSeconds(secondes), System.Web.Caching.Cache.NoSlidingExpiration);
+ if (!CacheHelper.Exist(key))
+ {
+ CacheHelper.Add(key, value, secondes);
+ }
return true;
}
catch (Exception ex)
@@ -761,10 +768,15 @@ namespace PCRobot.Utils
{
try
{
- Cache cache = HttpRuntime.Cache;
- object item = cache[key];
- if (item != null)
- return item as T;
+ //Cache cache = HttpRuntime.Cache;
+ //object item = cache[key];
+ //if (item != null)
+ // return item as T;
+
+ if (CacheHelper.Exist(key))
+ {
+ return CacheHelper.Get(key);
+ }
}
catch (Exception)
{
@@ -781,8 +793,10 @@ namespace PCRobot.Utils
{
try
{
- Cache cache = HttpRuntime.Cache;
- cache.Remove(key);
+ //Cache cache = HttpRuntime.Cache;
+ //cache.Remove(key);
+
+ CacheHelper.Remove(key);
return true;
}
@@ -804,10 +818,13 @@ namespace PCRobot.Utils
{
try
{
+ //var MD5 = GetMD5($"{text}");
+ //Cache cache = HttpRuntime.Cache;
+ //object item = cache[MD5];
+ //return item != null ? true : false;
+
var MD5 = GetMD5($"{text}");
- Cache cache = HttpRuntime.Cache;
- object item = cache[MD5];
- return item != null ? true : false;
+ return CacheHelper.Exist(MD5);
}
catch (Exception)
{
@@ -826,12 +843,19 @@ namespace PCRobot.Utils
{
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}");
- 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);
+ if (!CacheHelper.Exist(MD5))
+ {
+ CacheHelper.Add(MD5, "", secondes);
+ }
return true;
}
catch (Exception ex)
@@ -850,10 +874,13 @@ namespace PCRobot.Utils
{
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}"));
- Cache cache = HttpRuntime.Cache;
- object item = cache[MD5];
- return item != null ? true : false;
+ return CacheHelper.Exist(MD5);
}
catch (Exception)
{
@@ -872,12 +899,19 @@ namespace PCRobot.Utils
{
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}"));
- 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);
+ if (!CacheHelper.Exist(MD5))
+ {
+ CacheHelper.Add(MD5, "", seconds);
+ }
return true;
}
catch (Exception ex)
diff --git a/PCRobot/Utils/WeChatActivateHelper.cs b/PCRobot/Utils/WeChatActivateHelper.cs
index 174cbd4..6a6eadd 100644
--- a/PCRobot/Utils/WeChatActivateHelper.cs
+++ b/PCRobot/Utils/WeChatActivateHelper.cs
@@ -324,6 +324,10 @@ namespace WechatHelper
public static void Remove_Hosts(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 list = hosts.ToList();
//int index = list.FindIndex(x => x.Contains(hosts_str));
diff --git a/PCRobot/Utils/WeChatActivateHelperV2.cs b/PCRobot/Utils/WeChatActivateHelperV2.cs
index 75ff306..7e597b1 100644
--- a/PCRobot/Utils/WeChatActivateHelperV2.cs
+++ b/PCRobot/Utils/WeChatActivateHelperV2.cs
@@ -223,8 +223,24 @@ namespace PCRobot.Utils
///
private static void ShieldingWeChatUpdateFunction()
{
- SetHost("dldir1v6.qq.com", "127.0.0.1");
- SetHost("dldir1.qq.com", "127.0.0.1");
+ //SetHost("dldir1v6.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 list = hosts.ToList();
+ list.RemoveAll(x => x.Contains(hosts_str));
+ File.WriteAllLines(path, list.ToArray());
}
///
diff --git a/应用/TBRebate/Uses/MessageOperation.cs b/应用/TBRebate/Uses/MessageOperation.cs
index f043848..4f99a21 100644
--- a/应用/TBRebate/Uses/MessageOperation.cs
+++ b/应用/TBRebate/Uses/MessageOperation.cs
@@ -341,6 +341,7 @@ namespace TBRebate.Uses
var msgid = Guid.NewGuid().ToString();
try
{
+ debug(msgid, e.Message);
var db = ApiClient.GetSession();
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]);
if (tb_cps == null) throw new Exception($"@阿里妈妈推广位异常,请检测后重试!,{pid}");
-
+ debug(msgid, "推广位");
//关键词/标题
var keyword = string.Empty;
//是否是标题
@@ -425,6 +426,7 @@ namespace TBRebate.Uses
}
}
#endregion
+ debug(msgid, "找xx");
#region 判断消息是否符合标题验证,如果符合将判断为标题搜索
if (string.IsNullOrEmpty(keyword) && Class1.Config.SearchTitleSwitch == SwitchType.开启 && !Regex.IsMatch(message, Tools.Reg_QRCode_Goods))//开启淘宝标题搜索
{
@@ -446,7 +448,7 @@ namespace TBRebate.Uses
}
}
#endregion
-
+ debug(msgid, "标题");
#region 宝贝二维码识别
string QRCodeUrl = string.Empty;
if (Class1.Config.QRCodeSearchSwitch == SwitchType.开启)
@@ -459,6 +461,8 @@ namespace TBRebate.Uses
}
}
#endregion
+
+ debug(msgid, "二维码");
var tbAnalysis = new TbAnalysis();
var title = string.Empty;//商品标题
@@ -469,7 +473,6 @@ namespace TBRebate.Uses
{
item_id = tbAnalysis.FindItemIdByUrlAndTklAndMkl(string.IsNullOrEmpty(QRCodeUrl) ? message : QRCodeUrl, api, pids);
//TODO 淘宝商品Id转成字符串Id
-
}
catch (Exception ex)
{
@@ -543,13 +546,13 @@ namespace TBRebate.Uses
#endregion
}
#endregion
-
#region 标题搜索和商品id搜索
if (!string.IsNullOrWhiteSpace(title) || !string.IsNullOrEmpty(keyword) || !string.IsNullOrEmpty(item_id))
{
if (!ApiClient.Setting.SystemConfig.message_warning_switch)
e.SendMessage(Class1.Config.SearchingTip);
+ debug(msgid, "查询中..");
var titleSuccess = false;//判断是否是标题搜索
try
{
@@ -563,6 +566,8 @@ namespace TBRebate.Uses
//商品的详细信息
Dictionary objData = null;
+ debug(msgid, "累计次数");
+
if (!string.IsNullOrEmpty(keyword) && IsTitle && string.IsNullOrEmpty(item_id))//符合搜索标题查询宝贝
{
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 });
}
+ debug(msgid, "获取商品信息");
//商品有返利
if (objData != null && objData.Count != 0)
{
@@ -625,6 +631,8 @@ namespace TBRebate.Uses
}
}
+ debug(msgid, "商品信息解析1");
+
//商品链接
var item_url = tbk_item["item_url"].ToString();
//店铺名称
@@ -688,6 +696,8 @@ namespace TBRebate.Uses
//实时佣金的时候special_id不为空
var SpecialIdNotNull = false;
+ debug(msgid, "商品信息解析2");
+
#region 申请高佣(通过设置的返利模式获取对应的高佣信息)
switch (Class1.Config.QueryComparisonSwitch)
{
@@ -760,10 +770,12 @@ namespace TBRebate.Uses
break;
}
#endregion
+
+ debug(msgid, "商品信息解析3");
if (privilege == null) throw new Exception("申请高佣失败,原因未知");
var privilege_data = privilege["data"] as Dictionary;
-
+ debug(msgid, "商品信息解析4");
#region 获取商品佣金
if (commission_rate == 0)
{
@@ -773,7 +785,7 @@ namespace TBRebate.Uses
commission_rate = double.Parse(privilege_data["min_commission_rate"].ToString());
}
#endregion
-
+ debug(msgid, "商品信息解析5");
//新商品ID的话,获取新的字符串IdB段
if (privilege_data.ContainsKey("item_id"))
{
@@ -792,7 +804,7 @@ namespace TBRebate.Uses
var coupon_price = 0.00d;
//优惠券满减比较的价格(原价和最终的价格,满减金额好像是通过判断原价进行比较的)
var coupon_comparison_price = (reserve_price > zk_final_price ? reserve_price : zk_final_price);
-
+ debug(msgid, "商品信息解析6");
#region 有无券模式 获取对应的优惠券地址和优惠券金额
if (Class1.Config.NoCouponModeSwitch == SwitchType.关闭)
{
@@ -1090,7 +1102,7 @@ namespace TBRebate.Uses
coupon_price = 0.00d;
}
#endregion
-
+ debug(msgid, "商品信息解析7");
if (endPrice == -1 && zk_final_price > coupon_price)
endPrice = (double)((decimal)zk_final_price - (decimal)coupon_price);
else if (zk_final_price <= coupon_price)
@@ -1104,10 +1116,11 @@ namespace TBRebate.Uses
{
throw new Exception("无结果");
}
+ debug(msgid, "商品信息解析8");
//用券后 给用户的佣金
var useCoupon_commFee = db.FindItemPoint(memberTmp, useCoupon_totalCommFee, 1, CpsType.阿里妈妈, out compute);
-
+ debug(msgid, "商品信息解析9");
Compute compute1 = null;
//不用券 佣金
@@ -1116,7 +1129,7 @@ namespace TBRebate.Uses
{
throw new Exception("无结果");
}
-
+ debug(msgid, "商品信息解析10");
//不用券 给用户的佣金
var unuseCoupon_commFee = db.FindItemPoint(memberTmp, unuseCoupon_totalCommFee, 1, CpsType.阿里妈妈, out compute1);
@@ -1132,13 +1145,13 @@ namespace TBRebate.Uses
pids = _tlj.adzone_pid.Split('_');
}
#endregion
-
+ debug(msgid, "商品信息解析11");
//判断是否有淘礼金,有淘礼金用淘礼金,没有就用购物地址
var couponUrl = string.IsNullOrWhiteSpace(tljUrl) ? coupon_click_url : tljUrl;
if (!string.IsNullOrWhiteSpace(activityId))
couponUrl = couponUrl + "&activityId=" + activityId;
-
+ debug(msgid, "商品信息解析12");
//更新私域用户备案信息
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}");
}
}
+ debug(msgid, "商品信息解析13");
#region 获取淘口令 tkl
TklInfo tklInfo = null;
var tkl = string.Empty;
@@ -1196,14 +1210,18 @@ namespace TBRebate.Uses
throw new Exception($"@获取淘口令异常:{ex.Message} - {ex.StackTrace}");
}
#endregion
+ debug(msgid, "商品信息解析14");
//淘口令的前/后符号有没有设置.有设置将替换掉
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, tklInfo.isoUrl, true, pid, ApiClient.Setting.SystemConfig.ZjyComposeType == ComposeType.有推荐商品);
// 获取短连接
//couponUrl = tbAnalysis.FindShortUrlBySrcUrl(couponUrl, api);
couponUrl = tklInfo.isoUrl;
+
+ debug(msgid, "商品信息解析16");
#region 淘礼金
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)
);
}
-
-
#endregion
#region 正常订单
else
{
+ debug(msgid, "商品信息解析17");
//有券的情况
if (coupon_price != 0)
{
@@ -1266,6 +1283,8 @@ namespace TBRebate.Uses
}
else//没有券的情况
{
+
+ debug(msgid, "商品信息解析18");
var mess = string.Empty;
if (e.ChatType == ChatType.微信 || e.ChatType == ChatType.企业微信 || (e.ChatType == ChatType.QQ && string.IsNullOrWhiteSpace(Class1.Config.QQSearchSuccessWithoutCouponTip)))
mess = Class1.Config.SearchSuccessWithoutCouponTip;
@@ -1295,6 +1314,7 @@ namespace TBRebate.Uses
}
}
#endregion
+ debug(msgid, "商品信息解析19");
#region 记录用户信息,宝贝信息,平台信息,查询时间等
db.Insertable(new fl_query_hist()
{
@@ -1311,7 +1331,7 @@ namespace TBRebate.Uses
compute_configdic = compute == null ? string.Empty : JsonConvert.SerializeObject(compute)
}).ExecuteCommand();
db.UpdateRecord(memberTmp.id);
-
+ debug(msgid, "商品信息解析20");
var shared = new Dictionary();
shared["msg_type"] = "查询宝贝";
shared["cps_type"] = CpsType.阿里妈妈;
@@ -1325,10 +1345,12 @@ namespace TBRebate.Uses
var sharedEvent = new SharedEvents(shared);
EventClient.OnEvent(sender, sharedEvent);
#endregion
+ debug(msgid, "商品信息解析21");
return true;
}
else
{
+ debug(msgid, "商品信息解析22");
if (Class1.Config.ShopAdSwitch == SwitchType.开启)
{
#region 商品没有返利,店铺参加了推广,下单后有返利
@@ -1497,6 +1519,7 @@ namespace TBRebate.Uses
}
#endregion
}
+ debug(msgid, "商品信息解析23");
#region 强返
//判断是否为天猫商品
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.开启)
{
keyword = title;
@@ -1643,7 +1666,7 @@ namespace TBRebate.Uses
}
else
e.SendMessage(Class1.Config.SearchNoCommissionTip.Replace("[关键词]", keyword).Replace("[商品标题]", title));//未搜索到提示语
-
+ debug(msgid, "商品信息解析25");
db.UpdateRecord(memberTmp.id);
var shared = new Dictionary();
@@ -1665,6 +1688,7 @@ namespace TBRebate.Uses
}
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 (string.IsNullOrWhiteSpace(keyword) && !string.IsNullOrWhiteSpace(title) && Class1.Config.SearchTitleSwitch_NoCommission == SwitchType.开启)
@@ -1713,10 +1737,10 @@ namespace TBRebate.Uses
}
}
#endregion
-
}
catch (Exception ex)
{
+ debug(msgid, "商品信息解析27");
if (ex.Message.StartsWith("@"))
plugin.OnLog($"E :({e.RobotInfo.nick}【{e.RobotInfo.name}】){ex.Message.Replace("@", "")}");
else
diff --git a/类库/Api.Framework/Api.Framework.csproj b/类库/Api.Framework/Api.Framework.csproj
index 22bc937..aa8bc89 100644
--- a/类库/Api.Framework/Api.Framework.csproj
+++ b/类库/Api.Framework/Api.Framework.csproj
@@ -178,8 +178,7 @@
False
- ..\..\Debug\Robot.Framework.dll
- False
+ ..\..\DLL\Robot.Framework.dll
False
diff --git a/类库/Api.Framework/Cps/AlimamaApi.cs b/类库/Api.Framework/Cps/AlimamaApi.cs
index 5fd3f93..5e12d7c 100644
--- a/类库/Api.Framework/Cps/AlimamaApi.cs
+++ b/类库/Api.Framework/Cps/AlimamaApi.cs
@@ -1793,7 +1793,6 @@ t = {target}");
compose = ComposeTbClick(itemId, img, tkl, url, isShortUrl, DwzType, target, isCircleZjy);
else
compose = ComposeTbClick(itemId, img, tkl, url, pid, isTuiGuang, target, isCircleZjy);
-
return GetComposeUrl(compose, isShortUrl, DwzType, target);
}
diff --git a/类库/Api.Framework/Cps/DouyinApiV2.cs b/类库/Api.Framework/Cps/DouyinApiV2.cs
index 90f0f95..c04e6e2 100644
--- a/类库/Api.Framework/Cps/DouyinApiV2.cs
+++ b/类库/Api.Framework/Cps/DouyinApiV2.cs
@@ -985,6 +985,84 @@ html = {html}");
return html;
}
+ ///
+ /// 检查抖音App授权时间
+ ///
+ ///
+ ///
+ ///
+ ///
+ 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() == 0)
+ {
+ var jArr = jObj["data"].ToArray();
+ foreach (var tmp in jArr)
+ {
+ if (tmp["app_id"]?.Value() == "7066380295942964749")
+ {
+ if (DateTime.TryParse(tmp["expire_time"]?.Value(), out var expireTime))
+ {
+ if (expireTime > DateTime.Now)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ }
+ return false;
+ }
+
+
public List DownOrder(DateTime start_time, DateTime end_time, int _page_index, DouyinQueryOrderType type)
{
int num = 0;
@@ -1035,7 +1113,7 @@ html = {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 reg = Regex.Match(msTokenStr, @"(msToken=.+?;)", RegexOptions.IgnoreCase);
diff --git a/类库/Api.Framework/Cps/douyin_form_login.Designer.cs b/类库/Api.Framework/Cps/douyin_form_login.Designer.cs
index 65394a3..987273a 100644
--- a/类库/Api.Framework/Cps/douyin_form_login.Designer.cs
+++ b/类库/Api.Framework/Cps/douyin_form_login.Designer.cs
@@ -130,6 +130,7 @@
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "第二步 填写授权结果";
+ this.groupBox2.Visible = false;
//
// simpleButton3
//
diff --git a/类库/Api.Framework/Cps/douyin_form_login.cs b/类库/Api.Framework/Cps/douyin_form_login.cs
index e1fb7ff..3cdedd1 100644
--- a/类库/Api.Framework/Cps/douyin_form_login.cs
+++ b/类库/Api.Framework/Cps/douyin_form_login.cs
@@ -122,6 +122,11 @@ namespace Api.Framework.Cps
{
webControl1.WebView.EvalScript(
"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($"{ApiClient.Setting.SystemConfig.cps_server_api}api/douyin.asmx"))//授权成功页面
@@ -160,28 +165,72 @@ namespace Api.Framework.Cps
LogHelper.GetSingleObj().Info("抖音登录获取到用户数据", json);
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;
- do
- {
- num++;
+ Thread.Sleep(2000);
+ webControl1.WebView.EvalScript("document.getElementsByClassName('auxo-menu-item auxo-menu-item-only-child headerNav-item basicSettings_daren')[0].click()", false);
+ Thread.Sleep(2000);
+ webControl1.WebView.EvalScript("document.getElementsByClassName('auxo-menu-item auxo-menu-item-only-child')[12].click()", false);
- EventClient.OnEvent("抖音登录", $"请求跳转授权页面,第{num}次");
- webControl1.WebView.LoadUrl(AuthorizeLoginUrl);
+ Thread.Sleep(2000);
+ 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);
- } while (num < 13 && !IsJumpAuthorizationUrl);
+ webControl1.WebView.EvalScript("document.getElementsByClassName('auxo-btn auxo-btn-primary')[0].click()", false);
+ 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)
{ }
}
+ ///
+ /// 加载授权地址
+ ///
+ 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 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);
if (CheckLoginCk(json, this.textBox1.Text, UserAgent))
{
+ IsAuthorization = true;
+ EventClient.OnEvent("抖音登录", "抖音授权登录成功!");
+
+ this.DialogResult = DialogResult.OK;
+
+ return;
this.groupBox2.Enabled = true;
BaseForm.ShowSuccessAutoClose("验证成功,您可以继续授权Api");
}
@@ -378,6 +433,14 @@ namespace Api.Framework.Cps
}
}
}
+ else
+ {
+ IsAuthorization = true;
+ EventClient.OnEvent("抖音登录", "抖音授权登录成功!");
+ flag = true;
+
+ this.DialogResult = DialogResult.OK;
+ }
if (!flag)
throw new Exception("抖音授权登录失败!");
diff --git a/类库/Api.Framework/Tools/Util.cs b/类库/Api.Framework/Tools/Util.cs
index 4498405..fe73d86 100644
--- a/类库/Api.Framework/Tools/Util.cs
+++ b/类库/Api.Framework/Tools/Util.cs
@@ -537,7 +537,7 @@ xml:字符长度:{(string.IsNullOrWhiteSpace(xml) ? "0" : $"{xml.Length}")}");
}
#endregion
- #region MyRegion
+ #region 二维码解析
[DllImport("PsyQrDcd.dll"), HandleProcessCorruptedStateExceptions]
private static extern int DecodePictureFile(string filename);
diff --git a/类库/Chat.Framework/Chat.Framework.csproj b/类库/Chat.Framework/Chat.Framework.csproj
index 4a21dff..e457899 100644
--- a/类库/Chat.Framework/Chat.Framework.csproj
+++ b/类库/Chat.Framework/Chat.Framework.csproj
@@ -202,6 +202,12 @@
QQLoginForm.cs
+
+ Form
+
+
+ SetQQForm.cs
+
@@ -294,6 +300,9 @@
QQLoginForm.cs
Designer
+
+ SetQQForm.cs
+
BrowserForm.cs
Designer
diff --git a/类库/Chat.Framework/QQSdk/QPlus/QQClientImpl_QQPlus.cs b/类库/Chat.Framework/QQSdk/QPlus/QQClientImpl_QQPlus.cs
index 3b61866..4f1fb8f 100644
--- a/类库/Chat.Framework/QQSdk/QPlus/QQClientImpl_QQPlus.cs
+++ b/类库/Chat.Framework/QQSdk/QPlus/QQClientImpl_QQPlus.cs
@@ -1,7 +1,6 @@
using Chat.Framework.QQSdk.Events;
using Chat.Framework.Utils;
using Robot.Framework;
-using Robot.Framework.Entities;
using Robot.Framework.SDK;
using System;
using System.Linq;
@@ -9,6 +8,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
+using LoginStatus = Robot.Framework.Entities.LoginStatus;
namespace Chat.Framework.QQSdk.QPlus
{
@@ -33,9 +33,9 @@ namespace Chat.Framework.QQSdk.QPlus
internal QQClientImpl_QQPlus(QQClient QQClient)
{
this.QQClient = QQClient;
- this.QQ = QQClient.User.QQ;
- this.Nickname = QQClient.User.NickName;
- this.IsLogin = QQClient.User.LoginStatus == LoginStatus.Login;
+ this.QQ = QQClient.User?.QQ ?? 0;
+ this.Nickname = QQClient.User?.NickName ??string.Empty;
+ this.IsLogin = (QQClient.User?.LoginStatus ?? LoginStatus.Logout) == LoginStatus.Login;
//this.Password = Robot.Framework.Utils.Util.ToHex(QQClient.User.md5_1, "", "{0}");
//this.Password = QQClient.ToString();
this.IsEQQ = QQClient.QQProtocol != "PCQQ";
diff --git a/类库/Chat.Framework/QQSdk/QPlus/QQLoginForm.cs b/类库/Chat.Framework/QQSdk/QPlus/QQLoginForm.cs
index 49f6608..db695e1 100644
--- a/类库/Chat.Framework/QQSdk/QPlus/QQLoginForm.cs
+++ b/类库/Chat.Framework/QQSdk/QPlus/QQLoginForm.cs
@@ -30,6 +30,7 @@ namespace Chat.Framework.QQSdk.QPlus
{
InitializeComponent();
qClient = new QQClient();
+ qClient.User = new QQUser(0,new byte[0]);
qPlusClient = new QQClientImpl_QQPlus(qClient);
qClient.LoginStatusChanged += client_LoginStatusChanged;
}
@@ -75,6 +76,7 @@ namespace Chat.Framework.QQSdk.QPlus
}
qPlusClient.Password = pass;
qClient.QQProtocol = radioButton1.Checked ? "PCQQ" : "企业QQ";
+ qClient.LoadRobotConfig(qq);
qClient.Login();
}
else
@@ -188,9 +190,20 @@ namespace Chat.Framework.QQSdk.QPlus
}
}
+ private uint QQ = 0;
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.LoadRobotConfig(QQ);
qClient.Login();
}