mirror of
https://git.oceanpay.cc/danial/kami_itunes_june.git
synced 2025-12-18 22:31:24 +00:00
76 lines
1.9 KiB
C#
76 lines
1.9 KiB
C#
using System;
|
|
using System.Net;
|
|
using System.Threading.Tasks;
|
|
using AppleBatch_June.Model;
|
|
using AppleBatch_June.StartTaskModel;
|
|
using DotNet.Utilities;
|
|
|
|
namespace AppleBatch_June.ExecuteTasks
|
|
{
|
|
public class AccountCheckTask : BaseTask
|
|
{
|
|
public static AccountCheckTask Instance { get; private set; }
|
|
|
|
static AccountCheckTask()
|
|
{
|
|
Instance = new AccountCheckTask("账号检测");
|
|
}
|
|
|
|
public AccountCheckTask(string _taskName)
|
|
: base(_taskName)
|
|
{
|
|
}
|
|
|
|
public async void appleAccountCheck(AppleAcount account, Action<string, AppleItunesLogin> action, Action<string, DisplyType, string> _applyAction, bool _OpenVpn)
|
|
{
|
|
base.isRun = true;
|
|
Tuple<string, AppleItunesLogin> tuple = await Task.Run(delegate
|
|
{
|
|
ApiNetReq.startNowFun = 9;
|
|
base.TaskIsRun = true;
|
|
AppleItunesLogin itunesLoginRef = null;
|
|
try
|
|
{
|
|
string msg = "";
|
|
HttpResult isLogin = APIUtlis.getIsLogin(9);
|
|
if (isLogin.StatusCode == HttpStatusCode.OK)
|
|
{
|
|
object obj = Tools.Todejosn<object>(isLogin.Html);
|
|
if (((dynamic)obj)["Code"] == "0000")
|
|
{
|
|
if (((dynamic)obj)["Data"]["integral"] >= AppSysConfig.getTypeById(9).consNum)
|
|
{
|
|
if (new ItunesUtlis(this, account.appleId, _applyAction, _OpenVpn).getAccountStateMsg(account, ref msg, ref itunesLoginRef))
|
|
{
|
|
APIUtlis.ApiApplyAct(9, "Apple账号检测");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
msg = "点数不足,请联系客服充值";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
msg = ((dynamic)obj)["Message"];
|
|
}
|
|
}
|
|
else
|
|
{
|
|
msg = "网络请求失败,请重试";
|
|
}
|
|
return new Tuple<string, AppleItunesLogin>(msg, itunesLoginRef);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
APIUtlis.ApiSeriveError(ex);
|
|
return new Tuple<string, AppleItunesLogin>(ex.Message, itunesLoginRef);
|
|
}
|
|
});
|
|
base.TaskIsRun = false;
|
|
base.isRun = false;
|
|
action?.Invoke(tuple.Item1, tuple.Item2);
|
|
}
|
|
}
|
|
}
|