Commit 21571f6a authored by wuliangshun's avatar wuliangshun

-

parent 35fce98e
......@@ -14,7 +14,7 @@ namespace iqiyiWin.Api
public static string WWW_IQIYI = "https://www.iqiyi.com";
public static string PCELL_DOMAIN = "https://pcell.iqiyi.com/";
public static string PCELL_DOMAIN = "https://pcell.iqiyi.com";
}
}
......@@ -16,6 +16,7 @@ namespace iqiyiWin.Api
{
public class User
{
private static Random NonceRandom = new Random();
/// <summary>
/// 查询观影豆
/// </summary>
......@@ -33,16 +34,7 @@ namespace iqiyiWin.Api
headers.Add("dvsrc", IqiyiVersion.Dvsrc);
headers.Add("dfp", IqiyiVersion.Dfp());
headers.Add("ts", DateUtils.GetTimeStampOfMilliseconds().ToString());
var nonce = "";
var encryption = "0123456789abcdefghijklmnopqrstuvwxyz";
var random = new Random();
for (int i = 0; i < 16; i++)
{
nonce += encryption[random.Next(0, encryption.Length)];
}
headers.Add("nonce", nonce);
headers.Add("nonce", IqiyiVersion.Nonce());
headers.Add("pageNo", "0");
headers.Add("pageCount", "20");
headers.Add("ck", iqiyiAccount.Cookie);
......@@ -90,16 +82,7 @@ namespace iqiyiWin.Api
headers.Add("dvsrc", IqiyiVersion.Dvsrc);
headers.Add("dfp", IqiyiVersion.Dfp());
headers.Add("ts", DateUtils.GetTimeStampOfMilliseconds().ToString());
var nonce = "";
var encryption = "0123456789abcdefghijklmnopqrstuvwxyz";
var random = new Random();
for (int i = 0; i < 16; i++)
{
nonce += encryption[random.Next(0, encryption.Length)];
}
headers.Add("nonce", nonce);
headers.Add("nonce", IqiyiVersion.Nonce());
headers.Add("pageNo", "0");
headers.Add("pageCount", "20");
headers.Add("ck", iqiyiAccount.Cookie);
......@@ -132,7 +115,7 @@ namespace iqiyiWin.Api
else
{
// UILogUtils.Error($"爱奇艺票务 【获取优惠券数量】失败: {iqiyiAccount.MobileNo} {(response == null ? responseStr : response.Msg)}");
return new List<Valid>();
return null;
}
}
/// <summary>
......@@ -146,21 +129,35 @@ namespace iqiyiWin.Api
var dfp = IqiyiVersion.Dfp();
var nonceRandom = new Random();
//headers.Add("deviceId", dfp);
//headers.Add("dfp", dfp);
//headers.Add("appid", "1003");
//headers.Add("os", "CPU iPhone OS 13_2_3 like Mac OS X");
//headers.Add("format", "json");
//headers.Add("platform", "Win32");
//headers.Add("ts", DateUtils.GetTimeStampOfMilliseconds().ToString());
//headers.Add("src", "H5");
//headers.Add("version", "1.0.0");
//headers.Add("ck", iqiyiAccount.Cookie);
//headers.Add("nonce", $"0.{NonceRandom.Next(10000000, 99999999)}{NonceRandom.Next(10000000, 99999999)}");
//headers.Add("bizType", "APP");
//headers.Add("_t", DateUtils.GetTimeStampOfMilliseconds().ToString());
headers.Add("deviceId", dfp);
headers.Add("dfp", dfp);
headers.Add("appid", "1003");
headers.Add("os", "CPU iPhone OS 13_2_3 like Mac OS X");
headers.Add("appid", "10010");
headers.Add("os", "14.4");
headers.Add("format", "json");
headers.Add("platform", "Win32");
headers.Add("platform", "iphone");
headers.Add("ts", DateUtils.GetTimeStampOfMilliseconds().ToString());
headers.Add("src", "H5");
headers.Add("version", "1.0.0");
headers.Add("location", "");
headers.Add("src", "ios");
headers.Add("version", "3.3.0");
headers.Add("ck", iqiyiAccount.Cookie);
headers.Add("nonce", $"0.{nonceRandom.Next(10000000, 99999999)}{nonceRandom.Next(10000000, 99999999)}");
headers.Add("nonce", "1248907070");
headers.Add("bizType", "APP");
headers.Add("_t", DateUtils.GetTimeStampOfMilliseconds().ToString());
headers.Add("cityId", "");
var queryText = UrlUtils.BuildQueryStringUrl(headers);
......@@ -187,13 +184,15 @@ namespace iqiyiWin.Api
{
var headers = new SortedDictionary<string, string>();
var queryList = new SortedDictionary<string, string>();
headers.Add("actCode", actCode);
headers.Add("P00001", iqiyiAccount.Cookie);
queryList.Add("actCode", actCode);
queryList.Add("P00001", iqiyiAccount.Cookie);
headers.Add("Origin", "https://www.iqiyi.com");
var queryText = UrlUtils.BuildQueryStringUrl(headers);
var queryText = UrlUtils.BuildQueryStringUrl(queryList);
var responseStr = HttpUtils.DoGet(Domain.PCELL_DOMAIN + ApiConstant.LOCK_DRAW + queryText, headers);
var responseStr = HttpUtils.DoGet(new CookieContainer() , Domain.WWW_IQIYI, Domain.PCELL_DOMAIN + ApiConstant.LOCK_DRAW + queryText, headers);
var response = JsonConvert.DeserializeObject<LockDrawResponse>(responseStr);
......
......@@ -14,19 +14,30 @@ namespace iqiyiWin.Constant
public static string Platform = "iPhone";
public static string Appid = "10012";
public static string Dvsrc = "ios";
public static Random Random = new Random();
public static string Dfp()
{
var resultText = "";
var random = new Random();
var randomText = "0123456789abcdef";
for( var i = 0; i < 66; i++)
{
resultText += randomText[random.Next(0, 16)];
resultText += randomText[Random.Next(0, 16)];
}
return resultText;
}
public static string Nonce()
{
var nonce = "";
var encryption = "0123456789abcdefghijklmnopqrstuvwxyz";
var random = new Random();
for (int i = 0; i < 16; i++)
{
nonce += encryption[random.Next(0, encryption.Length)];
}
return nonce;
}
}
}
......@@ -238,6 +238,45 @@ namespace iqiyiWin
var logText = $"爱奇艺票务 本次{EnumExtension.GetDescription(TaskList[TaskIndex])}任务,共计执行{SelectNum}个账号,成功{SuccessNum}个账号,失败{ErrorNum}个账号,所用时长{hour}小时{mominute}分钟{msecond}秒钟。";
// 如果它是查券就进行排序
if (TaskList[TaskIndex] == TaskTypeEnum.Coupon)
{
var hasCouponAccount = new List<IqiyiAccount>();
foreach (var item in IqiyiAccounts)
{
if(item.CouponList != null && item.CouponList.Count > 0)
{
hasCouponAccount.Add(item);
}
}
String fileNamePrefix = "查询优惠券成功有券排序完成-" + DateTime.Now.ToString("HHmmss") + ".txt";
var fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "查询优惠券", DateTime.Now.ToString("yyyyMMdd"));
var filePath = Path.Combine(fileDirectory, fileNamePrefix);
var fileText = "";
for (int i = 0; i < hasCouponAccount.Count; i++)
{
for (int j = i +1; j < hasCouponAccount.Count; j++)
{
if(hasCouponAccount[i].CouponList[0].ExpiredTimeNum > hasCouponAccount[j].CouponList[0].ExpiredTimeNum)
{
var temp = hasCouponAccount[i];
hasCouponAccount[i] = hasCouponAccount[j];
hasCouponAccount[j] = temp;
}
}
var item = hasCouponAccount[i];
fileText = $"{item.MobileNo}----{item.Password}----{item.Cookie}|";
foreach (var v in item.CouponList)
{
fileText += $"[{v.DisplaySubType}|{v.DisplaySubName}~减{v.DisCountStr}|{v.AvailableTips}]";
}
fileText += $"\n";
FileUtils.AppendAllText(filePath, fileText, Encoding.UTF8);
}
}
if (TimerTiming.Enabled)
{
SendDingdingMessagesAsync($"{logText}", "18057708086");
......@@ -641,7 +680,8 @@ namespace iqiyiWin
CancellationToken cancellationToken = _cancellationTokenSource.Token;
String fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","查询优惠券", DateTime.Now.ToString("yyyyMMdd"));
String fileNamePrefixSuccess = "查询优惠券成功-" + DateTime.Now.ToString("HHmmss") + ".txt";
String fileNamePrefixSuccessHasCoupon = "查询优惠券成功有券-" + DateTime.Now.ToString("HHmmss") + ".txt";
String fileNamePrefixSuccessHasNotCoupon = "查询优惠券成功无券-" + DateTime.Now.ToString("HHmmss") + ".txt";
String fileNamePrefixError = "查询优惠券失败-" + DateTime.Now.ToString("HHmmss") + ".txt";
foreach (var iqiyiAccount in iqiyiAccounts)
......@@ -658,17 +698,27 @@ namespace iqiyiWin
string filePath = "";
var iqiyiAccountCouponList = User.GetCouponList(iqiyiAccount);
iqiyiAccount.CouponNum = Convert.ToInt32(iqiyiAccountCouponList.Count);
string fileText = $"{iqiyiAccount.MobileNo}----{iqiyiAccount.Password}----{iqiyiAccount.Cookie}";
if (iqiyiAccountCouponList.Count == 0)
if (iqiyiAccountCouponList == null)
{
Interlocked.Increment(ref ErrorNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixError);
fileText += $"\n";
}
else if(iqiyiAccountCouponList.Count == 0)
{
Interlocked.Increment(ref SuccessNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
fileText += $"\n";
filePath = Path.Combine(fileDirectory, fileNamePrefixSuccessHasNotCoupon);
}
else
{
......@@ -676,6 +726,10 @@ namespace iqiyiWin
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
iqiyiAccount.CouponList = iqiyiAccountCouponList;
iqiyiAccount.CouponNum = Convert.ToInt32(iqiyiAccountCouponList.Count);
var couponListText = "";
foreach(var item in iqiyiAccountCouponList)
......@@ -685,12 +739,11 @@ namespace iqiyiWin
fileText = $"{fileText}|{couponListText}\n";
filePath = Path.Combine(fileDirectory, fileNamePrefixSuccess);
filePath = Path.Combine(fileDirectory, fileNamePrefixSuccessHasCoupon);
}
setStatusStripNum();
FileUtils.AppendAllText(filePath, fileText, Encoding.UTF8);
}, cancellationToken);
}
......@@ -846,8 +899,15 @@ namespace iqiyiWin
TaskList.Add(TaskTypeEnum.Coupon);
taskNameList.Add($"{EnumExtension.GetDescription(TaskTypeEnum.Coupon)}");
}
// 执行抽奖
if (cb_luckDraw.Checked)
{
if (ActCode.Length == 0)
{
UILogUtils.Error($"请先添加抽奖Id");
return;
}
TaskList.Add(TaskTypeEnum.LockDraw);
taskNameList.Add($"{EnumExtension.GetDescription(TaskTypeEnum.LockDraw)}");
}
......
......@@ -4,6 +4,7 @@ using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using iqiyiWin.Response.User.CouponList;
namespace iqiyiWin.Model
{
......@@ -44,10 +45,11 @@ namespace iqiyiWin.Model
/// <summary>
/// 优惠券数
/// </summary>
public int CouponNum { get; set; }
public int CouponNum { get; set; } = 0;
/// <summary>
/// 优惠券列表
/// </summary>
public Array CouponList { get; set; }
public List<Valid> CouponList { get; set; }
}
}
......@@ -246,12 +246,19 @@ namespace iqiyiWin.Response.User.CouponList
[JsonProperty("couponType")]
public int CouponType { get; set; }
/// <summary>
/// Examples: "3天到期"
/// </summary>
[JsonProperty("expiredTimeRemind")]
public string ExpiredTimeRemind { get; set; }
/// <summary>
/// Examples: "https://app.iqiyi.com/ext/common/qipiao/libao_goumai/app.html?channel=piaoh5_lbkq"
/// </summary>
[JsonProperty("giftPackageH5Url")]
public string GiftPackageH5Url { get; set; }
/// <summary>
/// Examples: "不可叠加"
/// </summary>
......@@ -263,5 +270,8 @@ namespace iqiyiWin.Response.User.CouponList
/// </summary>
[JsonProperty("desc")]
public string Desc { get; set; }
public int ExpiredTimeNum { get { return Convert.ToInt32(System.Text.RegularExpressions.Regex.Replace(ExpiredTimeRemind, @"[^0-9]+", "")); } }
}
}
......@@ -32,8 +32,8 @@
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.btn_submit = new System.Windows.Forms.Button();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.btn_stop = new System.Windows.Forms.Button();
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment