老鹰退款

This commit is contained in:
“wanyongkang”
2021-03-31 16:59:51 +08:00
parent 15b1827da7
commit 5e312acd51

View File

@@ -372,25 +372,34 @@ namespace Hncore.Pass.Vpn.Service
public override async Task<ApiResult> Refund(string account, string packageKey, int days)
{
var client = CreateHttpClient();
var title = GetOpTitle("Refund", account);
Random rd = new Random(Guid.NewGuid().GetHashCode());
int i = rd.Next();
var time_s = DateTime.Now.GetUnixTimeStamp();
var nonce = MD5(time_s.ToString()) + i.ToString();
var sign = MD5(nonce+"admin1123456");
var url = "/api/refundAct.html?username="+account+"&refundReason=api&agentOrigin=admin1&nonce="+nonce+"&sign="+sign;
try
{
var resp = await client.GetAsync(this.RefundUrl+$"?user={account}&_={DateTime.Now.GetUnixTimeStamp()} ");
var resp = await client.GetAsync(url);
var content = await resp.Content.ReadAsStringAsync();
content = System.Text.RegularExpressions.Regex.Unescape(content);
if (content.Has() && content.IndexOf("删除成功") != -1)
Console.WriteLine("=====================================================================================");
Console.WriteLine(content);
Console.WriteLine("=====================================================================================");
JObject jo = (JObject)JsonConvert.DeserializeObject(content);
var status = jo["code"].ToString();
if (status == "1")
{
return new ApiResult(1);
}
else
{
LogHelper.Error(title, content);
return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败");
}
}
catch (Exception ex)
{
LogHelper.Error(title, ex.Message);
return new ApiResult(ResultCode.C_INVALID_ERROR, "退款失败");
}
}