修改 返利逻辑
OEM返利按照成为OEM的时间开始 用户变为OEM下账号结算旧流水 退出OEM下账号 OEM结算
This commit is contained in:
1 parent
4343e31f1c
commit
51cd5f9388
16 files changed
+594
-103
No files matched your search
@@ -0,0 +1,92 @@
|
|||||||
|
using Autofac;
|
||||||
|
using Autofac.Integration.WebApi;
|
||||||
|
using FreeSql;
|
||||||
|
using KJD_Web.Repository;
|
||||||
|
using MAX.Core.DependencyInjection;
|
||||||
|
using MAX.Core.Logger;
|
||||||
|
using MAX.Framework.Logger;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace KJD_Web;
|
||||||
|
|
||||||
|
public class ContainerConfig
|
||||||
|
{
|
||||||
|
|
||||||
|
public static IContainer BuildContainer()
|
||||||
|
{
|
||||||
|
var builder = new ContainerBuilder();
|
||||||
|
var appAssembly = Assembly.GetExecutingAssembly();
|
||||||
|
|
||||||
|
var connection = ConfigurationManager.ConnectionStrings["ConnKJD"];
|
||||||
|
if (connection == null || string.IsNullOrWhiteSpace(connection.ConnectionString))
|
||||||
|
{
|
||||||
|
throw new ConfigurationErrorsException("未配置连接字符串:ConnKJD");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ImageCacheService 使用独立的 imagecache 数据库。
|
||||||
|
builder.Register(_ =>
|
||||||
|
{
|
||||||
|
return new FreeSqlBuilder()
|
||||||
|
.UseConnectionString(
|
||||||
|
DataType.MySql,
|
||||||
|
connection.ConnectionString)
|
||||||
|
.Build();
|
||||||
|
})
|
||||||
|
.As<IFreeSql>()
|
||||||
|
.SingleInstance();
|
||||||
|
|
||||||
|
builder.RegisterGeneric(typeof(AutofacRepository<>))
|
||||||
|
.As(typeof(IBaseRepository<>))
|
||||||
|
.UsingConstructor(typeof(IFreeSql))
|
||||||
|
.InstancePerRequest();
|
||||||
|
|
||||||
|
|
||||||
|
// 注册 Web API 所有 Controller
|
||||||
|
builder.RegisterApiControllers(appAssembly);
|
||||||
|
builder.RegisterInstance(NLogger.Instance).As<ILoggerFacade>().SingleInstance();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 注册所有IOC接口
|
||||||
|
|
||||||
|
Type typeSingleton = typeof(ISingletonDependency);
|
||||||
|
builder.RegisterAssemblyTypes(appAssembly)
|
||||||
|
.Where(a =>
|
||||||
|
typeSingleton.IsAssignableFrom(a)
|
||||||
|
&& a.IsClass
|
||||||
|
&& !a.IsAbstract
|
||||||
|
)
|
||||||
|
.AsImplementedInterfaces()
|
||||||
|
.AsSelf()
|
||||||
|
.SingleInstance();
|
||||||
|
|
||||||
|
Type typeTransient = typeof(ITransientDependency);
|
||||||
|
builder.RegisterAssemblyTypes(appAssembly)
|
||||||
|
.Where(a =>
|
||||||
|
typeTransient.IsAssignableFrom(a)
|
||||||
|
&& a.IsClass
|
||||||
|
&& !a.IsAbstract
|
||||||
|
)
|
||||||
|
.AsImplementedInterfaces()
|
||||||
|
.AsSelf()
|
||||||
|
.InstancePerDependency();
|
||||||
|
|
||||||
|
Type typeScoped = typeof(IScopedDependency);
|
||||||
|
builder.RegisterAssemblyTypes(appAssembly)
|
||||||
|
.Where(a => typeScoped.IsAssignableFrom(a) && a.IsClass && !a.IsAbstract)
|
||||||
|
.AsImplementedInterfaces()
|
||||||
|
.AsSelf()
|
||||||
|
.InstancePerRequest();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
return builder.Build();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
using KJD_Web.BLL.WXXD;
|
using KJD_Web.BLL.WXXD;
|
||||||
|
using KJD_Web.Model;
|
||||||
using KJD_Web.Requests;
|
using KJD_Web.Requests;
|
||||||
|
using KJD_Web.Requests.Users;
|
||||||
|
using KJD_Web.Utils;
|
||||||
using NaiBa.Util.Extension;
|
using NaiBa.Util.Extension;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -115,16 +118,74 @@ namespace KJD_Web.Controllers
|
|||||||
return JsonString(result);
|
return JsonString(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 更新用户
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
|
||||||
public IHttpActionResult update_user()
|
public IHttpActionResult update_user()
|
||||||
{
|
{
|
||||||
string jsontext = GetRequestJsonString();
|
|
||||||
|
|
||||||
var result = jsontext;
|
string inputData = GetRequestJsonString();
|
||||||
result = new WXUserManage().UpdateUser(jsontext);
|
|
||||||
|
|
||||||
|
|
||||||
|
var uu = RegexUtils.GetStringQuery(ref inputData, "uu")?.Replace("'", "\\'").ParseToBool();
|
||||||
|
|
||||||
|
if (uu != true)
|
||||||
|
{
|
||||||
|
var result = new WXUserManage().UpdateUser(inputData);
|
||||||
return JsonString(result);
|
return JsonString(result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var id = RegexUtils.GetStringQuery(ref inputData, "id")?.Replace("'", "\\'").ParseToInt();
|
||||||
|
var nick_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_nick_name"))?.Replace("'", "\\'");
|
||||||
|
var user_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_user_name"))?.Replace("'", "\\'");
|
||||||
|
var mobile = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_mobile"))?.Replace("'", "\\'");
|
||||||
|
var company_name = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "add_company"))?.Replace("'", "\\'");
|
||||||
|
var password = RegexUtils.GetStringQuery(ref inputData, "add_password")?.Replace("'", "\\'");
|
||||||
|
var group_id = RegexUtils.GetStringQuery(ref inputData, "group_id")?.Replace("'", "\\'").ParseToNullableInt();
|
||||||
|
var card_id = RegexUtils.GetStringQuery(ref inputData, "card_id")?.Replace("'", "\\'");
|
||||||
|
var notes = RegexUtils.GetStringQuery(ref inputData, "notes")?.Replace("'", "\\'");
|
||||||
|
var sa_level = RegexUtils.GetStringQuery(ref inputData, "sa_level")?.Replace("'", "\\'").ParseToNullableInt(); ;
|
||||||
|
var authority = RegexUtils.GetStringQuery(ref inputData, "authority")?.Replace("'", "\\'");
|
||||||
|
var forbidden_page = RegexUtils.GetStringQuery(ref inputData, "forbidden_page")?.Replace("'", "\\'");
|
||||||
|
var shop_points_per_month = RegexUtils.GetStringQuery(ref inputData, "shop_points_per_month")?.Replace("'", "\\'").ParseToDecimal();
|
||||||
|
var postage_per_order = RegexUtils.GetStringQuery(ref inputData, "postage_per_order")?.Replace("'", "\\'").ParseToDecimal();
|
||||||
|
var refund_postage_per_order = RegexUtils.GetStringQuery(ref inputData, "refund_postage_per_order")?.Replace("'", "\\'").ParseToDecimal();
|
||||||
|
var gift_oem_amount_per_order = RegexUtils.GetStringQuery(ref inputData, "gift_oem_amount_per_order")?.Replace("'", "\\'").ParseToDecimal();
|
||||||
|
var oem_id = RegexUtils.GetStringQuery(ref inputData, "oem_id")?.Replace("'", "\\'");
|
||||||
|
|
||||||
|
CUUserInfoRequest request = new CUUserInfoRequest
|
||||||
|
{
|
||||||
|
Id = id,
|
||||||
|
NickName = nick_name,
|
||||||
|
UserName = user_name,
|
||||||
|
Mobile = mobile,
|
||||||
|
CompanyName = company_name,
|
||||||
|
Password = password,
|
||||||
|
GroupId = group_id,
|
||||||
|
CardId = card_id,
|
||||||
|
Notes = notes,
|
||||||
|
SaLevel = sa_level,
|
||||||
|
Authority = authority,
|
||||||
|
ForbiddenPage = forbidden_page,
|
||||||
|
ShopPointsPerMonth = shop_points_per_month,
|
||||||
|
PostagePerOrder = postage_per_order,
|
||||||
|
RefundPostagePerOrder = refund_postage_per_order,
|
||||||
|
GiftOemAmountPerOrder = gift_oem_amount_per_order,
|
||||||
|
OemId = oem_id,
|
||||||
|
};
|
||||||
|
_userService.UpdateUser(request);
|
||||||
|
return Ok(ApiResult.Success(true));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Ok(ApiResult.Fail(ex.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +341,11 @@ namespace KJD_Web.Controllers
|
|||||||
return JsonString(result);
|
return JsonString(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// oem结算 失效
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Obsolete]
|
||||||
public IHttpActionResult oem_settle_flows()
|
public IHttpActionResult oem_settle_flows()
|
||||||
{
|
{
|
||||||
string jsontext = GetRequestJsonString();
|
string jsontext = GetRequestJsonString();
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
using KJD_Web.Model;
|
using KJD_Web.BLL.WXXD;
|
||||||
|
using KJD_Web.Model;
|
||||||
|
using KJD_Web.Requests;
|
||||||
using KJD_Web.Requests.Users;
|
using KJD_Web.Requests.Users;
|
||||||
using KJD_Web.Services.Users;
|
using KJD_Web.Services.Users;
|
||||||
using MAX.Core.Logger;
|
using MAX.Core.Logger;
|
||||||
|
using NaiBa.Util.Extension;
|
||||||
|
using Org.BouncyCastle.Ocsp;
|
||||||
using System;
|
using System;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
@@ -17,6 +21,57 @@ namespace KJD_Web.Controllers
|
|||||||
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
|
_userService = userService ?? throw new ArgumentNullException(nameof(userService));
|
||||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 查询
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public IHttpActionResult GetOemAmount(SignRequestBase request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var oem = _userService.GetOEMByUserName(request.UserName, false);
|
||||||
|
if (oem == null)
|
||||||
|
{
|
||||||
|
throw new Exception("错误的账号");
|
||||||
|
}
|
||||||
|
return Ok(ApiResult.Success(new
|
||||||
|
{
|
||||||
|
oem.AvailableBalance,
|
||||||
|
oem.TotalRebateAmount,
|
||||||
|
oem.TotalWithdrawAmount
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Ok(ApiResult.Fail(ex.Message));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 流水结算
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
[Route("oem_settle_flows")]
|
||||||
|
public IHttpActionResult OEMSettleFlows(SignRequestBase request)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var oem = _userService.SettleOemFlows(request.UserName);
|
||||||
|
return Ok(ApiResult.Success(new
|
||||||
|
{
|
||||||
|
oem.AvailableBalance,
|
||||||
|
oem.TotalRebateAmount,
|
||||||
|
oem.TotalWithdrawAmount
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Ok(ApiResult.Fail(ex.Message));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户续费商铺。
|
/// 用户续费商铺。
|
||||||
@@ -47,5 +102,13 @@ namespace KJD_Web.Controllers
|
|||||||
return Ok(ApiResult.Fail("续费失败,请稍后重试", ResultCode.ServerError));
|
return Ok(ApiResult.Fail("续费失败,请稍后重试", ResultCode.ServerError));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 用户结算流水
|
||||||
|
/// </summary>
|
||||||
|
private void UserSettleFlows(string userName, string oemId)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,5 +152,13 @@ namespace KJD_Web.Entitys
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[Column(Name = "gift_oem_amount_per_order")]
|
[Column(Name = "gift_oem_amount_per_order")]
|
||||||
public decimal? GiftOemAmountPerOrder { get; set; }
|
public decimal? GiftOemAmountPerOrder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否主账户
|
||||||
|
/// </summary>
|
||||||
|
public bool IsMainUser
|
||||||
|
{
|
||||||
|
get => string.IsNullOrWhiteSpace(ParentUserName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,7 +25,7 @@ namespace KJD_Web
|
|||||||
protected void Application_Start(object sender, EventArgs e)
|
protected void Application_Start(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
NLogger.Instance.Info("应用程序启动");
|
NLogger.Instance.Info("应用程序启动");
|
||||||
var container = BuildContainer();
|
var container = ContainerConfig.BuildContainer();
|
||||||
|
|
||||||
// 让 Web API 用 Autofac 解析 Controller
|
// 让 Web API 用 Autofac 解析 Controller
|
||||||
GlobalConfiguration.Configuration.DependencyResolver =
|
GlobalConfiguration.Configuration.DependencyResolver =
|
||||||
@@ -33,77 +33,7 @@ namespace KJD_Web
|
|||||||
GlobalConfiguration.Configure(WebApiConfig.Register);
|
GlobalConfiguration.Configure(WebApiConfig.Register);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static IContainer BuildContainer()
|
|
||||||
{
|
|
||||||
var builder = new ContainerBuilder();
|
|
||||||
var appAssembly = Assembly.GetExecutingAssembly();
|
|
||||||
|
|
||||||
var connection = ConfigurationManager.ConnectionStrings["ConnKJD"];
|
|
||||||
if (connection == null || string.IsNullOrWhiteSpace(connection.ConnectionString))
|
|
||||||
{
|
|
||||||
throw new ConfigurationErrorsException("未配置连接字符串:ConnKJD");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ImageCacheService 使用独立的 imagecache 数据库。
|
|
||||||
builder.Register(_ =>
|
|
||||||
{
|
|
||||||
return new FreeSqlBuilder()
|
|
||||||
.UseConnectionString(
|
|
||||||
DataType.MySql,
|
|
||||||
connection.ConnectionString)
|
|
||||||
.Build();
|
|
||||||
})
|
|
||||||
.As<IFreeSql>()
|
|
||||||
.SingleInstance();
|
|
||||||
|
|
||||||
builder.RegisterGeneric(typeof(AutofacRepository<>))
|
|
||||||
.As(typeof(IBaseRepository<>))
|
|
||||||
.UsingConstructor(typeof(IFreeSql))
|
|
||||||
.InstancePerRequest();
|
|
||||||
|
|
||||||
|
|
||||||
// 注册 Web API 所有 Controller
|
|
||||||
builder.RegisterApiControllers(appAssembly);
|
|
||||||
builder.RegisterInstance(NLogger.Instance).As<ILoggerFacade>().SingleInstance();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 注册所有IOC接口
|
|
||||||
|
|
||||||
Type typeSingleton = typeof(ISingletonDependency);
|
|
||||||
builder.RegisterAssemblyTypes(appAssembly)
|
|
||||||
.Where(a =>
|
|
||||||
typeSingleton.IsAssignableFrom(a)
|
|
||||||
&& a.IsClass
|
|
||||||
&& !a.IsAbstract
|
|
||||||
)
|
|
||||||
.AsImplementedInterfaces()
|
|
||||||
.AsSelf()
|
|
||||||
.SingleInstance();
|
|
||||||
|
|
||||||
Type typeTransient = typeof(ITransientDependency);
|
|
||||||
builder.RegisterAssemblyTypes(appAssembly)
|
|
||||||
.Where(a =>
|
|
||||||
typeTransient.IsAssignableFrom(a)
|
|
||||||
&& a.IsClass
|
|
||||||
&& !a.IsAbstract
|
|
||||||
)
|
|
||||||
.AsImplementedInterfaces()
|
|
||||||
.AsSelf()
|
|
||||||
.InstancePerDependency();
|
|
||||||
|
|
||||||
Type typeScoped = typeof(IScopedDependency);
|
|
||||||
builder.RegisterAssemblyTypes(appAssembly)
|
|
||||||
.Where(a => typeScoped.IsAssignableFrom(a) && a.IsClass && !a.IsAbstract)
|
|
||||||
.AsImplementedInterfaces()
|
|
||||||
.AsSelf()
|
|
||||||
.InstancePerRequest();
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
return builder.Build();
|
|
||||||
}
|
|
||||||
private static IFreeSql CreateImageCacheFreeSql()
|
private static IFreeSql CreateImageCacheFreeSql()
|
||||||
{
|
{
|
||||||
var connection = ConfigurationManager.ConnectionStrings["ConnKJD"];
|
var connection = ConfigurationManager.ConnectionStrings["ConnKJD"];
|
||||||
|
|||||||
@@ -189,6 +189,7 @@
|
|||||||
<Compile Include="BLL\WXXD\WXShopManage.cs" />
|
<Compile Include="BLL\WXXD\WXShopManage.cs" />
|
||||||
<Compile Include="BLL\WXXD\WXShopRevenueStatisticsManage.cs" />
|
<Compile Include="BLL\WXXD\WXShopRevenueStatisticsManage.cs" />
|
||||||
<Compile Include="BLL\WXXD\WXUserManage.cs" />
|
<Compile Include="BLL\WXXD\WXUserManage.cs" />
|
||||||
|
<Compile Include="ContainerConfig.cs" />
|
||||||
<Compile Include="Controllers\ApiControllerBase.cs" />
|
<Compile Include="Controllers\ApiControllerBase.cs" />
|
||||||
<Compile Include="Controllers\AsmxApiController.cs" />
|
<Compile Include="Controllers\AsmxApiController.cs" />
|
||||||
<Compile Include="Controllers\ImageCacheController.cs" />
|
<Compile Include="Controllers\ImageCacheController.cs" />
|
||||||
@@ -223,6 +224,7 @@
|
|||||||
<Compile Include="Entitys\OEMEntity.cs" />
|
<Compile Include="Entitys\OEMEntity.cs" />
|
||||||
<Compile Include="Entitys\UserPaymentRecordEntity.cs" />
|
<Compile Include="Entitys\UserPaymentRecordEntity.cs" />
|
||||||
<Compile Include="Requests\RequestBase.cs" />
|
<Compile Include="Requests\RequestBase.cs" />
|
||||||
|
<Compile Include="Requests\Users\CUUserInfoRequest.cs" />
|
||||||
<Compile Include="Requests\Users\RebateRecordRequest.cs" />
|
<Compile Include="Requests\Users\RebateRecordRequest.cs" />
|
||||||
<Compile Include="Responses\Users\RebateRecordResponse.cs" />
|
<Compile Include="Responses\Users\RebateRecordResponse.cs" />
|
||||||
<Compile Include="Responses\Users\ShopRenewResponse.cs" />
|
<Compile Include="Responses\Users\ShopRenewResponse.cs" />
|
||||||
@@ -334,6 +336,7 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Properties\PublishProfiles\IISProfile.pubxml" />
|
<None Include="Properties\PublishProfiles\IISProfile.pubxml" />
|
||||||
<Content Include="Nlog.config" />
|
<Content Include="Nlog.config" />
|
||||||
|
<Compile Include="Services\Users\UserService.Admin.cs" />
|
||||||
<None Include="Web.Debug.config">
|
<None Include="Web.Debug.config">
|
||||||
<DependentUpon>Web.config</DependentUpon>
|
<DependentUpon>Web.config</DependentUpon>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System;
|
|||||||
namespace KJD_Web.Requests;
|
namespace KJD_Web.Requests;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 卡名请求
|
/// Sign签名
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class SignRequestBase
|
public class SignRequestBase
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace KJD_Web.Requests.Users;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加和修改用户 Dto
|
||||||
|
/// </summary>
|
||||||
|
public class CUUserInfoRequest : SignRequestBase
|
||||||
|
{
|
||||||
|
/// <summary>主键 ID</summary>
|
||||||
|
public int? Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>昵称(URL 解码)</summary>
|
||||||
|
public string NickName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>用户名(URL 解码)</summary>
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>手机号(URL 解码)</summary>
|
||||||
|
public string Mobile { get; set; }
|
||||||
|
|
||||||
|
/// <summary>公司名称(URL 解码)</summary>
|
||||||
|
public string CompanyName { get; set; }
|
||||||
|
|
||||||
|
/// <summary>密码</summary>
|
||||||
|
public string Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>分组 ID</summary>
|
||||||
|
public int? GroupId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>卡 ID</summary>
|
||||||
|
public string CardId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>备注</summary>
|
||||||
|
public string Notes { get; set; }
|
||||||
|
|
||||||
|
/// <summary>SA 等级</summary>
|
||||||
|
public int? SaLevel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>权限</summary>
|
||||||
|
public string Authority { get; set; }
|
||||||
|
|
||||||
|
/// <summary>禁止访问的页面</summary>
|
||||||
|
public string ForbiddenPage { get; set; }
|
||||||
|
|
||||||
|
/// <summary>每月店铺积分</summary>
|
||||||
|
public decimal? ShopPointsPerMonth { get; set; }
|
||||||
|
|
||||||
|
/// <summary>每单邮费</summary>
|
||||||
|
public decimal? PostagePerOrder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>每单退邮费</summary>
|
||||||
|
public decimal? RefundPostagePerOrder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>每单赠送 OEM 金额</summary>
|
||||||
|
public decimal? GiftOemAmountPerOrder { get; set; }
|
||||||
|
|
||||||
|
/// <summary>OEM ID</summary>
|
||||||
|
public string OemId { get; set; }
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace KJD_Web.Services.Users
|
||||||
|
{
|
||||||
|
public partial class UserService
|
||||||
|
{
|
||||||
|
public UserService()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,10 @@ using KJD_Web.Model.WxModel;
|
|||||||
using MySqlX.XDevAPI;
|
using MySqlX.XDevAPI;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Data.Common;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
namespace KJD_Web.Services.Users
|
namespace KJD_Web.Services.Users
|
||||||
@@ -21,7 +24,7 @@ namespace KJD_Web.Services.Users
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 结算OEM流水
|
/// 结算OEM流水
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public OEMEntity SettleOemFlows(string userName)
|
public OEMEntity SettleOemFlows(string userName, DbTransaction tarn = null)
|
||||||
{
|
{
|
||||||
var oem = GetOEMByUserName(userName);
|
var oem = GetOEMByUserName(userName);
|
||||||
|
|
||||||
@@ -29,10 +32,8 @@ namespace KJD_Web.Services.Users
|
|||||||
{
|
{
|
||||||
throw new Exception("错误的账号");
|
throw new Exception("错误的账号");
|
||||||
}
|
}
|
||||||
|
using var work = tarn != null ? _freeSql.CreateUnitOfWork(tarn) : _freeSql.CreateUnitOfWork();
|
||||||
using var work = _freeSql.CreateUnitOfWork();
|
|
||||||
var trFreeSql = work.Orm;
|
var trFreeSql = work.Orm;
|
||||||
|
|
||||||
// 获取OEM下面的所有用户
|
// 获取OEM下面的所有用户
|
||||||
var users = GetOEMUsers(oem.OemId, true);
|
var users = GetOEMUsers(oem.OemId, true);
|
||||||
|
|
||||||
@@ -84,24 +85,31 @@ namespace KJD_Web.Services.Users
|
|||||||
}
|
}
|
||||||
|
|
||||||
work.Commit();
|
work.Commit();
|
||||||
|
oem = GetOEMByUserName(userName, false);
|
||||||
return oem;
|
return oem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 结算用户流水
|
/// 结算用户流水
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userName"></param>
|
/// <param name="userName"></param>
|
||||||
public void SettleUserFlows(string userName)
|
public long SettleUserFlows(string userName, DbTransaction tarn = null)
|
||||||
{
|
{
|
||||||
var user = GetUserByUserName(userName); if (user == null) { throw new Exception("错误的账号"); }
|
var user = GetUserAndSubUser(userName);
|
||||||
using var work = _freeSql.CreateUnitOfWork();
|
if (user == null)
|
||||||
|
{
|
||||||
|
throw new Exception("错误的账号");
|
||||||
|
}
|
||||||
|
using var work = tarn != null ? _freeSql.CreateUnitOfWork(tarn) : _freeSql.CreateUnitOfWork();
|
||||||
var trFreeSql = work.Orm;
|
var trFreeSql = work.Orm;
|
||||||
var userNames = new List<string> { user.UserName };
|
var userNames = user.Select(a => a.UserName).ToList();
|
||||||
/* * 普通用户没有OEM创建时间限制。 * * 所以这里传null。 */
|
/* * 普通用户没有OEM创建时间限制。 * * 所以这里传null。 */
|
||||||
long totalAmount = SettleFlowsInternal(trFreeSql, userNames, null);
|
long totalAmount = SettleFlowsInternal(trFreeSql, userNames, null);
|
||||||
/* * 普通用户没有余额, * 所以不做任何金额更新。 */
|
/* * 普通用户没有余额, * 所以不做任何金额更新。 */
|
||||||
|
Debug.WriteLine($"用户流水结算:{totalAmount}");
|
||||||
work.Commit();
|
work.Commit();
|
||||||
|
return totalAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -127,10 +135,15 @@ namespace KJD_Web.Services.Users
|
|||||||
.Where(a => a.Settlement == 0)
|
.Where(a => a.Settlement == 0)
|
||||||
.Where(a => a.IsDeleted == 0);
|
.Where(a => a.IsDeleted == 0);
|
||||||
//只有OEM结算才限制OEM创建时间。
|
//只有OEM结算才限制OEM创建时间。
|
||||||
if (oemAddTime.HasValue) { paymentQuery = paymentQuery.Where(a => a.CreateTime > oemAddTime.Value); }
|
if (oemAddTime.HasValue)
|
||||||
|
{
|
||||||
|
paymentQuery = paymentQuery.Where(a => a.CreateTime > oemAddTime.Value);
|
||||||
|
}
|
||||||
|
paymentQuery.OrderBy(a => a.Id);
|
||||||
var userPayments = paymentQuery.ToList();
|
var userPayments = paymentQuery.ToList();
|
||||||
if (userPayments.Count > 0)
|
if (userPayments.Count > 0)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine(userPayments.Where(a => a.Type == 20).Sum(a => a.OemAmount));
|
||||||
///原始流水ID。
|
///原始流水ID。
|
||||||
List<long> ids = userPayments.Select(a => a.Id).ToList();
|
List<long> ids = userPayments.Select(a => a.Id).ToList();
|
||||||
|
|
||||||
@@ -139,7 +152,7 @@ namespace KJD_Web.Services.Users
|
|||||||
{
|
{
|
||||||
a.Type,
|
a.Type,
|
||||||
a.OrderId
|
a.OrderId
|
||||||
}).Select(a => a.First());
|
}).Select(a => a.First()).ToList();
|
||||||
|
|
||||||
//经过计算过滤后的列表
|
//经过计算过滤后的列表
|
||||||
List<UserPaymentRecordEntity> userPaymentCalculated = new List<UserPaymentRecordEntity>();
|
List<UserPaymentRecordEntity> userPaymentCalculated = new List<UserPaymentRecordEntity>();
|
||||||
@@ -148,29 +161,40 @@ namespace KJD_Web.Services.Users
|
|||||||
{
|
{
|
||||||
if (item.Type == 20)
|
if (item.Type == 20)
|
||||||
{
|
{
|
||||||
item.OemAmount = item.Amount - 2.2m;
|
//item.OemAmount = item.Amount - 2.2m;
|
||||||
|
item.OemAmount = item.OemAmount;
|
||||||
}
|
}
|
||||||
else if (item.Type == 26)
|
else if (item.Type == 26)
|
||||||
{
|
{
|
||||||
item.OemAmount = item.Amount - 2.5m;
|
//item.OemAmount = item.Amount - 2.5m;
|
||||||
|
item.OemAmount = item.OemAmount;
|
||||||
}
|
}
|
||||||
if (item.Type == 23)
|
if (item.Type == 23)
|
||||||
{
|
{
|
||||||
var temp = userPaymentCalculated.FirstOrDefault(a => a.Type == 20 && a.OrderId == item.OrderId);
|
var temp = userPaymentCalculated.FirstOrDefault(a => a.Type == 20 && a.OrderId == item.OrderId);
|
||||||
if (temp != null)
|
if (temp != null)
|
||||||
|
{
|
||||||
userPaymentCalculated.Remove(temp);//23 移除 20
|
userPaymentCalculated.Remove(temp);//23 移除 20
|
||||||
}
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (item.Type == 34)
|
else if (item.Type == 34)
|
||||||
{
|
{
|
||||||
item.OemAmount = -item.OemAmount;
|
item.OemAmount = item.OemAmount * -1;
|
||||||
}
|
}
|
||||||
userPaymentCalculated.Add(item);
|
userPaymentCalculated.Add(item);
|
||||||
}
|
}
|
||||||
decimal userPaymentAmount = userPaymentCalculated.Sum(x => x.OemAmount ?? 0);//累计返利
|
decimal userPaymentAmount = userPaymentCalculated.Sum(x => x.OemAmount ?? 0);//累计返利
|
||||||
|
//StringBuilder sb = new StringBuilder();
|
||||||
|
//sb.AppendLine("id,order_id,type,amount,oem_amount,time");
|
||||||
|
//foreach (var item in userPayments)
|
||||||
|
//{
|
||||||
|
// sb.AppendLine($"{item.Id},{item.OrderId},{item.Type},{item.Amount},{item.OemAmount},{item.CreateTime}");
|
||||||
|
//}
|
||||||
total_amount += userPaymentAmount;
|
total_amount += userPaymentAmount;
|
||||||
rebate_amount += userPaymentAmount;
|
rebate_amount += userPaymentAmount;
|
||||||
|
|
||||||
|
Debug.WriteLine($"运费流水返利:{userPaymentAmount}");
|
||||||
var settlementCount = tr_freeSql.Update<UserPaymentRecordEntity>()
|
var settlementCount = tr_freeSql.Update<UserPaymentRecordEntity>()
|
||||||
.Set(a => a.Settlement, (byte)1)
|
.Set(a => a.Settlement, (byte)1)
|
||||||
.Set(a => a.SettlementTime, now)
|
.Set(a => a.SettlementTime, now)
|
||||||
@@ -196,13 +220,12 @@ namespace KJD_Web.Services.Users
|
|||||||
{
|
{
|
||||||
return x.DeltaPoints * 1 - ShopRenewFee; //比例1:1 减去固定收取费用
|
return x.DeltaPoints * 1 - ShopRenewFee; //比例1:1 减去固定收取费用
|
||||||
});//累计返利
|
});//累计返利
|
||||||
userPointsAmount *= 1;//比例1:1
|
|
||||||
|
|
||||||
|
|
||||||
total_amount += userPointsAmount;
|
total_amount += userPointsAmount;
|
||||||
rebate_amount += userPointsAmount;
|
rebate_amount += userPointsAmount;
|
||||||
|
|
||||||
|
Debug.WriteLine($"商铺月费返利:{userPointsAmount}");
|
||||||
var settlementCount = tr_freeSql.Update<UserPointsRecordEntity>()
|
var settlementCount = tr_freeSql.Update<UserPointsRecordEntity>()
|
||||||
.Set(a => a.Settlement, true)
|
.Set(a => a.Settlement, true)
|
||||||
.Set(a => a.SettlementTime, now)
|
.Set(a => a.SettlementTime, now)
|
||||||
|
|||||||
@@ -14,17 +14,38 @@ public partial class UserService
|
|||||||
{
|
{
|
||||||
private static List<OEMEntity> OEMData = null;
|
private static List<OEMEntity> OEMData = null;
|
||||||
|
|
||||||
public OEMEntity GetOEMByUserName(string userName)
|
public OEMEntity GetOEMByUserName(string userName, bool isCache = true)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(userName)) return null;
|
if (string.IsNullOrEmpty(userName)) return null;
|
||||||
|
if (isCache)
|
||||||
|
{
|
||||||
if (OEMData == null)
|
if (OEMData == null)
|
||||||
{
|
{
|
||||||
OEMData = _freeSql.Select<OEMEntity>().ToList();
|
OEMData = _freeSql.Select<OEMEntity>().ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
return OEMData.FirstOrDefault(a => a.OemOwner == userName);
|
return OEMData.FirstOrDefault(a => a.OemOwner == userName);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _freeSql.Select<OEMEntity>().Where(a => a.OemOwner == userName).First();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public OEMEntity GetOEMByOemId(string oemId, bool isCache = true)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(oemId)) return null;
|
||||||
|
if (isCache)
|
||||||
|
{
|
||||||
|
if (OEMData == null)
|
||||||
|
{
|
||||||
|
OEMData = _freeSql.Select<OEMEntity>().ToList();
|
||||||
|
}
|
||||||
|
return OEMData.FirstOrDefault(a => a.OemId == oemId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return _freeSql.Select<OEMEntity>().Where(a => a.OemId == oemId).First();
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取所有OEM用户包含子用户
|
/// 获取所有OEM用户包含子用户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -6,7 +6,11 @@ using KJD_Web.Model.ShopModel;
|
|||||||
using KJD_Web.Requests.Users;
|
using KJD_Web.Requests.Users;
|
||||||
using KJD_Web.Utils;
|
using KJD_Web.Utils;
|
||||||
using MAX.Core.DependencyInjection;
|
using MAX.Core.DependencyInjection;
|
||||||
|
using NaiBa.Util.Extension;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using Ubiety.Dns.Core;
|
||||||
using YourNamespace;
|
using YourNamespace;
|
||||||
|
|
||||||
namespace KJD_Web.Services.Users
|
namespace KJD_Web.Services.Users
|
||||||
@@ -40,6 +44,30 @@ namespace KJD_Web.Services.Users
|
|||||||
return _freeSql.Select<UserEntity>().Where(a => a.UserName == userName).First();
|
return _freeSql.Select<UserEntity>().Where(a => a.UserName == userName).First();
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 获取用户包含子账户
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userName"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<UserEntity> GetUserAndSubUser(string userName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(userName)) return null;
|
||||||
|
var mainUser = _freeSql.Select<UserEntity>().Where(a => a.UserName == userName).First();
|
||||||
|
if (mainUser == null) return null;
|
||||||
|
List<UserEntity> allUsers = [mainUser];
|
||||||
|
// 3. 这些主账号对应的子账号
|
||||||
|
var subUsers = _freeSql.Select<UserEntity>()
|
||||||
|
.Where(u => u.ParentUserName == mainUser.UserName)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
// 4. 合并,去重
|
||||||
|
allUsers = allUsers
|
||||||
|
.Concat(subUsers)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return allUsers;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// 商铺续费
|
/// 商铺续费
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">续费请求</param>
|
/// <param name="request">续费请求</param>
|
||||||
@@ -230,5 +258,112 @@ namespace KJD_Web.Services.Users
|
|||||||
|
|
||||||
return TimeUtils.DateTimeToTimestampSeconds(newExpireDateTime);
|
return TimeUtils.DateTimeToTimestampSeconds(newExpireDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新用户
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userinfo"></param>
|
||||||
|
/// <exception cref="Exception"></exception>
|
||||||
|
|
||||||
|
public void UpdateUser(CUUserInfoRequest userinfo)
|
||||||
|
{
|
||||||
|
using var work = _freeSql.CreateUnitOfWork();
|
||||||
|
var trFreeSql = work.Orm;
|
||||||
|
var oldUser = trFreeSql.Select<UserEntity>()
|
||||||
|
.Where(a => a.Id == userinfo.Id)
|
||||||
|
.First();
|
||||||
|
|
||||||
|
if (oldUser == null) throw new Exception("错误的用户");
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(userinfo.NickName) || string.IsNullOrEmpty(userinfo.Mobile)) throw new Exception("信息不正确");
|
||||||
|
if (userinfo.Mobile.Length != 11) throw new Exception("信息不正确");
|
||||||
|
|
||||||
|
var update = trFreeSql.Update<UserEntity>();
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.NickName))
|
||||||
|
update = update.Set(a => a.NickName, userinfo.NickName);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.UserName))
|
||||||
|
update = update.Set(a => a.UserName, userinfo.UserName);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.Mobile))
|
||||||
|
update = update.Set(a => a.Mobile, userinfo.Mobile);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.CompanyName))
|
||||||
|
update = update.Set(a => a.CompanyName, userinfo.CompanyName);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.Password))
|
||||||
|
update = update.Set(a => a.Password, userinfo.Password);
|
||||||
|
|
||||||
|
if (userinfo.GroupId.HasValue)
|
||||||
|
update = update.Set(a => a.GroupId, userinfo.GroupId.Value);
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(userinfo.CardId))
|
||||||
|
update = update.Set(a => a.CardId, userinfo.CardId);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(userinfo.Notes))
|
||||||
|
update = update.Set(a => a.Notes, userinfo.Notes);
|
||||||
|
|
||||||
|
if (userinfo.SaLevel.HasValue)
|
||||||
|
update = update.Set(a => a.SaLevel, (short)userinfo.SaLevel.Value);
|
||||||
|
|
||||||
|
if (userinfo.Authority != null)
|
||||||
|
update = update.Set(a => a.Authority, userinfo.Authority);
|
||||||
|
|
||||||
|
if (userinfo.ForbiddenPage != null)
|
||||||
|
update = update.Set(a => a.ForbiddenPage, userinfo.ForbiddenPage);
|
||||||
|
|
||||||
|
if (userinfo.ShopPointsPerMonth.HasValue)
|
||||||
|
update = update.Set(a => a.ShopPointsPerMonth, userinfo.ShopPointsPerMonth.Value);
|
||||||
|
|
||||||
|
if (userinfo.PostagePerOrder.HasValue)
|
||||||
|
update = update.Set(a => a.PostagePerOrder, userinfo.PostagePerOrder.Value);
|
||||||
|
|
||||||
|
if (userinfo.RefundPostagePerOrder.HasValue)
|
||||||
|
update = update.Set(a => a.RefundPostagePerOrder, userinfo.RefundPostagePerOrder.Value);
|
||||||
|
|
||||||
|
if (userinfo.GiftOemAmountPerOrder.HasValue)
|
||||||
|
update = update.Set(a => a.GiftOemAmountPerOrder, userinfo.GiftOemAmountPerOrder.Value);
|
||||||
|
|
||||||
|
//主账户允许修改OEM
|
||||||
|
if (oldUser.IsMainUser)
|
||||||
|
{
|
||||||
|
update = update.Set(a => a.OemId, userinfo.OemId);
|
||||||
|
}
|
||||||
|
string sql = update.Where(a => a.Id == userinfo.Id).ToSql();
|
||||||
|
var updateCount = update
|
||||||
|
.Where(a => a.Id == userinfo.Id)
|
||||||
|
.ExecuteAffrows();
|
||||||
|
|
||||||
|
if (updateCount != 1)
|
||||||
|
{
|
||||||
|
throw new Exception("修改失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldUser.IsMainUser)//主账号允许结算
|
||||||
|
{
|
||||||
|
if (oldUser.OemId != userinfo.OemId)
|
||||||
|
{
|
||||||
|
//更换oem 需要结算
|
||||||
|
if (string.IsNullOrEmpty(oldUser.OemId) == false)
|
||||||
|
{
|
||||||
|
//移除旧Oem
|
||||||
|
var oem = GetOEMByOemId(oldUser.OemId);
|
||||||
|
if (oem != null)
|
||||||
|
{
|
||||||
|
SettleOemFlows(oem.OemOwner, work.GetOrBeginTransaction());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//空OEM 转非空
|
||||||
|
SettleUserFlows(userinfo.UserName, work.GetOrBeginTransaction());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
work.Commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,8 +5,8 @@
|
|||||||
-->
|
-->
|
||||||
<configuration>
|
<configuration>
|
||||||
<connectionStrings>
|
<connectionStrings>
|
||||||
<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;" />
|
<!--<add name="ConnKJD" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-hl51pkfr.sql.tencentcdb.com';Port=27660;User Id='kjd';Password='Temukjd0625';Charset=utf8mb4;" />-->
|
||||||
<!--<add name="ConnKJD" connectionString="Server=192.168.0.200;Port=3306;Database=mysql;Uid=root;Pwd=123456;"/>-->
|
<add name="ConnKJD" connectionString="Server=192.168.0.200;Port=3306;Database=mysql;Uid=root;Pwd=123456;"/>
|
||||||
<add name="ConnKJDBAK" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-9s7x16mt.sql.tencentcdb.com';Port=24049;User Id='kjdbak';Password='Temukjd0126';Charset=utf8mb4;" />
|
<add name="ConnKJDBAK" connectionString="Max Pool Size=512;Database='kjd';Data Source='nj-cynosdbmysql-grp-9s7x16mt.sql.tencentcdb.com';Port=24049;User Id='kjdbak';Password='Temukjd0126';Charset=utf8mb4;" />
|
||||||
<add name="UpdateVersion" connectionString="99999" />
|
<add name="UpdateVersion" connectionString="99999" />
|
||||||
<add name="UpdateFileDir" connectionString="C:\inetpub\wwwroot\kjd_update" />
|
<add name="UpdateFileDir" connectionString="C:\inetpub\wwwroot\kjd_update" />
|
||||||
|
|||||||
@@ -95,5 +95,8 @@ namespace WebServiceTest
|
|||||||
var user = new WXUserManage().GetUserByUserName("18990991234");
|
var user = new WXUserManage().GetUserByUserName("18990991234");
|
||||||
Console.WriteLine(user.sa_level);
|
Console.WriteLine(user.sa_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
using Autofac;
|
||||||
|
using Autofac.Integration.WebApi;
|
||||||
|
using KJD_Web;
|
||||||
|
using KJD_Web.Services.Users;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Timers;
|
||||||
|
using System.Web.Http;
|
||||||
|
|
||||||
|
namespace WebServiceTest;
|
||||||
|
|
||||||
|
public sealed class NUnitDebugListener : TraceListener
|
||||||
|
{
|
||||||
|
public override void Write(string? message)
|
||||||
|
{
|
||||||
|
TestContext.Write(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void WriteLine(string? message)
|
||||||
|
{
|
||||||
|
TestContext.WriteLine(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
internal class UserTest
|
||||||
|
{
|
||||||
|
private static NUnitDebugListener? _listener;
|
||||||
|
private IContainer _container;
|
||||||
|
[SetUp]
|
||||||
|
public void Setup()
|
||||||
|
{
|
||||||
|
_listener = new NUnitDebugListener();
|
||||||
|
Debug.Listeners.Add(_listener);
|
||||||
|
var config = new HttpConfiguration();
|
||||||
|
_container = ContainerConfig.BuildContainer();
|
||||||
|
config.DependencyResolver = new AutofacWebApiDependencyResolver(_container);
|
||||||
|
WebApiConfig.Register(config);
|
||||||
|
}
|
||||||
|
[TearDown]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
_container?.Dispose();
|
||||||
|
_listener.Dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SettleOEM()
|
||||||
|
{
|
||||||
|
var userService = _container.Resolve<UserService>();
|
||||||
|
var oem = userService.SettleOemFlows("13938677077");
|
||||||
|
Console.WriteLine(new
|
||||||
|
{
|
||||||
|
oem.AvailableBalance,
|
||||||
|
oem.TotalRebateAmount,
|
||||||
|
oem.TotalWithdrawAmount
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void SettleUser()
|
||||||
|
{
|
||||||
|
var userService = _container.Resolve<UserService>();
|
||||||
|
var count = userService.SettleUserFlows("15938489009");
|
||||||
|
Console.WriteLine(count);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,8 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Autofac" Version="9.3.2" />
|
||||||
|
<PackageReference Include="Autofac.WebApi2" Version="6.2.0" />
|
||||||
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
<PackageReference Include="coverlet.collector" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.14.0" />
|
<PackageReference Include="NUnit" Version="3.14.0" />
|
||||||
@@ -22,9 +24,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Autofac">
|
|
||||||
<HintPath>..\..\packages\Autofac.9.3.2\lib\netstandard2.0\Autofac.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Microsoft.Bcl.AsyncInterfaces">
|
<Reference Include="Microsoft.Bcl.AsyncInterfaces">
|
||||||
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
<HintPath>..\..\packages\Microsoft.Bcl.AsyncInterfaces.10.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
Reference in new issue
Block a user