支付宝订单监控
SDK 版
更新: 2023-05-31 15:43:11 字数: 0 字 时长: 0 分钟
基于 Selenium WebDriver 二次封装的 .NET SDK
调用示例
c#
// 引用 SDK
using AlipayDriver;
// 初始化
var response = Bootstrap.Initialize(new DriverOptions { });
if (response.Success)
{
// 初始化成功
}
else
{
// 初始化失败
// response.Message
}
// 获取登录二维码
var service = LoginService.CreateLoginService();
var response = service.Login(new LoginRequest
{
IsReload = true
});
var codeImage = response.QRCode;
// 检查登录状态
var service = LoginService.CreateLoginService();
var response = service.Login(new LoginRequest
{
IsReload = false
});
if(response.Success)
{
// 登录成功
}
// 获取订单
var service = OrderService.CreateOrderService();
var response = service.GetOrderList(new OrderRequest
{
FundFlow = FundFlowConst.All
});
// 销毁
Bootstrap.Destroy();
请求实体
c#
/// <summary>
/// 启动参数
/// </summary>
public sealed class DriverOptions
{
/// <summary>
/// 是否显示Chrome浏览器(默认false)
/// </summary>
public bool Headless { get; set; } = false;
/// <summary>
/// 是否最大化(默认false)
/// </summary>
public bool Maximized { get; set; } = false;
/// <summary>
/// 浏览器启动宽度(默认800,最大化时自动忽略)
/// </summary>
public int DefaultWidth { get; set; } = 800;
/// <summary>
/// 浏览器启动高度(默认600,最大化时自动忽略)
/// </summary>
public int DefaultHeight { get; set; } = 600;
/// <summary>
/// 浏览器UA
/// </summary>
public string UserAgent { get; set; }
/// <summary>
/// 是否设置代理(默认false)
/// </summary>
public bool ProxyServer { get; set; } = false;
/// <summary>
/// 代理:主机/IP(仅支持http)
/// </summary>
public string ProxyHost { get; set; }
/// <summary>
/// 代理:端口号
/// </summary>
public int ProxyPort { get; set; }
/// <summary>
/// 注入脚本
/// </summary>
public string PageScripts { get; set; }
}
/// <summary>
/// 启动结果
/// </summary>
public sealed class DriverResponse
{
/// <summary>
/// 是否启动成功
/// </summary>
public bool Success { get; set; }
/// <summary>
/// 消息提示
/// </summary>
public string Message { get; set; }
}