From 4dd87f29e25fc4ebb4a798ff43e7ea90f10932e2 Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Sat, 28 Nov 2020 09:49:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E9=80=9A=E5=A4=B1=E8=B4=A5=E9=87=8D?= =?UTF-8?q?=E6=96=B0=E5=86=8D=E5=BC=80=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ProductOrderService.cs | 46 +++++++++++++++---- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs b/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs index 529437f..4b204f4 100644 --- a/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs +++ b/Services/Hncore.Pass.Vpn/Service/ProductOrderService.cs @@ -529,6 +529,7 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, var accountError = ""; await accountEntitys.ForEachAsync(async accountEntity => { + var ret = new ApiResult(); if(accountEntity.PackageId.Value == 86 || accountEntity.PackageId.Value == 88){ ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,1,2); @@ -538,10 +539,27 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, if (ret.Code != ResultCode.C_SUCCESS) { - accountEntity.ChargeStatus = AccountChargeStatus.Exception; - accountEntity.Remark = ret.Message; - await m_ProductAccountService.Update(accountEntity); - accountError += $"{accountEntity.Account}{accountEntity.Remark},"; + var ret_exit = await m_AgentService.Exist(accountEntity.ProductId.ToInt(), accountEntity.Account); + await Task.Delay(50); + if (ret_exit != true){ + if(accountEntity.PackageId.Value == 86 || accountEntity.PackageId.Value == 88){ + ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount,1,2); + } else { + ret = await m_AgentService.NewAccount(order.Id, accountEntity.PackageId.Value, accountEntity.Account, accountEntity.Pwd, accountEntity.ConnectCount); + } + if (ret.Code != ResultCode.C_SUCCESS) + { + accountEntity.ChargeStatus = AccountChargeStatus.Exception; + accountEntity.Remark = ret.Message; + await m_ProductAccountService.Update(accountEntity); + accountError += $"{accountEntity.Account}{accountEntity.Remark},"; + } + else if (ret.Data != null && ret.Data.ToString().Has()) + { + accountEntity.Raw = ret.Data.ToString(); + await m_ProductAccountService.Update(accountEntity); + } + } } else if (ret.Data != null && ret.Data.ToString().Has()) { @@ -613,10 +631,22 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel, } if (ret.Code != ResultCode.C_SUCCESS) { - accountEntity.ChargeStatus = AccountChargeStatus.Exception; - accountEntity.Remark = ret.Message; - await m_ProductAccountService.Update(accountEntity); - accountError += $"{accountEntity.Account}{accountEntity.Remark},"; + + var accountInfo = await m_AgentService.GetOriginAccountInfo(accountEntity.ProductId.ToInt(), accountEntity.Account); + if(accountEntity.EndTime > accountInfo.Data.RealEndTime.AddMinutes(1)){ + if (order.PackageId == 86){ + ret = await m_AgentService.ReNewAccount(order.Id, order.PackageId, account, order.ConnectCount,2); + } else { + ret = await m_AgentService.ReNewAccount(order.Id, order.PackageId, account, order.ConnectCount); + } + if (ret.Code != ResultCode.C_SUCCESS) + { + accountEntity.ChargeStatus = AccountChargeStatus.Exception; + accountEntity.Remark = ret.Message; + await m_ProductAccountService.Update(accountEntity); + accountError += $"{accountEntity.Account}{accountEntity.Remark},"; + } + } } }); if (accountError.Has())