This commit is contained in:
parent
c1feb5241a
commit
718e22f032
Binary file not shown.
|
@ -604,14 +604,13 @@ namespace FLSystem.Forms
|
|||
|
||||
ArrayList goods_details = null;
|
||||
|
||||
var isBind = false;
|
||||
|
||||
var result = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { pid = twg.adzone_pid });
|
||||
if (result.ContainsKey("authority_query_response"))
|
||||
var isBind = api.IsAuthority(twg.adzone_pid);
|
||||
if (!isBind)
|
||||
{
|
||||
var authority_query_response = result["authority_query_response"] as Dictionary<string, object>;
|
||||
if (authority_query_response != null && authority_query_response.Count != 0)
|
||||
isBind = int.Parse(authority_query_response["bind"].ToString()) == 1;//1-已绑定;0-未绑定
|
||||
//授权地址
|
||||
var authUrl = api.AuthorityUrl(twg.adzone_pid);
|
||||
Clipboard.SetDataObject(authUrl);
|
||||
throw new Exception("推广位未授权,授权地址已经复制到粘贴板,点击链接授权一次后才能使用推广位");
|
||||
}
|
||||
|
||||
goods_details = PDDHelper.FindSendGuideGoodsInfo(api, twg.adzone_pid, goods_id, isBind);
|
||||
|
|
|
@ -12,7 +12,6 @@ using Api.Framework.Model;
|
|||
using Api.Framework.Enums;
|
||||
using CsharpHttpHelper;
|
||||
using System.Threading;
|
||||
using Api.Framework.Cps;
|
||||
using Api.Framework.Events;
|
||||
using Api.Framework.Timers;
|
||||
using Chat.Framework;
|
||||
|
@ -729,20 +728,17 @@ namespace PDDRebate
|
|||
|
||||
try
|
||||
{
|
||||
//var result = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { custom_parameters = _temp_param, pid = pid });
|
||||
var result = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { pid = pid });
|
||||
if (result.ContainsKey("authority_query_response"))
|
||||
{
|
||||
var authority_query_response = result["authority_query_response"] as Dictionary<string, object>;
|
||||
if (authority_query_response != null && authority_query_response.Count != 0)
|
||||
isBind = int.Parse(authority_query_response["bind"].ToString()) == 1;//1-已绑定;0-未绑定
|
||||
}
|
||||
isBind = api.IsAuthority(pid);
|
||||
|
||||
//if (!isBind)
|
||||
//{
|
||||
// var data = new { p_id_list = "[\"" + pid + "\"]", channel_type = 10 };
|
||||
// var create_user_authority = api.SendPinduoduo("pdd.ddk.oauth.rp.prom.url.generate", data);
|
||||
//}
|
||||
//未绑定
|
||||
if (!isBind)
|
||||
{
|
||||
//授权地址
|
||||
var authUrl = api.AuthorityUrl(pid);
|
||||
|
||||
e.SendMessage(Config.NoRecordTip.Replace("[授权地址]", authUrl));
|
||||
return;
|
||||
}
|
||||
|
||||
goods_details = PDDHelper.FindSendGuideGoodsInfo(api, pid, goods_id, isBind);
|
||||
}
|
||||
|
@ -752,7 +748,7 @@ namespace PDDRebate
|
|||
}
|
||||
|
||||
//没有查到返利提示
|
||||
if (goods_details == null || goods_details.Count == 0)
|
||||
if (goods_details == null || goods_details.Count != 1)
|
||||
throw new Exception("商品不存在");
|
||||
|
||||
foreach (var item in goods_details)
|
||||
|
|
|
@ -34,6 +34,7 @@ namespace PDDRebate
|
|||
#endregion
|
||||
|
||||
#region 商品查询
|
||||
|
||||
/// <summary>
|
||||
/// 宝贝二维码识别功能
|
||||
/// </summary>
|
||||
|
@ -52,11 +53,29 @@ namespace PDDRebate
|
|||
]
|
||||
public string SearchingTip { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 无佣金时提示
|
||||
/// </summary>
|
||||
[
|
||||
Category("2)、商品查询"), DisplayName("03.无佣金时提示"), DefaultValue(@"一一一一优 惠 结 束一一一一
|
||||
Category("2)、商品查询"), DisplayName("03.未绑定提示"), DefaultValue(@"查询失败!您未绑定拼多多
|
||||
------
|
||||
[授权地址]
|
||||
------
|
||||
①点击上方链接
|
||||
②确认授权
|
||||
③重新查询商品"),
|
||||
Description(@"支持变量:[机器人账号]、[机器人昵称]、[账号]、[昵称]、[授权地址]"),
|
||||
Editor(typeof(PropertyGridRichText), typeof(System.Drawing.Design.UITypeEditor))
|
||||
]
|
||||
public string NoRecordTip { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 无佣金时提示
|
||||
/// </summary>
|
||||
[
|
||||
Category("2)、商品查询"), DisplayName("04.无佣金时提示"), DefaultValue(@"一一一一优 惠 结 束一一一一
|
||||
活动已结束,暂无其他优惠!
|
||||
建议您换个宝贝继续查询哦!"),
|
||||
Description(@"支持变量:[机器人账号]、[机器人昵称]、[账号]、[昵称]"),
|
||||
|
@ -68,7 +87,7 @@ namespace PDDRebate
|
|||
/// 无优惠券时提示
|
||||
/// </summary>
|
||||
[
|
||||
Category("2)、商品查询"), DisplayName("04.无优惠券时提示"), DefaultValue(@"一一一一返 利 消 息一一一一
|
||||
Category("2)、商品查询"), DisplayName("05.无优惠券时提示"), DefaultValue(@"一一一一返 利 消 息一一一一
|
||||
[商品标题]
|
||||
【宝贝原价】[商品拼团价] [积分名称]
|
||||
【返利金额】[拼团返利] [积分名称]
|
||||
|
@ -86,7 +105,7 @@ namespace PDDRebate
|
|||
/// 有优惠券时提示
|
||||
/// </summary>
|
||||
[
|
||||
Category("2)、商品查询"), DisplayName("05.有优惠券时提示"), DefaultValue(@"一一一一返 利 消 息一一一一
|
||||
Category("2)、商品查询"), DisplayName("06.有优惠券时提示"), DefaultValue(@"一一一一返 利 消 息一一一一
|
||||
[商品标题]
|
||||
【宝贝原价】[商品拼团价] [积分名称]
|
||||
【立即减免】[优惠券金额] [积分名称]
|
||||
|
@ -107,7 +126,7 @@ namespace PDDRebate
|
|||
/// 无优惠券时提示(QQ)
|
||||
/// </summary>
|
||||
[
|
||||
Category("2)、商品查询"), DisplayName("06.无优惠券时提示(QQ)"), DefaultValue(@""),
|
||||
Category("2)、商品查询"), DisplayName("07.无优惠券时提示(QQ)"), DefaultValue(@""),
|
||||
Description(@"当该提示语不为空,将回复QQ平台;
|
||||
当该提示语为空,将使用""无优惠券时提示""的提示语;
|
||||
支持变量:[机器人账号]、[机器人昵称]、[账号]、[昵称]、[商品标题]、[商品描述]、[商品主图]、[已售数量]、[店铺名称]、[商品单买价]、[单买返利]、[单买地址]、[单买地址不跳转]、[商品拼团价]、[拼团返利]、[拼团地址]、[拼团地址不跳转]、[单买共节省]、[拼团共节省]、[积分名称]、[商品图片]、[图片地址]"),
|
||||
|
@ -119,7 +138,7 @@ namespace PDDRebate
|
|||
/// 有优惠券提示语(QQ)
|
||||
/// </summary>
|
||||
[
|
||||
Category("2)、商品查询"), DisplayName("07.有优惠券时提示(QQ)"), DefaultValue(@""),
|
||||
Category("2)、商品查询"), DisplayName("08.有优惠券时提示(QQ)"), DefaultValue(@""),
|
||||
Description(@"当该提示语不为空,将回复QQ平台;
|
||||
当该提示语为空,将使用""有优惠券时提示""的提示语;
|
||||
支持变量:[商品标题]、[商品描述]、[商品主图]、[已售数量]、[店铺名称]、[优惠券门槛金额]、[优惠券金额]、[优惠券数量]、[优惠券生效日]、[优惠券失效日]、[商品单买价]、[单买返利]、[券后单买价]、[单买地址]、[单买地址不跳转]、[商品拼团价]、[拼团返利]、[券后拼团价]、[拼团地址]、[拼团地址不跳转]、[单买共节省]、[拼团共节省]、[积分名称]、[商品图片]、[图片地址]"),
|
||||
|
@ -730,6 +749,15 @@ Ps:如是您的订单,请联系我们处理!"),
|
|||
this.SearchErrorTip = @"一一一一优 惠 结 束一一一一
|
||||
活动已结束,暂无其他优惠!
|
||||
建议您换个宝贝继续查询哦!";
|
||||
|
||||
this.NoRecordTip = @"查询失败!您未绑定拼多多
|
||||
------
|
||||
[授权地址]
|
||||
------
|
||||
①点击上方链接
|
||||
②确认授权
|
||||
③重新查询商品";
|
||||
|
||||
this.OrderRepetBindTip = @"一一一一重 复 绑 定一一一一
|
||||
[商品标题]
|
||||
【订单编号】[订单号]
|
||||
|
|
|
@ -391,13 +391,12 @@ namespace ProductClient
|
|||
|
||||
ArrayList goods_details = null;
|
||||
|
||||
var isBind = false;
|
||||
var result = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { pid = adzone_pid });
|
||||
if (result.ContainsKey("authority_query_response"))
|
||||
var isBind = api.IsAuthority(adzone_pid);
|
||||
if (!isBind)
|
||||
{
|
||||
var authority_query_response = result["authority_query_response"] as Dictionary<string, object>;
|
||||
if (authority_query_response != null && authority_query_response.Count != 0)
|
||||
isBind = int.Parse(authority_query_response["bind"].ToString()) == 1;//1-已绑定;0-未绑定
|
||||
//授权地址
|
||||
var authUrl = api.AuthorityUrl(adzone_pid);
|
||||
throw new Exception($"推广位未授权, 无法使用, 复制地址到机器人点击授权一次后才能使用推广位, 授权地址 => { authUrl}");
|
||||
}
|
||||
|
||||
goods_details = PDDHelper.FindSendGuideGoodsInfo(api, adzone_pid, goods_id, isBind);
|
||||
|
|
|
@ -102,7 +102,6 @@ namespace PDDCircleFriends
|
|||
{
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
var session = ApiClient.GetSession();
|
||||
try
|
||||
{
|
||||
var member = CpsClient.Members.FirstOrDefault(f => f.cpstype == CpsType.多多进宝);//随机获取一个拼多多的cps
|
||||
|
|
|
@ -124,14 +124,10 @@ namespace PDDCircleFriends
|
|||
strb.AppendLine(Class1.Config.Content_Circle);
|
||||
int count = 0;
|
||||
|
||||
|
||||
var isBind = false;
|
||||
var resultQuery = api.SendPinduoduo("pdd.ddk.oauth.member.authority.query", new { pid = adzone.adzone_pid });
|
||||
if (resultQuery.ContainsKey("authority_query_response"))
|
||||
var isBind = api.IsAuthority(adzone.adzone_pid);
|
||||
if (!isBind)
|
||||
{
|
||||
var authority_query_response = resultQuery["authority_query_response"] as Dictionary<string, object>;
|
||||
if (authority_query_response != null && authority_query_response.Count != 0)
|
||||
isBind = int.Parse(authority_query_response["bind"].ToString()) == 1;//1-已绑定;0-未绑定
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < goods_infos.Count; i++)
|
||||
|
|
|
@ -3,9 +3,12 @@ using CsharpHttpHelper;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Api.Framework.Cps
|
||||
{
|
||||
|
@ -168,10 +171,112 @@ namespace Api.Framework.Cps
|
|||
//Member.online = false;
|
||||
//ApiClient.GetSession().SaveOrUpdate(Member);
|
||||
Member.is_valid = false;
|
||||
if (CpsClient.GuideMembers.FirstOrDefault(f => f.username == Member.username) == null)
|
||||
{
|
||||
ApiClient.GetSession().SaveOrUpdate(Member);
|
||||
}
|
||||
ApiClient.GetSession().SaveOrUpdate(Member);
|
||||
EventClient.OnEvent(this, $@"拼多多异常:{this.Member.username}({this.Member.usernick}),{ex.Message} - {ex.StackTrace}
|
||||
,注:请重新登录拼多多,{api}");
|
||||
throw new Exception($"{this.Member.username}({this.Member.usernick}),{ex.Message},注:请重新登录拼多多");
|
||||
}
|
||||
}
|
||||
else if (html.Contains("超时"))
|
||||
{
|
||||
goto Next;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送拼多多报文
|
||||
/// </summary>
|
||||
/// <param name="api">请求的api</param>
|
||||
/// <param name="data">参数</param>
|
||||
/// <returns></returns>
|
||||
public JToken SendPinduoduoJToken(string api, object data)
|
||||
{
|
||||
int number = 0;
|
||||
string html = string.Empty;
|
||||
Next:
|
||||
try
|
||||
{
|
||||
number++;
|
||||
|
||||
//throw new Exception("{\"error_msg\":\"公共参数错误: access_token\",\"sub_msg\":\"公共参数错误: access_token\",\"sub_code\":\"10019\",\"error_code\":10019,\"request_id\":\"16249438515389810\"}");
|
||||
|
||||
Dictionary<string, string> param = new Dictionary<string, string>();
|
||||
var type = data.GetType().GetProperties();
|
||||
foreach (var item in type)
|
||||
{
|
||||
var _value = item.GetValue(data).ToString();
|
||||
param[item.Name] = _value;
|
||||
}
|
||||
//if (api != "pdd.ddk.oauth.order.list.increment.get" && api != "pdd.ddk.oauth.goods.search")
|
||||
if (api.Contains("oauth"))
|
||||
param["access_token"] = Token.access_token;
|
||||
param["type"] = api;
|
||||
param["client_id"] = Token.appid;
|
||||
//param["timestamp"] = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000).ToString();//HttpExtend.GetTimeStamp(DateTime.Now).ToString();
|
||||
param["timestamp"] = HttpExtend.GetTimeStamp();
|
||||
param["data_type"] = "JSON";
|
||||
var sign = SignTopRequest(param, Token.appkey);
|
||||
param["sign"] = sign;
|
||||
|
||||
HttpHelper http = new HttpHelper();
|
||||
HttpItem _item = new HttpItem()
|
||||
{
|
||||
URL = app_host,
|
||||
Method = "Post",//URL 可选项 默认为Get
|
||||
Timeout = 10000,//连接超时时间 可选项默认为100000
|
||||
ReadWriteTimeout = 10000,//写入Post数据超时时间 可选项默认为30000
|
||||
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
|
||||
Cookie = "",//字符串Cookie 可选项
|
||||
UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:18.0) Gecko/20100101 Firefox/18.0",//用户的浏览器类型,版本,操作系统 可选项有默认值
|
||||
Accept = "text/html, application/xhtml+xml, */*",// 可选项有默认值
|
||||
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
|
||||
Referer = "",//来源URL 可选项
|
||||
Postdata = HttpExtend.BuildQuery(param),//Post数据 可选项GET时不需要写
|
||||
};
|
||||
var result = http.GetHtml(_item);
|
||||
|
||||
//if (html.Contains("access_token已过期")) Member.online = false;
|
||||
//else if (api == "pdd.ddk.oauth.order.list.increment.get") Member.online = true;
|
||||
|
||||
if (result.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
html = result.Html;
|
||||
|
||||
JObject jObj = null;
|
||||
try
|
||||
{
|
||||
jObj = JObject.Parse(html);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (jObj?.First?.First != null)
|
||||
{
|
||||
var jData = jObj.First.First;
|
||||
if (jData["error_code"] != null)
|
||||
//throw new Exception(jObj.ToString());
|
||||
throw new Exception(jData["error_msg"] + " 参数:" + JsonConvert.SerializeObject(data));
|
||||
return jData;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (ex.Message.Contains("access_token") && ((ex.Message.Contains("10019") || ex.Message.Contains("20033") || ex.Message.Contains("20032"))))
|
||||
{
|
||||
Thread.Sleep(1000);
|
||||
if (this.Member != null && RefToken() && this.Member.is_valid && number < 3) goto Next;
|
||||
else
|
||||
{
|
||||
//Member.online = false;
|
||||
//ApiClient.GetSession().SaveOrUpdate(Member);
|
||||
Member.is_valid = false;
|
||||
ApiClient.GetSession().SaveOrUpdate(Member);
|
||||
EventClient.OnEvent(this, $@"拼多多异常:{this.Member.username}({this.Member.usernick}),{ex.Message} - {ex.StackTrace}
|
||||
,注:请重新登录拼多多,{api}");
|
||||
throw new Exception($"{this.Member.username}({this.Member.usernick}),{ex.Message},注:请重新登录拼多多");
|
||||
|
@ -213,5 +318,37 @@ namespace Api.Framework.Cps
|
|||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 生成授权地址
|
||||
/// </summary>
|
||||
/// <param name="pid"></param>
|
||||
/// <returns></returns>
|
||||
public string AuthorityUrl(string pid)
|
||||
{
|
||||
//授权的信息
|
||||
var result = SendPinduoduoJToken("pdd.ddk.oauth.rp.prom.url.generate", new { generate_short_url = true, p_id_list = "[\"" + pid + "\"]", channel_type = 10 });
|
||||
|
||||
var urlList = result["url_list"]?.ToArray();
|
||||
if (urlList == null || urlList.Length <= 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var mobileUrl = urlList[0]?["mobile_short_url"]?.ToString();
|
||||
|
||||
return mobileUrl;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 用户是否授权
|
||||
/// </summary>
|
||||
/// <param name="adzoneAdzonePid"></param>
|
||||
/// <returns></returns>
|
||||
public bool IsAuthority(string adzoneAdzonePid)
|
||||
{
|
||||
var jToken = SendPinduoduoJToken("pdd.ddk.oauth.member.authority.query", new { pid = adzoneAdzonePid, custom_parameters = "" });
|
||||
|
||||
return jToken["bind"]?.Value<int>() == 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,26 @@ namespace Api.Framework.Cps
|
|||
{
|
||||
var row = this.gridView1.GetRow(select[0]) as view_pinduoduo_form_select_tgw;
|
||||
var member = this.comboBoxEdit1.SelectedItem as fl_cps_member;
|
||||
|
||||
//检测pid是否授权过
|
||||
var api = CpsClient.CreatePinduoduoRequest(member);
|
||||
if (api == null)
|
||||
{
|
||||
ShowError("联盟异常");
|
||||
return;
|
||||
}
|
||||
|
||||
var isBind = api.IsAuthority(row.p_id);
|
||||
if (!isBind)
|
||||
{
|
||||
//授权地址
|
||||
var authUrl = api.AuthorityUrl(row.p_id);
|
||||
Clipboard.SetDataObject(authUrl);
|
||||
|
||||
ShowError("推广位未授权,授权地址已经复制到粘贴板,点击链接授权一次后才能使用推广位");
|
||||
return;
|
||||
}
|
||||
|
||||
Tuiguangwei = new Tuiguangwei()
|
||||
{
|
||||
Member = member,
|
||||
|
|
|
@ -26,15 +26,15 @@ namespace Api.Framework
|
|||
try
|
||||
{
|
||||
RefreshCps();
|
||||
GuideMembers = new List<fl_cps_member>();
|
||||
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "1929015", usernick = "w", cookies = "1929015_24223399" });//吴嘉华
|
||||
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "8701005", usernick = "zyy", cookies = "8701005_194371009" });//张谊玉
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15528847", usernick = "zl", cookies = "15528847_194372142" });//周雷
|
||||
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "8364424", usernick = "zcg", cookies = "8364424_194372426" });//钟成刚
|
||||
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15529092", usernick = "lcr", cookies = "15529092_194372782" });//廖春容
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15529109", usernick = "yc", cookies = "15529109_194373136" });//杨灿
|
||||
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15531182", usernick = "lxy", cookies = "15531182_194378363" });//李馨雨
|
||||
GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "32388767", usernick = "yc", cookies = "32388767_194373136" });//李洁
|
||||
//GuideMembers = new List<fl_cps_member>();
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "1929015", usernick = "w", cookies = "1929015_24223399" });//吴嘉华
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "8701005", usernick = "zyy", cookies = "8701005_194371009" });//张谊玉
|
||||
////GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15528847", usernick = "zl", cookies = "15528847_194372142" });//周雷
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "8364424", usernick = "zcg", cookies = "8364424_194372426" });//钟成刚
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15529092", usernick = "lcr", cookies = "15529092_194372782" });//廖春容
|
||||
////GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15529109", usernick = "yc", cookies = "15529109_194373136" });//杨灿
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "15531182", usernick = "lxy", cookies = "15531182_194378363" });//李馨雨
|
||||
//GuideMembers.Add(new fl_cps_member() { abnormal_tip = SwitchType.关闭, cpstype = CpsType.多多进宝, is_download = SwitchType.关闭, is_valid = true, logintime = DateTime.Now, online = true, username = "32388767", usernick = "yc", cookies = "32388767_194373136" });//李洁
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -48,10 +48,10 @@ namespace Api.Framework
|
|||
/// </summary>
|
||||
public static List<fl_cps_member> Members { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公共的Cps集合
|
||||
/// </summary>
|
||||
internal static List<fl_cps_member> GuideMembers { get; private set; }
|
||||
///// <summary>
|
||||
///// 公共的Cps集合
|
||||
///// </summary>
|
||||
//internal static List<fl_cps_member> GuideMembers { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// 刷新cps缓存
|
||||
|
|
|
@ -224,6 +224,19 @@ namespace Api.Framework.Timers
|
|||
|
||||
try
|
||||
{
|
||||
//if (ApiClient.Setting.SystemConfig.order_douyin_download_set_pids == SwitchType.关闭)
|
||||
//{
|
||||
// var _pids = ApiClient.Setting.SystemConfig.order_alimama_not_download_pid.Replace(",", ",").Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(f => f.Trim()).ToList();
|
||||
// if (_pids.Count != 0 && order.pid_info != null)
|
||||
// {
|
||||
// var isExist = _pids.FirstOrDefault(f => f == order.pid_info.pid) != null;//是否包含
|
||||
// if (ApiClient.Setting.SystemConfig.order_alimama_down_type == DownAdzoneType.不下载推广位 && isExist)
|
||||
// continue;
|
||||
// else if (ApiClient.Setting.SystemConfig.order_alimama_down_type == DownAdzoneType.只下载推广位 && !isExist)
|
||||
// continue;
|
||||
// }
|
||||
//}
|
||||
|
||||
//if (order.order_id == "4886104544279610848")
|
||||
//{
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using Api.Framework.Cps;
|
||||
using Api.Framework.Model;
|
||||
using CsharpHttpHelper;
|
||||
using CsharpHttpHelper.Enum;
|
||||
using Newtonsoft.Json;
|
||||
|
@ -8,7 +7,6 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -20,26 +18,26 @@ namespace Api.Framework.Tools
|
|||
/// </summary>
|
||||
public class PDDHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 随机对象
|
||||
/// </summary>
|
||||
private static Random random = new Random(Guid.NewGuid().GetHashCode());
|
||||
///// <summary>
|
||||
///// 随机对象
|
||||
///// </summary>
|
||||
//private static Random random = new Random(Guid.NewGuid().GetHashCode());
|
||||
|
||||
/// <summary>
|
||||
/// 获取随机公共拼多多查询商品信息账号
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static fl_cps_member RandomGuidePddMembers()
|
||||
{
|
||||
try
|
||||
{
|
||||
//return CpsClient.GuideMembers[0];
|
||||
return CpsClient.GuideMembers[random.Next(0, CpsClient.GuideMembers.Count)];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ }
|
||||
return CpsClient.GuideMembers.FirstOrDefault();
|
||||
}
|
||||
///// <summary>
|
||||
///// 获取随机公共拼多多查询商品信息账号
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public static fl_cps_member RandomGuidePddMembers()
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// //return CpsClient.GuideMembers[0];
|
||||
// return CpsClient.GuideMembers[random.Next(0, CpsClient.GuideMembers.Count)];
|
||||
// }
|
||||
// catch (Exception ex)
|
||||
// { }
|
||||
// return CpsClient.GuideMembers.FirstOrDefault();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 多多进宝app中获取高佣商品的招商id
|
||||
|
@ -57,8 +55,7 @@ namespace Api.Framework.Tools
|
|||
var GoodsCache = GoodsCacheDic[goodsid];
|
||||
if (GoodsCache.GetTime.AddHours(1) > DateTime.Now)
|
||||
return GoodsCache.GoodsSign;
|
||||
else
|
||||
GoodsCacheDic.Remove(goodsid);
|
||||
GoodsCacheDic.Remove(goodsid);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
@ -190,13 +187,14 @@ namespace Api.Framework.Tools
|
|||
{ }
|
||||
if (!isBind)//true-已绑定;false-未绑定
|
||||
{ //公用的账号
|
||||
var guideCps = RandomGuidePddMembers();
|
||||
if (guideCps == null) throw new Exception("公共账号异常");
|
||||
var guideApi = CpsClient.CreatePinduoduoRequest(guideCps);
|
||||
if (guideApi == null) throw new Exception("创建公共请求对象异常");
|
||||
var fgInfo = FindGoodsInfo(guideApi, goodsSign, guideCps.cookies);
|
||||
if (fgInfo != null)
|
||||
return fgInfo;
|
||||
//var guideCps = RandomGuidePddMembers();
|
||||
//if (guideCps == null) throw new Exception("公共账号异常");
|
||||
//var guideApi = CpsClient.CreatePinduoduoRequest(guideCps);
|
||||
//if (guideApi == null) throw new Exception("创建公共请求对象异常");
|
||||
//var fgInfo = FindGoodsInfo(guideApi, goodsSign, guideCps.cookies);
|
||||
//if (fgInfo != null)
|
||||
// return fgInfo;
|
||||
return null;
|
||||
}
|
||||
var goodsInfo = FindGoodsInfo(api, goodsSign, pid);
|
||||
return goodsInfo;
|
||||
|
@ -213,12 +211,12 @@ namespace Api.Framework.Tools
|
|||
//if (!isBind)//true-已绑定;false-未绑定
|
||||
if (CacheErrCpsDic.ContainsKey(cpsUsername) || !isBind)//true-已绑定;false-未绑定
|
||||
{ //公用的账号
|
||||
var guideCps = RandomGuidePddMembers();
|
||||
if (guideCps == null) throw new Exception("公共账号异常");
|
||||
var guideApi = CpsClient.CreatePinduoduoRequest(guideCps);
|
||||
if (guideApi == null) throw new Exception("创建公共请求对象异常");
|
||||
apiTmp = guideApi;
|
||||
pidTmp = guideCps.cookies;
|
||||
//var guideCps = RandomGuidePddMembers();
|
||||
//if (guideCps == null) throw new Exception("公共账号异常");
|
||||
//var guideApi = CpsClient.CreatePinduoduoRequest(guideCps);
|
||||
//if (guideApi == null) throw new Exception("创建公共请求对象异常");
|
||||
//apiTmp = guideApi;
|
||||
//pidTmp = guideCps.cookies;
|
||||
}
|
||||
else
|
||||
apiTmp = api;
|
||||
|
@ -246,6 +244,8 @@ namespace Api.Framework.Tools
|
|||
if (tmp != null && tmp.Count == 2)
|
||||
return FindGoodsInfo(api, tmp["goods_sign"].ToString(), pid);
|
||||
}
|
||||
|
||||
|
||||
return goods_list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -266,25 +266,25 @@ namespace Api.Framework.Tools
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取商品高佣信息
|
||||
/// </summary>
|
||||
/// <param name="api">PinduoduoApi对象</param>
|
||||
/// <param name="data">参数</param>
|
||||
/// <returns></returns>
|
||||
public static ArrayList FindSendGuideGoodsInfo(PinduoduoApi api, object data)
|
||||
{
|
||||
//公用的账号
|
||||
var guideCps = RandomGuidePddMembers();
|
||||
if (guideCps == null) throw new Exception("公共账号异常");
|
||||
var guideApi = CpsClient.CreatePinduoduoRequest(guideCps);
|
||||
if (guideApi == null) throw new Exception("创建公共请求对象异常");
|
||||
var obj_ = guideApi.SendPinduoduo("pdd.ddk.oauth.goods.search", data);
|
||||
if (obj_ == null) throw new Exception("创建拼多多API请求失败2");
|
||||
//解析商品,获取商品的信息
|
||||
var goods_detail_response = obj_["goods_search_response"] as Dictionary<string, object>;
|
||||
return goods_detail_response["goods_list"] as ArrayList;
|
||||
}
|
||||
///// <summary>
|
||||
///// 获取商品高佣信息
|
||||
///// </summary>
|
||||
///// <param name="api">PinduoduoApi对象</param>
|
||||
///// <param name="data">参数</param>
|
||||
///// <returns></returns>
|
||||
//public static ArrayList FindSendGuideGoodsInfo(PinduoduoApi api, object data)
|
||||
//{
|
||||
// //公用的账号
|
||||
// var guideCps = RandomGuidePddMembers();
|
||||
// if (guideCps == null) throw new Exception("公共账号异常");
|
||||
// var guideApi = CpsClient.CreatePinduoduoRequest(guideCps);
|
||||
// if (guideApi == null) throw new Exception("创建公共请求对象异常");
|
||||
// var obj_ = guideApi.SendPinduoduo("pdd.ddk.oauth.goods.search", data);
|
||||
// if (obj_ == null) throw new Exception("创建拼多多API请求失败2");
|
||||
// //解析商品,获取商品的信息
|
||||
// var goods_detail_response = obj_["goods_search_response"] as Dictionary<string, object>;
|
||||
// return goods_detail_response["goods_list"] as ArrayList;
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 查询商品信息(自己的账号,以保佣金比例的正确性)
|
||||
|
@ -320,6 +320,30 @@ namespace Api.Framework.Tools
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询商品信息(自己的账号,以保佣金比例的正确性)
|
||||
/// </summary>
|
||||
/// <param name="api">PinduoduoApi对象</param>
|
||||
/// <param name="goods_sign">商品sign</param>
|
||||
/// <param name="pid">推广位pid</param>
|
||||
/// <returns></returns>
|
||||
public static ArrayList FindSendGuideGoodsInfo(PinduoduoApi api, object data)
|
||||
{
|
||||
try
|
||||
{
|
||||
var obj_ = api.SendPinduoduo("pdd.ddk.oauth.goods.search", data);
|
||||
if (obj_ == null) throw new Exception("创建拼多多API请求失败2");
|
||||
//解析商品,获取商品的信息
|
||||
var goods_detail_response = obj_["goods_search_response"] as Dictionary<string, object>;
|
||||
return goods_detail_response["goods_list"] as ArrayList;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{ }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取拼多多链接中的商品ID
|
||||
/// </summary>
|
||||
|
@ -348,10 +372,13 @@ namespace Api.Framework.Tools
|
|||
}
|
||||
if (flag)
|
||||
{
|
||||
var reg = Regex.Match(url, @"goods_id=(?<good_id>\d{4,})");
|
||||
var reg = Regex.Match(url, @"goods_sign=(?<goods_sign>[^&]{30,70})", RegexOptions.IgnoreCase);//goods_sign=E9f2ompO5KFHjG7BxODcTu-k-n-0MFtO_JeyAMXRb5&
|
||||
if (reg.Success)
|
||||
return reg.Groups["goods_sign"].ToString();
|
||||
reg = Regex.Match(url, @"goods_id=(?<good_id>\d{4,})", RegexOptions.IgnoreCase);
|
||||
if (reg.Success)
|
||||
return reg.Groups["good_id"].ToString();
|
||||
reg = Regex.Match(HttpHelper.URLDecode(url), @"goods_id=(?<good_id>\d{4,})");
|
||||
reg = Regex.Match(HttpHelper.URLDecode(url), @"goods_id=(?<good_id>\d{4,})", RegexOptions.IgnoreCase);
|
||||
if (reg.Success)
|
||||
return reg.Groups["good_id"].ToString();
|
||||
reg = Regex.Match(HttpHelper.URLDecode(url), @"pinduoduo(?:.*)?goodsId=(?<good_id>\d{4,})", RegexOptions.IgnoreCase);
|
||||
|
|
|
@ -1286,14 +1286,18 @@ namespace Api.Framework.Tools
|
|||
|
||||
if (pids != null)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
tklTmps.Add(mess);
|
||||
|
||||
Exception e = null;
|
||||
|
||||
//for (int i = 0; i < 3; i++)
|
||||
foreach (var item in tklTmps)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = api.AnalysisTkPassword(mess, pids[3], pids[2]);
|
||||
var result = api.AnalysisTkPassword(item, pids[3], pids[2]);
|
||||
if (result != null)
|
||||
{
|
||||
|
||||
if (string.IsNullOrWhiteSpace(result.num_iid) == false)
|
||||
{
|
||||
activityId = result.activityId;
|
||||
|
@ -1327,10 +1331,14 @@ namespace Api.Framework.Tools
|
|||
{
|
||||
//945122237(潜意识)请求阿里妈妈接口:{"error_response":{"code":15,"msg":"Remote service error","sub_code":"isv.parse-result-invalid","sub_msg":"淘口令解析结果无效","request_id":"z24mo2uo0obo"}} - 在 Api.Framework.Cps.AlimamaApi.SendTaobaoServer(String _api, Object _data, String _appkey, String _appsecret) 位置 C:\xxxxxxxxxxxxxxxxx
|
||||
LogHelper.GetSingleObj().Debug("tkl解析", mess + "; 异常:" + ex.Message);
|
||||
if (i >= 1)
|
||||
throw ex;
|
||||
e = ex;
|
||||
}
|
||||
}
|
||||
|
||||
if (e != null)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
|
Loading…
Reference in New Issue