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";
}
}
This diff is collapsed.
This diff is collapsed.
<?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>
This diff is collapsed.
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; }
}
}
This diff is collapsed.
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