Commit f905230d authored by wuliangshun's avatar wuliangshun

Initial commit

parents
Pipeline #1420 failed with stages
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
**/wwwroot/lib/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# BeatPulse healthcheck temp database
healthchecksdb
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29020.237
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "iqiyiWin", "iqiyiWin\iqiyiWin.csproj", "{8865CEE3-3A28-4333-A8C8-023E1ED89212}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8865CEE3-3A28-4333-A8C8-023E1ED89212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8865CEE3-3A28-4333-A8C8-023E1ED89212}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8865CEE3-3A28-4333-A8C8-023E1ED89212}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8865CEE3-3A28-4333-A8C8-023E1ED89212}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {787B170B-D2F8-49FF-9799-5F07FDD56630}
EndGlobalSection
EndGlobal
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Api
{
public class Domain
{
public static string TICKET_IQIYI = "https://ticket.iqiyi.com";
public static string REFERER_DOMAIN = "https://movie.iqiyi.com/";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using iqiyiWin.Constant;
using iqiyiWin.Model;
using iqiyiWin.Response.User.CouponList;
using iqiyiWin.Response.User.MovieBean;
using iqiyiWin.Util;
using Newtonsoft.Json;
namespace iqiyiWin.Api
{
public class User
{
/// <summary>
/// 查询观影豆
/// </summary>
/// <param name="cookie"></param>
/// <returns></returns>
public static string GetMovieBean(IqiyiAccount iqiyiAccount)
{
var headers = new SortedDictionary<string, string>();
headers.Add("version", IqiyiVersion.Version);
headers.Add("os", IqiyiVersion.Os);
headers.Add("src", IqiyiVersion.Src);
headers.Add("platform", IqiyiVersion.Platform);
headers.Add("appid", IqiyiVersion.Appid);
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("pageNo", "0");
headers.Add("pageCount", "20");
headers.Add("ck", iqiyiAccount.Cookie);
headers.Add("sig", IqiyiSign.Sign(headers));
var cookieContainer = new CookieContainer();
var cookieItem = new Cookie();
cookieItem.Name = "P00001";
cookieItem.Value = iqiyiAccount.Cookie;
cookieItem.Domain = ".iqiyi.com";
cookieContainer.Add(cookieItem);
var queryText = UrlUtils.BuildQueryStringUrl(headers);
var responseStr = HttpUtils.DoGet(cookieContainer, Domain.REFERER_DOMAIN, Domain.TICKET_IQIYI + ApiConstant.GET_MOVIE_BEAN + queryText, headers);
var response = JsonConvert.DeserializeObject<MovieBeanResponse>(responseStr);
if (response != null && response.Code == "A00000")
{
UILogUtils.Info($"爱奇艺商务 【获取观影豆】成功: {iqiyiAccount.MobileNo} [当前观影豆:{response.Data.BalanceCount}]");
return response.Data.BalanceCount.ToString();
}
else
{
UILogUtils.Error($"爱奇艺商务 【获取观影豆】失败: {iqiyiAccount.MobileNo} {(response == null ? responseStr : response.Msg)}");
return "-1";
}
}
public static string GetCouponList(IqiyiAccount iqiyiAccount)
{
var headers = new SortedDictionary<string, string>();
headers.Add("version", IqiyiVersion.Version);
headers.Add("os", IqiyiVersion.Os);
headers.Add("src", IqiyiVersion.Src);
headers.Add("platform", IqiyiVersion.Platform);
headers.Add("appid", IqiyiVersion.Appid);
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("pageNo", "0");
headers.Add("pageCount", "20");
headers.Add("ck", iqiyiAccount.Cookie);
headers.Add("sig", IqiyiSign.Sign(headers));
var cookieContainer = new CookieContainer();
var cookieItem = new Cookie();
cookieItem.Name = "P00001";
cookieItem.Value = iqiyiAccount.Cookie;
cookieItem.Domain = ".iqiyi.com";
cookieContainer.Add(cookieItem);
var queryText = UrlUtils.BuildQueryStringUrl(headers);
var responseStr = HttpUtils.DoGet(cookieContainer, Domain.REFERER_DOMAIN, Domain.TICKET_IQIYI + ApiConstant.GET_COUPON_LIST + queryText, headers);
var response = JsonConvert.DeserializeObject<CouponListResponse>(responseStr);
if (response != null && response.Code == "A00000")
{
var couponTextList =new List<string>();
foreach(Valid item in response.Data.Valid)
{
couponTextList.Add($" {item.DisplayName}-{item.DisCountStr}-{item.AvailableTips}");
};
UILogUtils.Info($"爱奇艺商务 【获取优惠券数量】成功: {iqiyiAccount.MobileNo} [当前优惠券数量:{response.Data.Valid.Count}]\n{ string.Join("\n", couponTextList.ToArray())}");
return response.Data.Valid.Count.ToString();
}
else
{
UILogUtils.Error($"爱奇艺商务 【获取优惠券数量】失败: {iqiyiAccount.MobileNo} {(response == null ? responseStr : response.Msg)}");
return "-1";
}
}
public static Boolean UserDoSign(IqiyiAccount iqiyiAccount)
{
var headers = new SortedDictionary<string, string>();
headers.Add("deviceId", IqiyiVersion.Dfp);
headers.Add("dfp", IqiyiVersion.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.6682964300917493");
headers.Add("bizType", "APP");
headers.Add("_t", DateUtils.GetTimeStampOfMilliseconds().ToString());
var queryText = UrlUtils.BuildQueryStringUrl(headers);
var responseStr = HttpUtils.DoGet(Domain.TICKET_IQIYI + ApiConstant.USER_SIGN_IN + queryText, headers);
var response = JsonConvert.DeserializeObject<CouponListResponse>(responseStr);
if (response != null && (response.Code == "A00000" || response.Code == "A00001"))
{
UILogUtils.Info($"爱奇艺商务 【签到】成功: {iqiyiAccount.MobileNo}");
return true;
}
else
{
UILogUtils.Error($"爱奇艺商务 【签到】失败: {iqiyiAccount.MobileNo} {(response == null ? responseStr : response.Msg)}");
return false;
}
}
}
}
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Constant
{
public class ApiConstant
{
/// <summary>
/// 获取用户信息
/// </summary>
public static string GET_USER_INFO = "/apis/profile/info.action";
/// <summary>
/// 获取优惠券列表
/// </summary>
public static string GET_COUPON_LIST = "/app/v2/coupon/getUserCoupons";
/// <summary>
/// 获取观影豆列表
/// </summary>
public static string GET_MOVIE_BEAN = "/app/v2/balance/detail";
/// <summary>
/// 用户签到
/// </summary>
public static string USER_SIGN_IN = "/app/v2/user/doSign";
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Constant
{
public class IqiyiVersion
{
public static string Version = "3.1.7";
public static string Os = "iPhone 13.2.3";
public static string Src = "h5";
public static string Platform = "iPhone";
public static string Appid = "10012";
public static string Dvsrc = "ios";
public static string Dfp = "a07ef14b414be543bdaae4b2d482d7e944eb08ba8b692e008e6371b3414b0cc57a";
}
}
namespace iqiyiWin
{
partial class Main
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.dgv_user = new System.Windows.Forms.DataGridView();
this.MobileNo = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Password = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Cookie = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.SignStatusDesc = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MovieBean = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.CouponNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cms_user = new System.Windows.Forms.ContextMenuStrip(this.components);
this.签到ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.查询观影豆ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.查询优惠券ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.导入账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.导出账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.清空账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.复制账号ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.txtLog = new System.Windows.Forms.RichTextBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.rb_signIn = new System.Windows.Forms.RadioButton();
this.rb_movieBean = new System.Windows.Forms.RadioButton();
this.rb_coupon = new System.Windows.Forms.RadioButton();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.btn_start = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_select_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_implement_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_success_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel4 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_error_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel5 = new System.Windows.Forms.ToolStripStatusLabel();
this.tssl_wait_num = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.删除ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.tableLayoutPanel1.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv_user)).BeginInit();
this.cms_user.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 240F));
this.tableLayoutPanel1.Controls.Add(this.groupBox1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.groupBox3, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.groupBox4, 1, 1);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 2;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(784, 441);
this.tableLayoutPanel1.TabIndex = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.dgv_user);
this.groupBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox1.Location = new System.Drawing.Point(3, 3);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(538, 214);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "账号信息";
//
// dgv_user
//
this.dgv_user.AllowUserToAddRows = false;
this.dgv_user.AllowUserToDeleteRows = false;
this.dgv_user.BackgroundColor = System.Drawing.SystemColors.Control;
this.dgv_user.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgv_user.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.MobileNo,
this.Password,
this.Cookie,
this.SignStatusDesc,
this.MovieBean,
this.CouponNum});
this.dgv_user.ContextMenuStrip = this.cms_user;
this.dgv_user.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgv_user.Location = new System.Drawing.Point(3, 17);
this.dgv_user.Name = "dgv_user";
this.dgv_user.ReadOnly = true;
this.dgv_user.RowTemplate.Height = 23;
this.dgv_user.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgv_user.Size = new System.Drawing.Size(532, 194);
this.dgv_user.TabIndex = 0;
//
// MobileNo
//
this.MobileNo.DataPropertyName = "MobileNo";
this.MobileNo.HeaderText = "手机号";
this.MobileNo.Name = "MobileNo";
this.MobileNo.ReadOnly = true;
this.MobileNo.ToolTipText = "手机号";
//
// Password
//
this.Password.DataPropertyName = "Password";
this.Password.HeaderText = "密码";
this.Password.Name = "Password";
this.Password.ReadOnly = true;
this.Password.ToolTipText = "密码";
//
// Cookie
//
this.Cookie.DataPropertyName = "Cookie";
this.Cookie.HeaderText = "Cookie";
this.Cookie.Name = "Cookie";
this.Cookie.ReadOnly = true;
this.Cookie.ToolTipText = "Cookie";
//
// SignStatusDesc
//
this.SignStatusDesc.DataPropertyName = "SignStatusDesc";
this.SignStatusDesc.HeaderText = "签到";
this.SignStatusDesc.Name = "SignStatusDesc";
this.SignStatusDesc.ReadOnly = true;
this.SignStatusDesc.ToolTipText = "签到";
//
// MovieBean
//
this.MovieBean.DataPropertyName = "MovieBean";
this.MovieBean.HeaderText = "观影豆";
this.MovieBean.Name = "MovieBean";
this.MovieBean.ReadOnly = true;
this.MovieBean.ToolTipText = "观影豆";
//
// CouponNum
//
this.CouponNum.DataPropertyName = "CouponNum";
this.CouponNum.HeaderText = "优惠券数量";
this.CouponNum.Name = "CouponNum";
this.CouponNum.ReadOnly = true;
this.CouponNum.ToolTipText = "优惠券数量";
//
// cms_user
//
this.cms_user.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.签到ToolStripMenuItem,
this.查询观影豆ToolStripMenuItem,
this.查询优惠券ToolStripMenuItem,
this.toolStripMenuItem2,
this.复制账号ToolStripMenuItem,
this.删除ToolStripMenuItem,
this.toolStripMenuItem3,
this.导入账号ToolStripMenuItem,
this.导出账号ToolStripMenuItem,
this.清空账号ToolStripMenuItem});
this.cms_user.Name = "cms_user";
this.cms_user.Size = new System.Drawing.Size(187, 224);
//
// 签到ToolStripMenuItem
//
this.签到ToolStripMenuItem.Name = "签到ToolStripMenuItem";
this.签到ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.签到ToolStripMenuItem.Text = "签到";
this.签到ToolStripMenuItem.Click += new System.EventHandler(this.签到ToolStripMenuItem_Click);
//
// 查询观影豆ToolStripMenuItem
//
this.查询观影豆ToolStripMenuItem.Name = "查询观影豆ToolStripMenuItem";
this.查询观影豆ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.查询观影豆ToolStripMenuItem.Text = "查询观影豆";
this.查询观影豆ToolStripMenuItem.Click += new System.EventHandler(this.查询观影豆ToolStripMenuItem_Click);
//
// 查询优惠券ToolStripMenuItem
//
this.查询优惠券ToolStripMenuItem.Name = "查询优惠券ToolStripMenuItem";
this.查询优惠券ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.查询优惠券ToolStripMenuItem.Text = "查询优惠券";
this.查询优惠券ToolStripMenuItem.Click += new System.EventHandler(this.查询优惠券ToolStripMenuItem_Click);
//
// toolStripMenuItem2
//
this.toolStripMenuItem2.Name = "toolStripMenuItem2";
this.toolStripMenuItem2.Size = new System.Drawing.Size(186, 22);
this.toolStripMenuItem2.Text = "----------------------";
//
// 导入账号ToolStripMenuItem
//
this.导入账号ToolStripMenuItem.Name = "导入账号ToolStripMenuItem";
this.导入账号ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.导入账号ToolStripMenuItem.Text = "导入账号";
this.导入账号ToolStripMenuItem.Click += new System.EventHandler(this.导入账号ToolStripMenuItem_Click);
//
// 导出账号ToolStripMenuItem
//
this.导出账号ToolStripMenuItem.Name = "导出账号ToolStripMenuItem";
this.导出账号ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.导出账号ToolStripMenuItem.Text = "导出账号";
this.导出账号ToolStripMenuItem.Click += new System.EventHandler(this.导出账号ToolStripMenuItem_Click);
//
// 清空账号ToolStripMenuItem
//
this.清空账号ToolStripMenuItem.Name = "清空账号ToolStripMenuItem";
this.清空账号ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.清空账号ToolStripMenuItem.Text = "清空账号";
this.清空账号ToolStripMenuItem.Click += new System.EventHandler(this.清空账号ToolStripMenuItem_Click);
//
// 复制账号ToolStripMenuItem
//
this.复制账号ToolStripMenuItem.Name = "复制账号ToolStripMenuItem";
this.复制账号ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.复制账号ToolStripMenuItem.Text = "复制选中账号";
this.复制账号ToolStripMenuItem.Click += new System.EventHandler(this.复制账号ToolStripMenuItem_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.txtLog);
this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox2.Location = new System.Drawing.Point(3, 223);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(538, 215);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "日志";
//
// txtLog
//
this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtLog.Location = new System.Drawing.Point(3, 17);
this.txtLog.Name = "txtLog";
this.txtLog.Size = new System.Drawing.Size(532, 195);
this.txtLog.TabIndex = 0;
this.txtLog.Text = "";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.tableLayoutPanel3);
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox3.Location = new System.Drawing.Point(547, 3);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(234, 214);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "设置";
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 1;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.rb_signIn, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.rb_movieBean, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.rb_coupon, 0, 2);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 17);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 4;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 32F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(228, 194);
this.tableLayoutPanel3.TabIndex = 0;
//
// rb_signIn
//
this.rb_signIn.AutoSize = true;
this.rb_signIn.Checked = true;
this.rb_signIn.Dock = System.Windows.Forms.DockStyle.Left;
this.rb_signIn.Location = new System.Drawing.Point(13, 3);
this.rb_signIn.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.rb_signIn.Name = "rb_signIn";
this.rb_signIn.Size = new System.Drawing.Size(47, 26);
this.rb_signIn.TabIndex = 0;
this.rb_signIn.TabStop = true;
this.rb_signIn.Text = "签到";
this.rb_signIn.UseVisualStyleBackColor = true;
//
// rb_movieBean
//
this.rb_movieBean.AutoSize = true;
this.rb_movieBean.Dock = System.Windows.Forms.DockStyle.Left;
this.rb_movieBean.Location = new System.Drawing.Point(13, 35);
this.rb_movieBean.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.rb_movieBean.Name = "rb_movieBean";
this.rb_movieBean.Size = new System.Drawing.Size(83, 26);
this.rb_movieBean.TabIndex = 1;
this.rb_movieBean.Text = "查询观影豆";
this.rb_movieBean.UseVisualStyleBackColor = true;
//
// rb_coupon
//
this.rb_coupon.AutoSize = true;
this.rb_coupon.Dock = System.Windows.Forms.DockStyle.Left;
this.rb_coupon.Location = new System.Drawing.Point(13, 67);
this.rb_coupon.Margin = new System.Windows.Forms.Padding(13, 3, 3, 3);
this.rb_coupon.Name = "rb_coupon";
this.rb_coupon.Size = new System.Drawing.Size(83, 26);
this.rb_coupon.TabIndex = 2;
this.rb_coupon.TabStop = true;
this.rb_coupon.Text = "查询优惠券";
this.rb_coupon.UseVisualStyleBackColor = true;
//
// groupBox4
//
this.groupBox4.Controls.Add(this.tableLayoutPanel2);
this.groupBox4.Dock = System.Windows.Forms.DockStyle.Fill;
this.groupBox4.Location = new System.Drawing.Point(547, 223);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(234, 215);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "操作";
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 2;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel2.Controls.Add(this.btn_start, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.button1, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.button2, 0, 1);
this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 17);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 3;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(228, 195);
this.tableLayoutPanel2.TabIndex = 0;
//
// btn_start
//
this.btn_start.Dock = System.Windows.Forms.DockStyle.Fill;
this.btn_start.Location = new System.Drawing.Point(3, 3);
this.btn_start.Name = "btn_start";
this.btn_start.Size = new System.Drawing.Size(108, 34);
this.btn_start.TabIndex = 0;
this.btn_start.Text = "开始";
this.btn_start.UseVisualStyleBackColor = true;
this.btn_start.Click += new System.EventHandler(this.Btn_start_Click);
//
// button1
//
this.button1.Dock = System.Windows.Forms.DockStyle.Fill;
this.button1.Location = new System.Drawing.Point(117, 3);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(108, 34);
this.button1.TabIndex = 1;
this.button1.Text = "暂停";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.Button1_Click);
//
// button2
//
this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
this.button2.Location = new System.Drawing.Point(3, 43);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(108, 34);
this.button2.TabIndex = 2;
this.button2.Text = "打开文件夹";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.Button2_Click);
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1,
this.tssl_select_num,
this.toolStripStatusLabel2,
this.tssl_implement_num,
this.toolStripStatusLabel3,
this.tssl_success_num,
this.toolStripStatusLabel4,
this.tssl_error_num,
this.toolStripStatusLabel5,
this.tssl_wait_num});
this.statusStrip1.Location = new System.Drawing.Point(0, 419);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(784, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(68, 17);
this.toolStripStatusLabel1.Text = "选中数量:";
//
// tssl_select_num
//
this.tssl_select_num.Name = "tssl_select_num";
this.tssl_select_num.Size = new System.Drawing.Size(15, 17);
this.tssl_select_num.Text = "0";
//
// toolStripStatusLabel2
//
this.toolStripStatusLabel2.Name = "toolStripStatusLabel2";
this.toolStripStatusLabel2.Size = new System.Drawing.Size(68, 17);
this.toolStripStatusLabel2.Text = "执行数量:";
//
// tssl_implement_num
//
this.tssl_implement_num.Name = "tssl_implement_num";
this.tssl_implement_num.Size = new System.Drawing.Size(15, 17);
this.tssl_implement_num.Text = "0";
//
// toolStripStatusLabel3
//
this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
this.toolStripStatusLabel3.Size = new System.Drawing.Size(68, 17);
this.toolStripStatusLabel3.Text = "成功数量:";
//
// tssl_success_num
//
this.tssl_success_num.Name = "tssl_success_num";
this.tssl_success_num.Size = new System.Drawing.Size(15, 17);
this.tssl_success_num.Text = "0";
//
// toolStripStatusLabel4
//
this.toolStripStatusLabel4.Name = "toolStripStatusLabel4";
this.toolStripStatusLabel4.Size = new System.Drawing.Size(68, 17);
this.toolStripStatusLabel4.Text = "失败数量:";
//
// tssl_error_num
//
this.tssl_error_num.Name = "tssl_error_num";
this.tssl_error_num.Size = new System.Drawing.Size(15, 17);
this.tssl_error_num.Text = "0";
//
// toolStripStatusLabel5
//
this.toolStripStatusLabel5.Name = "toolStripStatusLabel5";
this.toolStripStatusLabel5.Size = new System.Drawing.Size(68, 17);
this.toolStripStatusLabel5.Text = "等待数量:";
//
// tssl_wait_num
//
this.tssl_wait_num.Name = "tssl_wait_num";
this.tssl_wait_num.Size = new System.Drawing.Size(15, 17);
this.tssl_wait_num.Text = "0";
//
// toolStripMenuItem3
//
this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(186, 22);
this.toolStripMenuItem3.Text = "----------------------";
//
// 删除ToolStripMenuItem
//
this.删除ToolStripMenuItem.Name = "删除ToolStripMenuItem";
this.删除ToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
this.删除ToolStripMenuItem.Text = "删除选中账号";
this.删除ToolStripMenuItem.Click += new System.EventHandler(this.删除ToolStripMenuItem_Click);
//
// Main
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 441);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Main";
this.Text = "-";
this.Load += new System.EventHandler(this.Form1_Load);
this.tableLayoutPanel1.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dgv_user)).EndInit();
this.cms_user.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.DataGridView dgv_user;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Button btn_start;
private System.Windows.Forms.ContextMenuStrip cms_user;
private System.Windows.Forms.ToolStripMenuItem 签到ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 查询观影豆ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 查询优惠券ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem 导出账号ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 导入账号ToolStripMenuItem;
private System.Windows.Forms.RichTextBox txtLog;
private System.Windows.Forms.DataGridViewTextBoxColumn MobileNo;
private System.Windows.Forms.DataGridViewTextBoxColumn Password;
private System.Windows.Forms.DataGridViewTextBoxColumn Cookie;
private System.Windows.Forms.DataGridViewTextBoxColumn SignStatusDesc;
private System.Windows.Forms.DataGridViewTextBoxColumn MovieBean;
private System.Windows.Forms.DataGridViewTextBoxColumn CouponNum;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.ToolStripStatusLabel tssl_select_num;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
private System.Windows.Forms.ToolStripStatusLabel tssl_implement_num;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
private System.Windows.Forms.ToolStripStatusLabel tssl_success_num;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel4;
private System.Windows.Forms.ToolStripStatusLabel tssl_error_num;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel5;
private System.Windows.Forms.ToolStripStatusLabel tssl_wait_num;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.RadioButton rb_signIn;
private System.Windows.Forms.RadioButton rb_movieBean;
private System.Windows.Forms.RadioButton rb_coupon;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ToolStripMenuItem 清空账号ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 复制账号ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem 删除ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using iqiyiWin.Api;
using iqiyiWin.Model;
using iqiyiWin.Util;
using iqiyiWin.Constant;
using System.Threading;
using System.Collections;
using System.IO;
namespace iqiyiWin
{
public partial class Main : Form, IUILog
{
/// <summary>
/// 是否调试
/// </summary>
public static Boolean isDebuger = false;
/// <summary>
/// 爱奇艺账号列表
/// </summary>
public List<IqiyiAccount> IqiyiAccounts = new List<IqiyiAccount>();
/// <summary>
/// 选中数量
/// </summary>
public static int SelectNum = 0;
/// <summary>
/// 执行数量
/// </summary>
public static int ImplementNum = 0;
/// <summary>
/// 成功数量
/// </summary>
public static int SuccessNum = 0;
/// <summary>
/// 失败数量
/// </summary>
public static int ErrorNum = 0;
/// <summary>
/// 等待数量
/// </summary>
public static int WaitNum = 0;
/// <summary>
/// 取消操作通知
/// </summary>
private CancellationTokenSource _cancellationTokenSource;
/// <summary>
/// 程序运行状态
/// </summary>
public Boolean IsLoading = false;
/// <summary>
/// 程序执行任务的开始时间
/// </summary>
public long StartTime = 0;
/// <summary>
/// 程序执行任务的完成时间
/// </summary>
public long EndTime = 0;
public Main()
{
InitializeComponent();
this.init();
}
public void init()
{
UILogUtils.Add(this);
dgv_user.AutoGenerateColumns = false;
}
private void Form1_Load(object sender, EventArgs e)
{
}
#region 右键导入账号
/// <summary>
/// 右键导入账号
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void 导入账号ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
var dataObject = Clipboard.GetDataObject();
if (dataObject.GetDataPresent(DataFormats.Text))
{
string text = (String)dataObject.GetData(DataFormats.Text);
var iqiyiAccounts = Text2IqiyiAccounts(text);
AddIqiyiAccount(iqiyiAccounts);
}
else
{
UILogUtils.Error("粘贴板没有文本数据。");
}
}
catch (Exception ex)
{
UILogUtils.Error(ex);
}
}
private List<IqiyiAccount> Text2IqiyiAccounts(string text)
{
var iqiyiAccounts = new List<IqiyiAccount>();
var lines = text.Split(new String[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
lines.ForEach(line =>
{
var optionItems = line.Split(new String[] { "----" }, StringSplitOptions.RemoveEmptyEntries);
if (optionItems == null)
{
throw new Exception("行:" + line + "格式不正确[1]。");
}
string version = optionItems[0];
if (optionItems.Length != 3)
{
throw new Exception("行:" + line + "格式不正确[2]。");
}
var iqiyiAccount = new IqiyiAccount()
{
MobileNo = optionItems[0],
Password = optionItems[1],
Cookie = optionItems[2]
};
iqiyiAccounts.Add(iqiyiAccount);
});
return iqiyiAccounts;
}
/// <summary>
/// 添加爱奇艺账号
/// </summary>
private void AddIqiyiAccount(List<IqiyiAccount> iqiyiAccounts)
{
if (iqiyiAccounts == null || iqiyiAccounts.Count < 0)
{
return;
}
IqiyiAccounts.AddRange(iqiyiAccounts);
RefreshIqiyiAccount();
}
private void RefreshIqiyiAccount()
{
dgv_user.DataSource = null;
dgv_user.DataSource = IqiyiAccounts;
}
#endregion
#region 设置界面数量
public void setStatusStripNum()
{
if (this.InvokeRequired)
{
this.Invoke(new Action(setStatusStripNumNext));
}
else
{
setStatusStripNumNext();
}
}
private void setStatusStripNumNext()
{
tssl_select_num.Text = SelectNum.ToString();
tssl_implement_num.Text = ImplementNum.ToString();
tssl_success_num.Text = SuccessNum.ToString();
tssl_error_num.Text = ErrorNum.ToString();
tssl_wait_num.Text = WaitNum.ToString();
if (SelectNum == ImplementNum)
{
IsLoading = false;
EndTime = DateUtils.GetTimeStampOfMilliseconds();
var hour = Convert.ToInt32((EndTime - StartTime) / (1000 * 60 * 60));
var mominute = Convert.ToInt32(((EndTime - StartTime) % (1000 * 60 * 60)) / (1000 * 60));
var msecond = ((EndTime - StartTime) % (1000 * 60) / 1000);
UILogUtils.Info($"本次共计执行{SelectNum}个账号,所用时长{hour}小时{mominute}分钟{msecond}秒钟");
}
}
#endregion
#region 界面日志
public void Info(string message)
{
message = string.Format("[信息] [{0}] {1} {2}", DateTime.Now.ToString("HH:mm:ss"), message, Environment.NewLine);
if (txtLog.InvokeRequired)
{
txtLog.Invoke(new Action<String>(ShowInfoMessage), new object[] { message });
}
else
{
ShowInfoMessage(message);
}
}
private void ShowInfoMessage(string message)
{
txtLog.AppendText(message);
// 将光标位置设置到当前内容的末尾
txtLog.SelectionStart = txtLog.Text.Length;
// 滚动到光标位置
txtLog.ScrollToCaret();
}
public void Error(string message)
{
message = string.Format("[错误] [{0}] {1} {2}", DateTime.Now.ToString("HH:mm:ss"), message, Environment.NewLine);
if (txtLog.InvokeRequired)
{
txtLog.Invoke(new Action<String>(ShowErrorMessage), new object[] { message });
}
else
{
ShowErrorMessage(message);
}
}
public void Error(Exception exception)
{
String message = string.Format("[信息] [{0}] {1} {2}", DateTime.Now.ToString("HH:mm:ss"),
isDebuger ? exception.ToString() : exception.Message, Environment.NewLine);
if (txtLog.InvokeRequired)
{
txtLog.Invoke(new Action<String>(ShowErrorMessage), new object[] { message });
}
else
{
ShowErrorMessage(message);
}
}
public void Error(string message, Exception exception)
{
Error(message);
Error(exception);
}
private void ShowErrorMessage(string message)
{
txtLog.SelectionStart = txtLog.TextLength;
txtLog.SelectionLength = 0;
txtLog.SelectionColor = Color.Red;
txtLog.AppendText(message);
txtLog.SelectionColor = txtLog.ForeColor;
//将光标位置设置到当前内容的末尾
txtLog.SelectionStart = txtLog.Text.Length;
//滚动到光标位置
txtLog.ScrollToCaret();
}
public void Debug(string message)
{
if (!isDebuger)
{
return;
}
message = string.Format("[调试] [{0}] {1} {2}", DateTime.Now.ToString("HH:mm:ss"), message, Environment.NewLine);
if (txtLog.InvokeRequired)
{
txtLog.Invoke(new Action<String>(ShowDebugMessage), new object[] { message });
}
else
{
ShowDebugMessage(message);
}
}
private void ShowDebugMessage(string message)
{
txtLog.SelectionStart = txtLog.TextLength;
txtLog.SelectionLength = 0;
txtLog.SelectionColor = Color.Blue;
txtLog.AppendText(message);
txtLog.SelectionColor = txtLog.ForeColor;
//将光标位置设置到当前内容的末尾
txtLog.SelectionStart = txtLog.Text.Length;
//滚动到光标位置
txtLog.ScrollToCaret();
}
#endregion
#region 签到
private void 签到ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (dgv_user.SelectedRows == null || dgv_user.SelectedRows.Count <= 0)
{
UILogUtils.Error("请选择要签到的账号。");
return;
}
var iqiyiAccounts = new List<IqiyiAccount>();
foreach (DataGridViewRow row in dgv_user.SelectedRows)
{
IqiyiAccount iqiyiAccount = row.DataBoundItem as IqiyiAccount;
iqiyiAccounts.Add(iqiyiAccount);
}
AccountSignIn(iqiyiAccounts);
}
catch (Exception ex)
{
UILogUtils.Error(ex);
}
}
public void AccountSignIn(List<IqiyiAccount> iqiyiAccounts)
{
if (IsLoading)
{
return;
}
IsLoading = true;
StartTime = DateUtils.GetTimeStampOfMilliseconds();
SelectNum = iqiyiAccounts.Count;
ImplementNum = 0;
SuccessNum = 0;
ErrorNum = 0;
WaitNum = iqiyiAccounts.Count;
setStatusStripNum();
_cancellationTokenSource?.Cancel();
_cancellationTokenSource = new CancellationTokenSource();
CancellationToken cancellationToken = _cancellationTokenSource.Token;
String fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","签到", DateTime.Now.ToString("yyyyMMdd"));
String fileNamePrefixSuccess = "签到成功-" + DateTime.Now.ToString("HHmmss") + ".txt";
String fileNamePrefixError = "签到失败-" + DateTime.Now.ToString("HHmmss") + ".txt";
foreach (var iqiyiAccount in iqiyiAccounts)
{
Task.Factory.StartNew(() =>
{
string filePath = "";
string fileText = $"{iqiyiAccount.MobileNo}----{iqiyiAccount.Password}----{iqiyiAccount.Cookie}";
if (User.UserDoSign(iqiyiAccount))
{
iqiyiAccount.SignStatus = 1;
iqiyiAccount.SignStatusDesc = "签到成功";
Interlocked.Increment(ref SuccessNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixSuccess);
}
else
{
iqiyiAccount.SignStatus = 2;
iqiyiAccount.SignStatusDesc = "签到错误";
Interlocked.Increment(ref ErrorNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixError);
}
setStatusStripNum();
FileUtils.AppendAllText(filePath, fileText , Encoding.UTF8);
}, cancellationToken);
}
}
#endregion
#region 查询观影豆
private void 查询观影豆ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (dgv_user.SelectedRows == null || dgv_user.SelectedRows.Count <= 0)
{
UILogUtils.Error("请选择要查询的账号。");
return;
}
var iqiyiAccounts = new List<IqiyiAccount>();
foreach (DataGridViewRow row in dgv_user.SelectedRows)
{
IqiyiAccount iqiyiAccount = row.DataBoundItem as IqiyiAccount;
iqiyiAccounts.Add(iqiyiAccount);
}
queryMovieBean(iqiyiAccounts);
}
catch (Exception ex)
{
UILogUtils.Error(ex);
}
}
public void queryMovieBean(List<IqiyiAccount> iqiyiAccounts)
{
if (IsLoading)
{
return;
}
IsLoading = true;
StartTime = DateUtils.GetTimeStampOfMilliseconds();
SelectNum = iqiyiAccounts.Count;
ImplementNum = 0;
SuccessNum = 0;
ErrorNum = 0;
WaitNum = iqiyiAccounts.Count;
setStatusStripNum();
_cancellationTokenSource?.Cancel();
_cancellationTokenSource = new CancellationTokenSource();
CancellationToken cancellationToken = _cancellationTokenSource.Token;
String fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","查询观影豆", DateTime.Now.ToString("yyyyMMdd"));
String fileNamePrefixSuccess = "查询观影豆成功-" + DateTime.Now.ToString("HHmmss") + ".txt";
String fileNamePrefixError = "查询观影豆失败-" + DateTime.Now.ToString("HHmmss") + ".txt";
foreach (var iqiyiAccount in iqiyiAccounts)
{
Task.Factory.StartNew(() =>
{
string filePath = "";
string fileText = $"{iqiyiAccount.MobileNo}----{iqiyiAccount.Password}----{iqiyiAccount.Cookie}";
var iqiyiAccountMovieBean = User.GetMovieBean(iqiyiAccount);
iqiyiAccount.MovieBean = Convert.ToInt32(iqiyiAccountMovieBean);
if (iqiyiAccountMovieBean == "-1")
{
Interlocked.Increment(ref ErrorNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixError);
}
else
{
Interlocked.Increment(ref SuccessNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixSuccess);
}
setStatusStripNum();
FileUtils.AppendAllText(filePath, fileText, Encoding.UTF8);
}, cancellationToken);
}
}
#endregion
private void 查询优惠券ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (dgv_user.SelectedRows == null || dgv_user.SelectedRows.Count <= 0)
{
UILogUtils.Error("请选择要查询的账号。");
return;
}
var iqiyiAccounts = new List<IqiyiAccount>();
foreach (DataGridViewRow row in dgv_user.SelectedRows)
{
IqiyiAccount iqiyiAccount = row.DataBoundItem as IqiyiAccount;
iqiyiAccounts.Add(iqiyiAccount);
}
queryCouponNum(iqiyiAccounts);
}
catch (Exception ex)
{
UILogUtils.Error(ex);
}
}
public void queryCouponNum(List<IqiyiAccount> iqiyiAccounts)
{
if (IsLoading)
{
return;
}
IsLoading = true;
StartTime = DateUtils.GetTimeStampOfMilliseconds();
SelectNum = iqiyiAccounts.Count;
ImplementNum = 0;
SuccessNum = 0;
ErrorNum = 0;
WaitNum = iqiyiAccounts.Count;
setStatusStripNum();
_cancellationTokenSource?.Cancel();
_cancellationTokenSource = new CancellationTokenSource();
CancellationToken cancellationToken = _cancellationTokenSource.Token;
String fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","查询优惠券", DateTime.Now.ToString("yyyyMMdd"));
String fileNamePrefixSuccess = "查询优惠券成功-" + DateTime.Now.ToString("HHmmss") + ".txt";
String fileNamePrefixError = "查询优惠券失败-" + DateTime.Now.ToString("HHmmss") + ".txt";
foreach (var iqiyiAccount in iqiyiAccounts)
{
Task.Factory.StartNew(() =>
{
string filePath = "";
string fileText = $"{iqiyiAccount.MobileNo}----{iqiyiAccount.Password}----{iqiyiAccount.Cookie}";
var iqiyiAccountCouponNum = User.GetCouponList(iqiyiAccount);
iqiyiAccount.CouponNum = Convert.ToInt32(iqiyiAccountCouponNum);
if (iqiyiAccountCouponNum == "-1")
{
Interlocked.Increment(ref ErrorNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixError);
}
else
{
Interlocked.Increment(ref SuccessNum);
Interlocked.Increment(ref ImplementNum);
Interlocked.Decrement(ref WaitNum);
filePath = Path.Combine(fileDirectory, fileNamePrefixSuccess);
}
setStatusStripNum();
FileUtils.AppendAllText(filePath, fileText, Encoding.UTF8);
});
}
}
private void Btn_start_Click(object sender, EventArgs e)
{
if (dgv_user.Rows.Count == 0)
{
UILogUtils.Info("请先导入账号");
return;
}
// 执行签到
if (rb_signIn.Checked)
{
AccountSignIn(IqiyiAccounts);
}
// 执行查询观影豆
else if (rb_movieBean.Checked)
{
queryMovieBean(IqiyiAccounts);
}
// 执行查询优惠券
else if (rb_coupon.Checked)
{
queryCouponNum(IqiyiAccounts);
}
}
private void Button1_Click(object sender, EventArgs e)
{
try
{
_cancellationTokenSource?.Cancel();
}
catch (Exception ex)
{
UILogUtils.Error(ex.ToString());
}
IsLoading = false;
}
private void 复制账号ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (dgv_user.SelectedRows == null || dgv_user.SelectedRows.Count <= 0)
{
UILogUtils.Error("请选择要查询的账号。");
return;
}
var iqiyiAccounts = new List<IqiyiAccount>();
foreach (DataGridViewRow row in dgv_user.SelectedRows)
{
IqiyiAccount iqiyiAccount = row.DataBoundItem as IqiyiAccount;
iqiyiAccounts.Add(iqiyiAccount);
}
copyAccountInfo(iqiyiAccounts);
}
catch (Exception ex)
{
UILogUtils.Error(ex);
}
}
private void copyAccountInfo(List<IqiyiAccount> iqiyiAccounts)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (var iqiyiAccount in iqiyiAccounts)
{
stringBuilder.AppendLine($"{iqiyiAccount.MobileNo}----{iqiyiAccount.Password}----{iqiyiAccount.Cookie}");
}
Clipboard.SetText(stringBuilder.ToString());
UILogUtils.Info("复制账号成功。");
}
private void 导出账号ToolStripMenuItem_Click(object sender, EventArgs e)
{
if(dgv_user.Rows.Count == 0)
{
UILogUtils.Info($"请先导入账号");
return;
}
var iqiyiAccounts = new List<IqiyiAccount>();
foreach(DataGridViewRow row in dgv_user.Rows)
{
IqiyiAccount iqiyiAccount = row.DataBoundItem as IqiyiAccount;
iqiyiAccounts.Add(iqiyiAccount);
}
copyAccountInfo(iqiyiAccounts);
}
private void 清空账号ToolStripMenuItem_Click(object sender, EventArgs e)
{
dgv_user.DataSource = null;
}
private void 删除ToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
if (dgv_user.SelectedRows == null || dgv_user.SelectedRows.Count <= 0)
{
UILogUtils.Error("请选择要删除的账号。");
return;
}
IList list = (IList)dgv_user.DataSource;
foreach (DataGridViewRow row in dgv_user.SelectedRows)
{
list.RemoveAt(row.Index);//移除
}
dgv_user.DataSource = null; //为空
dgv_user.DataSource = list; //显示数据
UILogUtils.Info("删除账号成功。");
}
catch (Exception ex)
{
UILogUtils.Error(ex);
}
}
private void Button2_Click(object sender, EventArgs e)
{
try
{
String fileDirectory = "";
if (rb_signIn.Checked)
{
fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "签到", DateTime.Now.ToString("yyyyMMdd"));
}
else if (rb_movieBean.Checked)
{
fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志", "查询观影豆", DateTime.Now.ToString("yyyyMMdd"));
}
else if (rb_coupon.Checked)
{
fileDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "日志","查询优惠券", DateTime.Now.ToString("yyyyMMdd"));
}
if (!Directory.Exists(fileDirectory))
{
UILogUtils.Error("文件夹不存在。" + fileDirectory);
return;
}
System.Diagnostics.Process.Start("explorer.exe", fileDirectory);
}
catch (Exception ex)
{
UILogUtils.Error(ex.ToString());
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="MobileNo.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Password.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Cookie.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="SignStatusDesc.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MovieBean.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="CouponNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cms_user.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>123, 17</value>
</metadata>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Model
{
/// <summary>
/// 爱奇艺票务账号信息
/// </summary>
public class IqiyiAccount
{
/// <summary>
/// 手机号
/// </summary>
public string MobileNo { get; set; }
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; }
/// <summary>
/// Cookie
/// </summary>
public string Cookie { get; set; }
/// <summary>
/// 签到状态
/// 0: 未知 1: 已签到 2: 出错
/// </summary>
public int SignStatus { get; set; }
/// <summary>
/// 签到状态文本
/// </summary>
public string SignStatusDesc { get; set; }
/// <summary>
/// 观影豆
/// </summary>
public int MovieBean { get; set; }
/// <summary>
/// 优惠券数
/// </summary>
public int CouponNum { get; set; }
/// <summary>
/// 优惠券列表
/// </summary>
public Array CouponList { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace iqiyiWin
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Main());
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("iqiyiWin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("iqiyiWin")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 会使此程序集中的类型
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("8865cee3-3a28-4333-a8c8-023e1ed89212")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace iqiyiWin.Properties
{
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("iqiyiWin.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 覆盖当前线程的 CurrentUICulture 属性
/// 使用此强类型的资源类的资源查找。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace iqiyiWin.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace iqiyiWin.Response.User.CouponList
{
public class CouponListResponse
{
/// <summary>
/// Examples: {"valid":[{"jumpType":"giftpackets","displaySubName":"","disCount":300.0,"availableTips":"有效期至 2021.04.24","jumpParam":"","tipTags":["限购超值礼包","不可叠加"],"displayName":"超值礼包抵扣券(新人专享)","isGiftPackage":false,"disCountStr":"3","withPriceChange":false,"showUse":true,"bossTicket":"221B-GZWW-ZBFN-U3R4-GRGJ","displaySubType":"限购超值礼包","couponType":1,"giftPackageH5Url":"https://app.iqiyi.com/ext/common/qipiao/libao_goumai/app.html?channel=piaoh5_lbkq","withPriceChangeTip":"不可叠加","desc":"仅限爱奇艺票务APP使用;\r\n仅限购买超值礼包产品抵扣使用。"}],"invalid":[{"reason":"已使用","displaySubName":"满50元可用","disCount":800.0,"availableTips":"有效期至 2021.03.01","tipTags":["限购电影票","满50元可用","不可叠加"],"displayName":"8元电影优惠券","isGiftPackage":false,"disCountStr":"8","withPriceChange":false,"showUse":false,"bossTicket":"4ZWH-NXVR-MBFS-T3X6-NG6U","displaySubType":"限购电影票","invalidReasonType":1,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满50元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.13","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"426A-Z7G8-CBFX-7K35-EYBK","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满28元可用","disCount":500.0,"availableTips":"有效期至 2021.02.08","tipTags":["限购电影票","满28元可用","不可叠加"],"displayName":"电影票代金券(新人专享)","isGiftPackage":false,"disCountStr":"5","withPriceChange":false,"showUse":false,"bossTicket":"323R-CVE2-BBFN-U3R4-V38D","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"仅限爱奇艺票务APP内使用;\r\n单笔订单满28元可用,可与改价优惠活动叠加使用,支持的影院以实际可用为准;"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.07","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"226A-ZFE3-RBFT-LMB3-X71K","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.03","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"426A-ZCS7-5BFQ-SYTL-RDFF","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.02","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"426A-ZLYA-8BFQ-7VBF-S4FP","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.01","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"323S-T4C9-8BFP-EQRI-XFAV","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.01.31","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"226A-Z4WM-MBFP-41CA-DJY5","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.01.31","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"523S-T4LK-8BFN-UAKP-TTDC","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"}]}
/// </summary>
[JsonProperty("data")]
public Data Data { get; set; }
/// <summary>
/// Examples: "20210223185905"
/// </summary>
[JsonProperty("timestamp")]
public string Timestamp { get; set; }
/// <summary>
/// Examples: "A00000"
/// </summary>
[JsonProperty("code")]
public string Code { get; set; }
/// <summary>
/// Examples: "1311325e-3873-48d4-81bd-c0db55ed5538"
/// </summary>
[JsonProperty("requestId")]
public string RequestId { get; set; }
/// <summary>
/// Examples: ""
/// </summary>
[JsonProperty("msg")]
public string Msg { get; set; }
/// <summary>
/// Examples: false
/// </summary>
[JsonProperty("hasNext")]
public bool HasNext { get; set; }
}
public class Data
{
/// <summary>
/// Examples: [{"jumpType":"giftpackets","displaySubName":"","disCount":300.0,"availableTips":"有效期至 2021.04.24","jumpParam":"","tipTags":["限购超值礼包","不可叠加"],"displayName":"超值礼包抵扣券(新人专享)","isGiftPackage":false,"disCountStr":"3","withPriceChange":false,"showUse":true,"bossTicket":"221B-GZWW-ZBFN-U3R4-GRGJ","displaySubType":"限购超值礼包","couponType":1,"giftPackageH5Url":"https://app.iqiyi.com/ext/common/qipiao/libao_goumai/app.html?channel=piaoh5_lbkq","withPriceChangeTip":"不可叠加","desc":"仅限爱奇艺票务APP使用;\r\n仅限购买超值礼包产品抵扣使用。"}]
/// </summary>
[JsonProperty("valid")]
public IList<Valid> Valid { get; set; }
/// <summary>
/// Examples: [{"reason":"已使用","displaySubName":"满50元可用","disCount":800.0,"availableTips":"有效期至 2021.03.01","tipTags":["限购电影票","满50元可用","不可叠加"],"displayName":"8元电影优惠券","isGiftPackage":false,"disCountStr":"8","withPriceChange":false,"showUse":false,"bossTicket":"4ZWH-NXVR-MBFS-T3X6-NG6U","displaySubType":"限购电影票","invalidReasonType":1,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满50元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.13","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"426A-Z7G8-CBFX-7K35-EYBK","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满28元可用","disCount":500.0,"availableTips":"有效期至 2021.02.08","tipTags":["限购电影票","满28元可用","不可叠加"],"displayName":"电影票代金券(新人专享)","isGiftPackage":false,"disCountStr":"5","withPriceChange":false,"showUse":false,"bossTicket":"323R-CVE2-BBFN-U3R4-V38D","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"仅限爱奇艺票务APP内使用;\r\n单笔订单满28元可用,可与改价优惠活动叠加使用,支持的影院以实际可用为准;"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.07","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"226A-ZFE3-RBFT-LMB3-X71K","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.03","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"426A-ZCS7-5BFQ-SYTL-RDFF","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.02","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"426A-ZLYA-8BFQ-7VBF-S4FP","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.02.01","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"323S-T4C9-8BFP-EQRI-XFAV","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.01.31","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"签到奖品-电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"226A-Z4WM-MBFP-41CA-DJY5","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"},{"reason":"已过期","displaySubName":"满35元可用","disCount":200.0,"availableTips":"有效期至 2021.01.31","tipTags":["限购电影票","满35元可用","不可叠加"],"displayName":"电影票代金券","isGiftPackage":false,"disCountStr":"2","withPriceChange":false,"showUse":false,"bossTicket":"523S-T4LK-8BFN-UAKP-TTDC","displaySubType":"限购电影票","invalidReasonType":2,"couponType":1,"withPriceChangeTip":"不可叠加","desc":"单笔订单满35元可用;\r\n不可与其他优惠同享。"}]
/// </summary>
[JsonProperty("invalid")]
public IList<Invalid> Invalid { get; set; }
}
public class Invalid
{
/// <summary>
/// Examples: "已使用", "已过期"
/// </summary>
[JsonProperty("reason")]
public string Reason { get; set; }
/// <summary>
/// Examples: "满50元可用", "满35元可用", "满28元可用"
/// </summary>
[JsonProperty("displaySubName")]
public string DisplaySubName { get; set; }
/// <summary>
/// Examples: 800.0, 200.0, 500.0
/// </summary>
[JsonProperty("disCount")]
public double DisCount { get; set; }
/// <summary>
/// Examples: "有效期至 2021.03.01", "有效期至 2021.02.13", "有效期至 2021.02.08", "有效期至 2021.02.07", "有效期至 2021.02.03"
/// </summary>
[JsonProperty("availableTips")]
public string AvailableTips { get; set; }
/// <summary>
/// Examples: ["限购电影票","满50元可用","不可叠加"], ["限购电影票","满35元可用","不可叠加"], ["限购电影票","满28元可用","不可叠加"], ["限购电影票","满35元可用","不可叠加"], ["限购电影票","满35元可用","不可叠加"]
/// </summary>
[JsonProperty("tipTags")]
public IList<string> TipTags { get; set; }
/// <summary>
/// Examples: "8元电影优惠券", "签到奖品-电影票代金券", "电影票代金券(新人专享)", "电影票代金券"
/// </summary>
[JsonProperty("displayName")]
public string DisplayName { get; set; }
/// <summary>
/// Examples: false
/// </summary>
[JsonProperty("isGiftPackage")]
public bool IsGiftPackage { get; set; }
/// <summary>
/// Examples: "8", "2", "5"
/// </summary>
[JsonProperty("disCountStr")]
public string DisCountStr { get; set; }
/// <summary>
/// Examples: false
/// </summary>
[JsonProperty("withPriceChange")]
public bool WithPriceChange { get; set; }
/// <summary>
/// Examples: false
/// </summary>
[JsonProperty("showUse")]
public bool ShowUse { get; set; }
/// <summary>
/// Examples: "4ZWH-NXVR-MBFS-T3X6-NG6U", "426A-Z7G8-CBFX-7K35-EYBK", "323R-CVE2-BBFN-U3R4-V38D", "226A-ZFE3-RBFT-LMB3-X71K", "426A-ZCS7-5BFQ-SYTL-RDFF"
/// </summary>
[JsonProperty("bossTicket")]
public string BossTicket { get; set; }
/// <summary>
/// Examples: "限购电影票"
/// </summary>
[JsonProperty("displaySubType")]
public string DisplaySubType { get; set; }
/// <summary>
/// Examples: 1, 2
/// </summary>
[JsonProperty("invalidReasonType")]
public int InvalidReasonType { get; set; }
/// <summary>
/// Examples: 1
/// </summary>
[JsonProperty("couponType")]
public int CouponType { get; set; }
/// <summary>
/// Examples: "不可叠加"
/// </summary>
[JsonProperty("withPriceChangeTip")]
public string WithPriceChangeTip { get; set; }
/// <summary>
/// Examples: "单笔订单满50元可用;\r\n不可与其他优惠同享。", "单笔订单满35元可用;\r\n不可与其他优惠同享。", "仅限爱奇艺票务APP内使用;\r\n单笔订单满28元可用,可与改价优惠活动叠加使用,支持的影院以实际可用为准;"
/// </summary>
[JsonProperty("desc")]
public string Desc { get; set; }
}
public class Valid
{
/// <summary>
/// Examples: "giftpackets"
/// </summary>
[JsonProperty("jumpType")]
public string JumpType { get; set; }
/// <summary>
/// Examples: ""
/// </summary>
[JsonProperty("displaySubName")]
public string DisplaySubName { get; set; }
/// <summary>
/// Examples: 300.0
/// </summary>
[JsonProperty("disCount")]
public double DisCount { get; set; }
/// <summary>
/// Examples: "有效期至 2021.04.24"
/// </summary>
[JsonProperty("availableTips")]
public string AvailableTips { get; set; }
/// <summary>
/// Examples: ""
/// </summary>
[JsonProperty("jumpParam")]
public string JumpParam { get; set; }
/// <summary>
/// Examples: ["限购超值礼包","不可叠加"]
/// </summary>
[JsonProperty("tipTags")]
public IList<string> TipTags { get; set; }
/// <summary>
/// Examples: "超值礼包抵扣券(新人专享)"
/// </summary>
[JsonProperty("displayName")]
public string DisplayName { get; set; }
/// <summary>
/// Examples: false
/// </summary>
[JsonProperty("isGiftPackage")]
public bool IsGiftPackage { get; set; }
/// <summary>
/// Examples: "3"
/// </summary>
[JsonProperty("disCountStr")]
public string DisCountStr { get; set; }
/// <summary>
/// Examples: false
/// </summary>
[JsonProperty("withPriceChange")]
public bool WithPriceChange { get; set; }
/// <summary>
/// Examples: true
/// </summary>
[JsonProperty("showUse")]
public bool ShowUse { get; set; }
/// <summary>
/// Examples: "221B-GZWW-ZBFN-U3R4-GRGJ"
/// </summary>
[JsonProperty("bossTicket")]
public string BossTicket { get; set; }
/// <summary>
/// Examples: "限购超值礼包"
/// </summary>
[JsonProperty("displaySubType")]
public string DisplaySubType { get; set; }
/// <summary>
/// Examples: 1
/// </summary>
[JsonProperty("couponType")]
public int CouponType { 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>
[JsonProperty("withPriceChangeTip")]
public string WithPriceChangeTip { get; set; }
/// <summary>
/// Examples: "仅限爱奇艺票务APP使用;\r\n仅限购买超值礼包产品抵扣使用。"
/// </summary>
[JsonProperty("desc")]
public string Desc { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace iqiyiWin.Response.User.MovieBean
{
public class MovieBeanResponse
{/// <summary>
/// Examples: 状态码
/// </summary>
[JsonProperty("code")]
public string Code { get; set; }
/// <summary>
/// Examples: 时间戳
/// </summary>
[JsonProperty("timeStamp")]
public string TimeStamp { get; set; }
/// <summary>
/// Examples: 消息
/// </summary>
[JsonProperty("msg")]
public string Msg { get; set; }
/// <summary>
/// Examples: {"records":[{"date":"2021-02-22 17:36","count":25.0,"entityId":0,"title":"完成新手任务: 首次体验在线选座"},{"date":"2021-02-22 17:03","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-02-22 11:32","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-02-21 20:01","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-02-20 20:33","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-02-19 12:50","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-02-18 23:10","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-02-17 18:19","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-02-16 12:09","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-02-15 18:50","count":75.0,"entityId":3409592097,"title":"购买电影《熊出没·狂野大陆》"},{"date":"2021-02-15 15:34","count":-200.0,"entityId":3409592097,"title":"购票抵现金-订单号3409592097"},{"date":"2021-02-15 15:34","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-02-14 10:24","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-02-13 22:29","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-02-12 18:26","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-02-11 11:06","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-02-10 00:20","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-02-09 00:21","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-02-09 00:03","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-02-07 10:28","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-02-06 00:21","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-02-05 00:20","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-02-04 02:23","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-02-03 00:24","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-02-02 01:08","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-02-02 00:33","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-02-01 09:56","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-01-31 10:24","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-01-30 16:22","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-01-29 10:22","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-01-28 21:47","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-01-28 15:18","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-01-27 11:07","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-01-26 10:10","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-01-26 00:10","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-01-25 10:10","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-01-24 13:08","count":1.0,"entityId":0,"title":"签到"}],"balanceCount":395.0,"linkUrl":"qyticket://qymweb?needLogin=1&url=https%3A%2F%2Fact.iqiyi.com%2Fact%2Fpages%2Fnewbie_task%2Fapp.html"}
/// </summary>
[JsonProperty("data")]
public Data Data { get; set; }
}
public class Data
{
/// <summary>
/// Examples: [{"date":"2021-02-22 17:36","count":25.0,"entityId":0,"title":"完成新手任务: 首次体验在线选座"},{"date":"2021-02-22 17:03","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-02-22 11:32","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-02-21 20:01","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-02-20 20:33","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-02-19 12:50","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-02-18 23:10","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-02-17 18:19","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-02-16 12:09","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-02-15 18:50","count":75.0,"entityId":3409592097,"title":"购买电影《熊出没·狂野大陆》"},{"date":"2021-02-15 15:34","count":-200.0,"entityId":3409592097,"title":"购票抵现金-订单号3409592097"},{"date":"2021-02-15 15:34","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-02-14 10:24","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-02-13 22:29","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-02-12 18:26","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-02-11 11:06","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-02-10 00:20","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-02-09 00:21","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-02-09 00:03","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-02-07 10:28","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-02-06 00:21","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-02-05 00:20","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-02-04 02:23","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-02-03 00:24","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-02-02 01:08","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-02-02 00:33","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-02-01 09:56","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-01-31 10:24","count":1.0,"entityId":0,"title":"签到"},{"date":"2021-01-30 16:22","count":100.0,"entityId":0,"title":"签到"},{"date":"2021-01-29 10:22","count":6.0,"entityId":0,"title":"签到"},{"date":"2021-01-28 21:47","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-01-28 15:18","count":5.0,"entityId":0,"title":"签到"},{"date":"2021-01-27 11:07","count":4.0,"entityId":0,"title":"签到"},{"date":"2021-01-26 10:10","count":3.0,"entityId":0,"title":"签到"},{"date":"2021-01-26 00:10","count":2.0,"entityId":0,"title":"幸运抽奖奖品 +2观影豆"},{"date":"2021-01-25 10:10","count":2.0,"entityId":0,"title":"签到"},{"date":"2021-01-24 13:08","count":1.0,"entityId":0,"title":"签到"}]
/// </summary>
[JsonProperty("records")]
public IList<Record> Records { get; set; }
/// <summary>
/// Examples: 395.0
/// </summary>
[JsonProperty("balanceCount")]
public double BalanceCount { get; set; }
/// <summary>
/// Examples: "qyticket://qymweb?needLogin=1&url=https%3A%2F%2Fact.iqiyi.com%2Fact%2Fpages%2Fnewbie_task%2Fapp.html"
/// </summary>
[JsonProperty("linkUrl")]
public string LinkUrl { get; set; }
}
public class Record
{
/// <summary>
/// Examples: "2021-02-22 17:36", "2021-02-22 17:03", "2021-02-22 11:32", "2021-02-21 20:01", "2021-02-20 20:33"
/// </summary>
[JsonProperty("date")]
public string Date { get; set; }
/// <summary>
/// Examples: 25.0, 2.0, 100.0, 6.0, 5.0
/// </summary>
[JsonProperty("count")]
public double Count { get; set; }
/// <summary>
/// Examples: 0, 3409592097
/// </summary>
[JsonProperty("entityId")]
public object EntityId { get; set; }
/// <summary>
/// Examples: "完成新手任务: 首次体验在线选座", "幸运抽奖奖品 +2观影豆", "签到", "购买电影《熊出没·狂野大陆》", "购票抵现金-订单号3409592097"
/// </summary>
[JsonProperty("title")]
public string Title { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace iqiyiWin.Response.User.SignIn
{
public class SignInResponse
{
/// <summary>
/// Examples: "A00000"
/// </summary>
[JsonProperty("code")]
public string Code { get; set; }
/// <summary>
/// Examples: {"lotteryUrl":"https://act.iqiyi.com/act/pages/huodong_choujiang/app.html","balanceCount":1}
/// </summary>
[JsonProperty("data")]
public Data Data { get; set; }
}
public class Data
{
/// <summary>
/// Examples: "https://act.iqiyi.com/act/pages/huodong_choujiang/app.html"
/// </summary>
[JsonProperty("lotteryUrl")]
public string LotteryUrl { get; set; }
/// <summary>
/// Examples: 1
/// </summary>
[JsonProperty("balanceCount")]
public int BalanceCount { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
class DateUtils
{
/// <summary>
/// 获取当前毫秒时间戳
/// </summary>
/// <returns></returns>
public static long GetTimeStampOfMilliseconds()
{
TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
return Convert.ToInt64(ts.TotalMilliseconds);
}
public static DateTime GetDateTime(long timeStamp)
{
DateTime time = new DateTime();
try
{
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeStamp + "0000000");
TimeSpan toNow = new TimeSpan(lTime);
time = dtStart.Add(toNow);
}
catch
{
time = DateTime.Now.AddDays(-30);
}
return time;
}
/// <summary>
/// 将Unix时间戳转为C#时间格式
/// </summary>
/// <param name="timeSpan"></param>
/// <returns></returns>
public static DateTime GetDateTimeFromUnix(long timeSpan)
{
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
long lTime = long.Parse(timeSpan + "0000");
TimeSpan toNow = new TimeSpan(lTime);
return dtStart.Add(toNow);
}
}
}
\ No newline at end of file
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class FileUtils
{
private static ConcurrentDictionary<string, object> ConcurrentDictionary = new ConcurrentDictionary<string, object>();
public static void AppendAllText(String path, String contents)
{
var syncObj = ConcurrentDictionary.GetOrAdd(path, new Object());
lock (syncObj)
{
FileInfo file = new FileInfo(path);
if (!Directory.Exists(file.DirectoryName))
{
Directory.CreateDirectory(file.DirectoryName);
}
File.AppendAllText(path, contents);
}
}
public static void AppendAllText(String path, String contents, Encoding encoding)
{
var syncObj = ConcurrentDictionary.GetOrAdd(path, new Object());
lock (syncObj)
{
FileInfo file = new FileInfo(path);
if (!Directory.Exists(file.DirectoryName))
{
Directory.CreateDirectory(file.DirectoryName);
}
File.AppendAllText(path, contents, encoding);
}
}
public static void AppendAllLines(String path, IEnumerable<string> contents)
{
var syncObj = ConcurrentDictionary.GetOrAdd(path, new Object());
lock (syncObj)
{
FileInfo file = new FileInfo(path);
if (!Directory.Exists(file.DirectoryName))
{
Directory.CreateDirectory(file.DirectoryName);
}
File.AppendAllLines(path, contents);
}
}
public static void AppendAllLines(String path, IEnumerable<string> contents, Encoding encoding)
{
var syncObj = ConcurrentDictionary.GetOrAdd(path, new Object());
lock (syncObj)
{
FileInfo file = new FileInfo(path);
if (!Directory.Exists(file.DirectoryName))
{
Directory.CreateDirectory(file.DirectoryName);
}
File.AppendAllLines(path, contents, encoding);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class HttpResult
{
/// <summary>
/// Body
/// </summary>
public string Body { get; set; }
/// <summary>
/// Headers
/// </summary>
public WebHeaderCollection Headers { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class HttpUtils
{
/// <summary>
/// GET
/// </summary>
/// <param name="url">url</param>
/// <param name="timeout">请求超时前等待的毫秒数。</param>
/// <returns>response</returns>
public static string DoGet(string url, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Timeout = timeout;
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
return result;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
/// <summary>
/// GET
/// </summary>
/// <param name="url">url</param>
/// <param name="timeout">请求超时前等待的毫秒数。</param>
/// <returns>response</returns>
public static HttpResult DoGetResult(string url, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Timeout = timeout;
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
HttpResult httpResult = new HttpResult()
{
Body = result,
Headers = response.Headers
};
return httpResult;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
/// <summary>
/// GET
/// </summary>
/// <param name="url">url</param>
/// <param name="timeout">请求超时前等待的毫秒数。</param>
/// <returns>response</returns>
public static string DoGet(CookieContainer cookieContainer, string url, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Referer = "https://movie.iqiyi.com/";
request.Method = "GET";
request.Timeout = timeout;
request.CookieContainer = cookieContainer;
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
return result;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
public static string DoGet(CookieContainer cookieContainer, string referer, string url, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Referer = referer;
request.Method = "GET";
request.Timeout = timeout;
request.CookieContainer = cookieContainer;
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
return result;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
public static string DoPost(string url, string data, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = JsonUtils.IsJsonData(data) ? "application/json" : "application/x-www-form-urlencoded";
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
if (!string.IsNullOrEmpty(data))
{
Stream requestStream = request.GetRequestStream();
byte[] bytes = Encoding.UTF8.GetBytes(data);
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
return result;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
public static HttpResult DoPostResult(string url, string data, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = JsonUtils.IsJsonData(data) ? "application/json" : "application/x-www-form-urlencoded";
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
if (!string.IsNullOrEmpty(data))
{
Stream requestStream = request.GetRequestStream();
byte[] bytes = Encoding.UTF8.GetBytes(data);
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
HttpResult httpResult = new HttpResult()
{
Body = result,
Headers = response.Headers
};
return httpResult;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
public static string DoPost(CookieContainer cookieContainer, string url, string data, IDictionary<string, string> headers, int timeout = 10000)
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "POST";
request.ContentType = JsonUtils.IsJsonData(data) ? "application/json" : "application/x-www-form-urlencoded";
request.CookieContainer = cookieContainer;
if (headers != null)
{
foreach (var header in headers)
{
if (header.Key.Equals("User-Agent"))
{
request.UserAgent = header.Value;
continue;
}
request.Headers.Add(header.Key, header.Value);
}
}
if (!string.IsNullOrEmpty(data))
{
Stream requestStream = request.GetRequestStream();
byte[] bytes = Encoding.UTF8.GetBytes(data);
requestStream.Write(bytes, 0, bytes.Length);
requestStream.Close();
}
Stream responseStream = null;
StreamReader streamReader = null;
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
responseStream = response.GetResponseStream();
streamReader = new StreamReader(responseStream, Encoding.UTF8);
string result = streamReader.ReadToEnd();
return result;
}
finally
{
streamReader?.Close();
responseStream?.Close();
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public interface IUILog
{
void Info(String message);
void Debug(String message);
void Error(String message);
void Error(Exception exception);
void Error(String message, Exception exception);
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class IqiyiSign
{
public static string Sign(SortedDictionary<string,string> data)
{
var encryptionBeforeText = "";
var encryptionAfterText = "";
var appsecret = "";
foreach (KeyValuePair<string, string> item in data)
{
encryptionBeforeText += item.Key + item.Value;
}
if(data["appid"] == "10012")
{
appsecret = "e72c3bf9";
}
encryptionBeforeText = appsecret + encryptionBeforeText.ToUpper() + appsecret;
encryptionAfterText = Sha1.Sha1Signature(encryptionBeforeText).ToLower();
UILogUtils.Debug("加密前参数:" + encryptionBeforeText);
UILogUtils.Debug("加密后参数:" + encryptionAfterText);
return encryptionAfterText;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class JsonUtils
{
/// <summary>
/// 是否json数据
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public static bool IsJsonData(string data)
{
if (string.IsNullOrWhiteSpace(data))
{
return false;
}
return (data.StartsWith("[") && data.EndsWith("]"))
|| (data.StartsWith("{") && data.EndsWith("}"));
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class Sha1
{
public static string Sha1Signature(string str)
{
var buffer = Encoding.UTF8.GetBytes(str);
var data = SHA1.Create().ComputeHash(buffer);
StringBuilder sub = new StringBuilder();
foreach (var t in data)
{
sub.Append(t.ToString("X2"));
}
return sub.ToString();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace iqiyiWin.Util
{
public class UILogUtils
{
private static readonly List<IUILog> UI_LOGS = new List<IUILog>();
public static void Add(IUILog uILog)
{
UI_LOGS.Add(uILog);
}
public static void Debug(String message)
{
foreach (IUILog log in UI_LOGS)
{
log.Debug(message);
}
}
public static void Info(String message)
{
foreach (IUILog log in UI_LOGS)
{
log.Info(message);
}
}
public static void Error(String message)
{
foreach (IUILog log in UI_LOGS)
{
log.Error(message);
}
}
public static void Error(Exception exception)
{
foreach (IUILog log in UI_LOGS)
{
log.Error(exception);
}
}
public static void Error(String message, Exception exception)
{
foreach (IUILog log in UI_LOGS)
{
log.Error(message, exception);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using Newtonsoft.Json;
namespace iqiyiWin.Util
{
public class UrlUtils
{
public static string BuildQueryStringUrl(IDictionary<string,string> data)
{
var resultList = new List<string>();
foreach (KeyValuePair<string, string> item in data)
{
resultList.Add(item.Key + "=" + item.Value);
}
return "?" + string.Join("&", resultList.ToArray());
}
public static string BuildQueryStringUrl(object obj)
{
var objJson = JsonConvert.SerializeObject(obj);
var keyValuePairs = JsonConvert.DeserializeObject<IDictionary<string, Object>>(objJson);
return BuildQueryStringUrl(keyValuePairs);
}
public static string BuildQueryStringUrl(Dictionary<string, Object> keyValuePairs)
{
if (keyValuePairs == null || keyValuePairs.Count <= 0)
{
return null;
}
StringBuilder stringBuilder = new StringBuilder();
foreach (KeyValuePair<string, Object> keyValue in keyValuePairs)
{
if (keyValue.Value != null)
{
if (keyValue.Value is bool)
{
stringBuilder.Append($"{keyValue.Key}=" + (((bool)(keyValue.Value)) ? "true" : "false") + "&");
}
else
{
stringBuilder.Append($"{keyValue.Key}={HttpUtility.UrlEncode(keyValue.Value.ToString())}&");
}
}
else
{
stringBuilder.Append($"{keyValue.Key}=&");
}
}
return stringBuilder.ToString();
}
/// <summary>
/// 解析url参数
/// </summary>
/// <param name="url"></param>
/// <returns></returns>
public static Dictionary<String, String> ParseUrlParams(String url)
{
Dictionary<String, String> result = new Dictionary<string, string>();
if (string.IsNullOrWhiteSpace(url))
{
return result;
}
int index = url.IndexOf('?');
if (index < 0)
{
return result;
}
String paramString = url.Substring(index + 1);
var paramList = paramString.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries).ToList();
if (paramList.Count <= 0)
{
return result;
}
foreach (String param in paramList)
{
var paramItemArray = param.Split(new char[] { '=' }, StringSplitOptions.RemoveEmptyEntries);
if (paramItemArray.Length <= 0)
{
continue;
}
result.Add(paramItemArray[0], paramItemArray.Length > 1 ? paramItemArray[1] : null);
}
return result;
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8865CEE3-3A28-4333-A8C8-023E1ED89212}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>iqiyiWin</RootNamespace>
<AssemblyName>iqiyiWin</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Api\Domain.cs" />
<Compile Include="Api\User.cs" />
<Compile Include="Constant\ApiConstant.cs" />
<Compile Include="Constant\IqiyiVersion.cs" />
<Compile Include="Main.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main.Designer.cs">
<DependentUpon>Main.cs</DependentUpon>
</Compile>
<Compile Include="Model\IqiyiAccount.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Response\User\CouponList\CouponListResponse.cs" />
<Compile Include="Response\User\MovieBean\MovieBeanResponse.cs" />
<Compile Include="Response\User\SignIn\SignInResponse.cs" />
<Compile Include="Util\DateUtils.cs" />
<Compile Include="Util\FileUtils.cs" />
<Compile Include="Util\HttpResult.cs" />
<Compile Include="Util\HttpUtils.cs" />
<Compile Include="Util\IqiyiSign.cs" />
<Compile Include="Util\IUILog.cs" />
<Compile Include="Util\JsonUtils.cs" />
<Compile Include="Util\Sha1.cs" />
<Compile Include="Util\UILogUtils.cs" />
<Compile Include="Util\UrlUtils.cs" />
<EmbeddedResource Include="Main.resx">
<DependentUpon>Main.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net472" />
</packages>
\ No newline at end of file
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