【代理商需求】
https://www.tapd.cn/tapd_fe/67163502/story/detail/1167163502001000123
This commit is contained in:
@@ -435,6 +435,43 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h4>九、解除账号腾讯限制(仅限于<span style="font-weight: bold;">极狐、猎豹、极光、蘑菇</span>)</h4>
|
||||
<h5 style="color:red;">使用此权限请务必做好监管义务,如与用户签署或用户同意《网络信息安全承诺书》,上传手持身份证等措施,因您方监管不利导致的一切后果自负,使用此接口即视为默认同意此条款!</h5>
|
||||
<h5>接口地址:/api/account/openlimit?apikey=1232455165&account=test&productId=29</h5>
|
||||
<h5>请求方式:GET </h5>
|
||||
<table class="table table-bordered text-center">
|
||||
<caption>请求参数:</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>apikey</td>
|
||||
<td>唯一key值</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>account</td>
|
||||
<td>账号</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>productId</td>
|
||||
<td>产品ID</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<table class="table table-bordered text-center">
|
||||
<caption>返回数据:</caption>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Code</td>
|
||||
<td colspan="2">10000 解除成功/其他 失败</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Message</td>
|
||||
<td colspan="2">返回提示</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@
|
||||
<th>到期时间</th>
|
||||
<th>剩余时间</th>
|
||||
<th>在线及踢线</th>
|
||||
<th>选择地区</th>
|
||||
<!-- <th>选择地区</th> -->
|
||||
<th>操作</th>
|
||||
<th>软件下载</th>
|
||||
</tr>
|
||||
@@ -401,9 +401,9 @@
|
||||
<td class="redT">@(item.Status==AccountStatus.Refund?"已退货": item.RestTime)</td>
|
||||
@*<td class="greenT">查看</td>*@
|
||||
<td class="blueT"><a @@click="online(@item.ProductId,'@item.Account')">查看</a> </td>
|
||||
<td class="blueT"><a v-if="@item.ProductId==19||@item.ProductId==13||@item.ProductId==17||@item.ProductId==1" @@click="assign_address(@item.ProductId,'@item.Account','@item.Pwd')">切换地区</a> </td>
|
||||
<!-- <td class="blueT"><a v-if="@item.ProductId==19||@item.ProductId==13||@item.ProductId==17||@item.ProductId==1" @@click="assign_address(@item.ProductId,'@item.Account','@item.Pwd')">切换地区</a> </td> -->
|
||||
|
||||
<td class="blueT" ><a v-on:click="deleteacct(@item.Id)">删除</a></td>
|
||||
<td class="blueT" ><a v-on:click="deleteacct(@item.Id)">删除</a> </td>
|
||||
<td class="blueT"><a href="/product/soft">下载</a></td>
|
||||
</tr>
|
||||
} else {
|
||||
@@ -423,7 +423,7 @@
|
||||
<td class="redT">@(item.Status==AccountStatus.Refund?"已退货": item.RestTime)</td>
|
||||
@*<td class="greenT">查看</td>*@
|
||||
<td class="blueT"><a @@click="online(@item.ProductId,'@item.Account')">查看</a> </td>
|
||||
<td class="blueT"><a v-if="@item.ProductId==19||@item.ProductId==13||@item.ProductId==17||@item.ProductId==1" @@click="assign_address(@item.ProductId,'@item.Account','@item.Pwd')">切换地区</a> </td>
|
||||
<!-- <td class="blueT"><a v-if="@item.ProductId==19||@item.ProductId==13||@item.ProductId==17||@item.ProductId==1" @@click="assign_address(@item.ProductId,'@item.Account','@item.Pwd')">切换地区</a> </td> -->
|
||||
|
||||
<td class="blueT" ><a v-on:click="deleteacct('@item.Id')">删除</a></td>
|
||||
<td class="blueT"><a href="/product/soft">下载</a></td>
|
||||
@@ -669,7 +669,7 @@
|
||||
id: Id
|
||||
}
|
||||
|
||||
|
||||
if (confirm("您确定要删除该账号吗?")) {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'https://php-api.juip.com/manager/account/delete',
|
||||
@@ -685,6 +685,7 @@
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
change_ip(account_id,package,account,old_ip){
|
||||
this.province_city = [];
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace Hncore.Pass.Vpn.Controllers
|
||||
{
|
||||
//通过apikey获取用户信息
|
||||
var userInfo = m_BaseUserService.Query(m => m.apikey == request.apikey).FirstOrDefault();
|
||||
return await m_ProductOrderService.Refund(userInfo.Id, request.Account);
|
||||
return await m_ProductOrderService.ApiRefund(userInfo.Id, request.Account);
|
||||
}
|
||||
|
||||
[UserAuth]
|
||||
|
||||
@@ -1324,6 +1324,165 @@ FROM product_order where {where} GROUP BY Channel,ProductName order by Channel,
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<ApiResult> ApiRefund(int userId, string account)
|
||||
{
|
||||
using (await _mutex1.LockAsync())
|
||||
{
|
||||
var reason = "";
|
||||
if(account.Contains("-")){
|
||||
string[] arrStr = account.Split('-');
|
||||
account = arrStr[0];
|
||||
reason = arrStr[1];
|
||||
}
|
||||
var accountInfo = await m_ProductAccountService.GetAccountInfo(account, userId);
|
||||
|
||||
if (accountInfo == null)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_Illegal_Operation, "账户不存在");
|
||||
}
|
||||
if(accountInfo.ProductId == 20||accountInfo.ProductId == 21){
|
||||
return new ApiResult(ResultCode.C_Illegal_Operation, "无极账号不允许退款");
|
||||
}
|
||||
if (accountInfo.AccountType == (int)AccountType.Origin)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_Illegal_Operation, "认证的账号不能退款");
|
||||
}
|
||||
if (accountInfo.EndTime < DateTime.Now)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_Illegal_Operation, "已经过期");
|
||||
}
|
||||
var pacageInfo = await m_ProductPackageService.GetById(accountInfo.PackageId);
|
||||
|
||||
// if (pacageInfo.DayCount == 1)
|
||||
// {
|
||||
// return new ApiResult(ResultCode.C_Illegal_Operation, "天卡不能退款");
|
||||
// }
|
||||
if (pacageInfo.IsTest == 1)
|
||||
{
|
||||
return new ApiResult(ResultCode.C_Illegal_Operation, "测试卡不能退款");
|
||||
}
|
||||
var product = await this.m_ProductService.GetById(pacageInfo.ProductId);
|
||||
|
||||
//折扣
|
||||
var refundDayPrice = 10.00M;
|
||||
var userEntity = await m_UserService.GetById(userId);
|
||||
if((userEntity.agent_id == 0||(userEntity.agent_id != 0 && userEntity.discount_id != 0)) && userEntity.discount_id >= 0){
|
||||
//获取代理折扣
|
||||
var discount = await m_ProductPriceSchemeService.GetById(userEntity.discount_id);
|
||||
if (discount != null){
|
||||
refundDayPrice = (product.RefundDayPrice * discount.discount / 100).ToDecimal();
|
||||
} else {
|
||||
refundDayPrice = (product.RefundDayPrice).ToDecimal();
|
||||
}
|
||||
} else {
|
||||
var userPrice = await m_ProductUserPriceService.GetPackageUserPrice(pacageInfo.Id, userId);
|
||||
|
||||
refundDayPrice = (userPrice != null && userPrice.RefundDayPrice > 0 ? userPrice.RefundDayPrice : product.RefundDayPrice).ToDecimal();
|
||||
}
|
||||
|
||||
|
||||
var lastOrder = await GetLastOrderByAccount(account);
|
||||
|
||||
var dateStr = lastOrder.StartTime.ToString();
|
||||
var now = DateTime.Now.GetUnixTimeStamp();
|
||||
|
||||
|
||||
|
||||
//解析字符串为 DateTime(假设是本地时间)
|
||||
DateTime dateTime = DateTime.Parse(dateStr);
|
||||
|
||||
// 转换为 UTC(如果原始时间是本地时间)
|
||||
DateTime utcTime = dateTime.ToUniversalTime();
|
||||
|
||||
// 计算 Unix 时间戳(秒)
|
||||
DateTime epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
|
||||
TimeSpan timeDiff = utcTime - epoch;
|
||||
long unixTimestampSeconds = (long)timeDiff.TotalSeconds + 3600;
|
||||
|
||||
var useDay = (int)Math.Ceiling((DateTime.Now - lastOrder.UpdateTime).TotalDays);
|
||||
|
||||
if (unixTimestampSeconds > now) {
|
||||
useDay = 0;
|
||||
}
|
||||
|
||||
var refundAmount = lastOrder.PaymentAmount / lastOrder.AccountCount - useDay * refundDayPrice * accountInfo.ConnectCount;
|
||||
refundAmount = refundAmount <= 0 ? 0 : refundAmount;
|
||||
|
||||
//退款用户总消费修改 这个好像没用用处 已经有其他的统计地方
|
||||
userEntity.ConsumeAmount -= refundAmount;
|
||||
await m_UserService.Update(userEntity);
|
||||
|
||||
var order = new ProductOrderEntity()
|
||||
{
|
||||
AccountCount = 1,
|
||||
ConnectCount = accountInfo.ConnectCount,
|
||||
OrderName = accountInfo.ProductName,
|
||||
OrderNo = GeneratOrderNO(userId, OrderType.Refund),
|
||||
OrderState = OrderStatus.RequestRefund,
|
||||
OrderType = OrderType.Refund,
|
||||
PackageId = accountInfo.PackageId.Value,
|
||||
PackageName = accountInfo.PackageName,
|
||||
ProductId = accountInfo.ProductId.Value,
|
||||
ProductName = accountInfo.ProductName,
|
||||
PayType = PayType.None,
|
||||
UserId = userId,
|
||||
UserName = accountInfo.UserCode,
|
||||
DayCount = (accountInfo.EndTime - DateTime.Now).Value.Days,
|
||||
DayPrice = refundDayPrice,
|
||||
Accounts = account,
|
||||
PaymentAmount = lastOrder.PaymentAmount/ lastOrder.AccountCount,
|
||||
RefundAmount = refundAmount,
|
||||
RefundCount = 1,
|
||||
Remark = "API退款",
|
||||
RefundReason = reason,
|
||||
agent_id = accountInfo.agent_id
|
||||
};
|
||||
var time = (accountInfo.EndTime - DateTime.Now).Value;
|
||||
order.RefundRestTime = time.ToString(@"d\天hh\时mm\分");
|
||||
|
||||
//短信内容 部分运营商收不到短信
|
||||
var tpl_info = new Dictionary<string, string>(){
|
||||
{"product",accountInfo.ProductName},
|
||||
{"package",accountInfo.PackageName },
|
||||
{"connect",accountInfo.ConnectCount.ToString() },
|
||||
{"account",account },
|
||||
{"resttime",order.RefundRestTime},
|
||||
};
|
||||
|
||||
var againBuy = lastOrder.OrderType == OrderType.AgainBuy || lastOrder.OrderType == OrderType.AgainBuys;
|
||||
|
||||
var laoyingXunFei = againBuy && lastOrder.ProductId == 4;
|
||||
if (product.AutoRefund == 1 && !laoyingXunFei)
|
||||
{
|
||||
var refundRet = await this.m_AgentService.Refund(pacageInfo, accountInfo);
|
||||
if (refundRet.Code == ResultCode.C_SUCCESS)
|
||||
{
|
||||
order.OrderState = OrderStatus.AutoRefundOver;
|
||||
}
|
||||
}
|
||||
var amountInfo = new BaseInfo.Request.User.UpdateAmountRequest()
|
||||
{
|
||||
Amount = order.RefundAmount,
|
||||
OpAmountType = ScoreType.AccountRefund,
|
||||
UserId = order.UserId,
|
||||
AttchInfo = order.OrderNo,
|
||||
OperateUserName = accountInfo.UserCode
|
||||
};
|
||||
var retAmount = await m_BaseUserService.UpdateAmount(amountInfo);
|
||||
accountInfo.EndTime = DateTime.Now;
|
||||
accountInfo.Status = AccountStatus.Refund;
|
||||
await m_ProductAccountService.Update(accountInfo);
|
||||
await this.Add(order);
|
||||
|
||||
var managerEntity = await m_ManageService.GetById(userEntity.ManagerId.ToInt());
|
||||
if (managerEntity.TenantId == 1 && managerEntity.RoleId == 100 && DateTime.Now.Hour<23 && DateTime.Now.Hour>8) {
|
||||
AliSmsService.Send("SMS_462300235", new { name = userEntity.ManagerName,phone=userEntity.Phone }, "河南华连网络科技", managerEntity.Phone);
|
||||
}
|
||||
return new ApiResult(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public async Task<ApiResult> CaclRefund(int userId, string account)
|
||||
{
|
||||
var accountInfo = await m_ProductAccountService.GetAccountInfo(account, userId);
|
||||
|
||||
Reference in New Issue
Block a user