修改代码
增加云商品数据
This commit is contained in:
1 parent
2f406c840f
commit
db4f030c17
58 files changed
+1550
-120
No files matched your search
@@ -0,0 +1,81 @@
|
||||
//using MediatR;
|
||||
//using Store.Framework.Models;
|
||||
//using Store.Shops.Contracts;
|
||||
//using Store.Users.Contracts.Dtos;
|
||||
//using Store.Users.Entities;
|
||||
//using Store.Users.Repositories;
|
||||
//using System;
|
||||
//using System.Collections.Generic;
|
||||
//using System.Text;
|
||||
|
||||
//namespace Store.Users.Commands
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 商铺续费
|
||||
// /// </summary>
|
||||
// /// <param name="UserName"></param>
|
||||
// /// <param name="ShopId"></param>
|
||||
// /// <param name="RenewDuration"></param>
|
||||
// internal record class ShopRenewCommand(string UserName, string ShopId, int RenewDuration) : IRequest<ShopRenewResponse>;
|
||||
// internal class ShopRenewCommandHandler : IRequestHandler<ShopRenewCommand, ShopRenewResponse>
|
||||
// {
|
||||
// private readonly IUserRepository _userRepository;
|
||||
// private readonly IShopQueryService _shopQueryService;
|
||||
|
||||
// public ShopRenewCommandHandler(IUserRepository userRepository, IShopQueryService shopQueryService)
|
||||
// {
|
||||
// _userRepository = userRepository;
|
||||
// _shopQueryService = shopQueryService;
|
||||
// }
|
||||
// async Task<ShopRenewResponse> IRequestHandler<ShopRenewCommand, ShopRenewResponse>.Handle(ShopRenewCommand request, CancellationToken cancellationToken)
|
||||
// {
|
||||
// ShopRenewResponse response = new ShopRenewResponse();
|
||||
// var user = await _userRepository.GetUser(request.UserName);
|
||||
// int shopPointsPerMonth = Math.Max(30, user.ShopPointsPerMonth);
|
||||
// int deltaPoints = shopPointsPerMonth * request.RenewDuration;
|
||||
// int newPoints = (int)user.Points - deltaPoints;
|
||||
// DateTime expireTime = _shopQueryService.GetExpireTime(request.ShopId);
|
||||
|
||||
|
||||
// if (currentExpire != null && currentExpire.ExpireTime > 0)
|
||||
// {
|
||||
// DateTime currentExpireTime = TimeUtils.StampToDateTime(currentExpire.ExpireTime);
|
||||
// if (currentExpireTime > expireBaseTime)
|
||||
// {
|
||||
// expireBaseTime = currentExpireTime;
|
||||
// }
|
||||
// }
|
||||
|
||||
// int newExpireTime = CalculateNewExpireTime(expireBaseTime, request.RenewDuration);
|
||||
|
||||
|
||||
|
||||
// response.ShopId = request.ShopId;
|
||||
// response.UserPoints = newPoints;
|
||||
// response.ExpireTime = newExpireTime;
|
||||
// return response;
|
||||
// }
|
||||
// private int CalculateNewExpireTime(DateTime expireBaseTime, int renewDuration)
|
||||
// {
|
||||
// DateTime newExpireDateTime;
|
||||
// try
|
||||
// {
|
||||
// newExpireDateTime = expireBaseTime.AddMonths(renewDuration);
|
||||
// }
|
||||
// catch (ArgumentOutOfRangeException)
|
||||
// {
|
||||
// throw new InvalidOperationException("续费时长超出允许范围");
|
||||
// }
|
||||
|
||||
// if (newExpireDateTime > TimeUtils.StampToDateTime(int.MaxValue))
|
||||
// {
|
||||
// throw new InvalidOperationException("续费时间超出系统支持范围");
|
||||
// }
|
||||
|
||||
// return TimeUtils.DateTimeToTimestampSeconds(newExpireDateTime);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
//}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Asp.Versioning;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Store.Users.Contracts;
|
||||
using Store.Users.Contracts.Dtos;
|
||||
using Store.Users.Services;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Store.Users.Controllers
|
||||
{
|
||||
[ApiController]
|
||||
[ApiVersionNeutral]
|
||||
[Route("user/[action]")]
|
||||
public class UserController : ControllerBase
|
||||
{
|
||||
private readonly IUserQueryService _userQuery;
|
||||
|
||||
public UserController(IUserQueryService userQuery)
|
||||
{
|
||||
_userQuery = userQuery;
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<UserInfo> GetUser(string userName)
|
||||
{
|
||||
return await _userQuery.GetUser(userName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Store.Users.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户续费商铺
|
||||
/// </summary>
|
||||
public class ShopRenewRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 店铺ID
|
||||
/// </summary>
|
||||
public string ShopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 续费时长数值,例如 3;范围 1-120 个月
|
||||
/// </summary>
|
||||
public int RenewDuration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Store.Users.Contracts.Dtos
|
||||
{
|
||||
public class ShopRenewResponse
|
||||
{
|
||||
public string ShopId { get; set; }
|
||||
public int ExpireTime { get; set; }
|
||||
public int UserPoints { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Store.Users.Entities;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// OEM贴牌表
|
||||
/// </summary>
|
||||
[Table(Name = "wxxd.oem")]
|
||||
public class OEMEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
[Column(Name = "id", IsPrimary = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// oem_id
|
||||
/// </summary>
|
||||
[Column(Name = "oem_id")]
|
||||
public string OemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 贴牌名称
|
||||
/// </summary>
|
||||
[Column(Name = "oem_name")]
|
||||
public string OemName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 贴牌管理人主账户
|
||||
/// </summary>
|
||||
[Column(Name = "oem_owner")]
|
||||
public string OemOwner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Column(Name = "oem_icon")]
|
||||
public string OemIcon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 题图
|
||||
/// </summary>
|
||||
[Column(Name = "oem_img")]
|
||||
public string OemImg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// add_time
|
||||
/// </summary>
|
||||
[Column(Name = "add_time")]
|
||||
public DateTime AddTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// mdy_time
|
||||
/// </summary>
|
||||
[Column(Name = "mdy_time")]
|
||||
public DateTime MdyTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// is_del
|
||||
/// </summary>
|
||||
[Column(Name = "is_del")]
|
||||
public byte IsDel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可提现余额,单位分
|
||||
/// </summary>
|
||||
[Column(Name = "available_balance")]
|
||||
public long AvailableBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 冻结余额,单位分
|
||||
/// </summary>
|
||||
[Column(Name = "frozen_balance")]
|
||||
public long FrozenBalance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 累计返利金额,单位分
|
||||
/// </summary>
|
||||
[Column(Name = "total_rebate_amount")]
|
||||
public long TotalRebateAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 累计提现金额,单位分
|
||||
/// </summary>
|
||||
[Column(Name = "total_withdraw_amount")]
|
||||
public long TotalWithdrawAmount { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,175 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
|
||||
namespace Store.Users.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户表
|
||||
/// </summary>
|
||||
[Table(Name = "wxxd.user")]
|
||||
public class UserEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// ID
|
||||
/// </summary>
|
||||
[Column(Name = "id", IsPrimary = true, IsIdentity = true)]
|
||||
public int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户昵称
|
||||
/// </summary>
|
||||
[Column(Name = "nick_name")]
|
||||
public string NickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名称(登录账户)
|
||||
/// </summary>
|
||||
[Column(Name = "user_name")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录密码
|
||||
/// </summary>
|
||||
[Column(Name = "password")]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// card_id
|
||||
/// </summary>
|
||||
[Column(Name = "card_id")]
|
||||
public string CardId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户分组 3主号 4客服 5加盟 8登录 9采购 10加盟 11上货
|
||||
/// </summary>
|
||||
[Column(Name = "group_id")]
|
||||
public byte GroupId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父账户用户名
|
||||
/// </summary>
|
||||
[Column(Name = "parent_user_name")]
|
||||
public string ParentUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// oem编号,仅oem用户有值
|
||||
/// </summary>
|
||||
[Column(Name = "oem_id")]
|
||||
public string OemId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
/// </summary>
|
||||
[Column(Name = "mobile")]
|
||||
public string Mobile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 添加时间
|
||||
/// </summary>
|
||||
[Column(Name = "add_time")]
|
||||
public DateTime? AddTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
[Column(Name = "mdy_time")]
|
||||
public DateTime? MdyTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 公司名称
|
||||
/// </summary>
|
||||
[Column(Name = "company_name")]
|
||||
public string CompanyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Column(Name = "notes")]
|
||||
public string Notes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 超管等级 0 普通用户 1 超级管理员
|
||||
/// </summary>
|
||||
[Column(Name = "sa_level")]
|
||||
public short? SaLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户权限
|
||||
/// </summary>
|
||||
[Column(Name = "authority")]
|
||||
public string Authority { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子账号被禁止展示的功能页面
|
||||
/// </summary>
|
||||
[Column(Name = "forbidden_page")]
|
||||
public string ForbiddenPage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户积分,1积分=1元
|
||||
/// </summary>
|
||||
[Column(Name = "points")]
|
||||
public decimal Points { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 积分历史累计充值金额
|
||||
/// </summary>
|
||||
[Column(Name = "recharge_points_total")]
|
||||
public decimal? RechargePointsTotal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 店铺每续费一个月需要的积分,单位元
|
||||
/// </summary>
|
||||
[Column(Name = "shop_points_per_month")]
|
||||
public int ShopPointsPerMonth { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 可用余额
|
||||
/// </summary>
|
||||
[Column(Name = "balance")]
|
||||
public decimal? Balance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 累计充值金额
|
||||
/// </summary>
|
||||
[Column(Name = "recharge_amount_total")]
|
||||
public decimal? RechargeAmountTotal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每单中转仓快递费用,单位元,两位小数
|
||||
/// </summary>
|
||||
[Column(Name = "postage_per_order")]
|
||||
public decimal? PostagePerOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 每单中转仓退货快递费用,单位元,两位小数
|
||||
/// </summary>
|
||||
[Column(Name = "refund_postage_per_order")]
|
||||
public decimal? RefundPostagePerOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 礼物每单额外收取费用,单位元,两位小数
|
||||
/// </summary>
|
||||
[Column(Name = "gift_oem_amount_per_order")]
|
||||
public decimal? GiftOemAmountPerOrder { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 同步物流费用,单位元,两位小数
|
||||
/// </summary>
|
||||
[Column(Name = "sync_logistics_per_order")]
|
||||
public decimal? SyncLogisticsPerOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否主账户
|
||||
/// </summary>
|
||||
public bool IsMainUser
|
||||
{
|
||||
get => string.IsNullOrWhiteSpace(ParentUserName);
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否OEM租户
|
||||
/// </summary>
|
||||
public bool IsOEMTenant => !string.IsNullOrWhiteSpace(OemId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Store.Users.Entities;
|
||||
|
||||
[Table(Name = "wxxd.user_payment_record")]
|
||||
public class UserPaymentRecordEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
[Column(Name = "id", IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 变动类型,1:充值,2:采购花费,3:产品退款到账,4:运费退款到账,5:采购收款,6:产品退款扣除,7:运费退款扣除, 16:礼物单话费,20:中转仓扣费支出,23:中转仓退款收入
|
||||
/// </summary>
|
||||
[Column(Name = "type")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 金额(元)
|
||||
/// </summary>
|
||||
[Column(Name = "amount")]
|
||||
public decimal? Amount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 归属oem用户的金额
|
||||
/// </summary>
|
||||
[Column(Name = "oem_amount")]
|
||||
public decimal? OemAmount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 余额(元)
|
||||
/// </summary>
|
||||
[Column(Name = "balance")]
|
||||
public decimal? Balance { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 账户名
|
||||
/// </summary>
|
||||
[Column(Name = "user_name")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 平台编码
|
||||
/// </summary>
|
||||
[Column(Name = "platform_code")]
|
||||
public string PlatformCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 订单id
|
||||
/// </summary>
|
||||
[Column(Name = "order_id")]
|
||||
public string OrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 售后单id
|
||||
/// </summary>
|
||||
[Column(Name = "after_sale_id")]
|
||||
public long? AfterSaleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[Column(Name = "create_by")]
|
||||
public string CreateBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Column(Name = "create_time")]
|
||||
public DateTime CreateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改人
|
||||
/// </summary>
|
||||
[Column(Name = "update_by")]
|
||||
public string UpdateBy { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
[Column(Name = "update_time")]
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已删除
|
||||
/// </summary>
|
||||
[Column(Name = "is_deleted")]
|
||||
public int IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Column(Name = "remark")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 扣款的对方账户名称
|
||||
/// </summary>
|
||||
[Column(Name = "counterparty_account_name")]
|
||||
public string CounterpartyAccountName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OEM是否结算 0未结算 1已结算
|
||||
/// </summary>
|
||||
[Column(Name = "settlement")]
|
||||
public byte Settlement { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 退款流水号 外采&订单号
|
||||
/// </summary>
|
||||
[Column(Name = "refund_flow_no")]
|
||||
public string RefundFlowNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 结算时间
|
||||
/// </summary>
|
||||
[Column(Name = "settlement_time")]
|
||||
public DateTime? SettlementTime { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
using FreeSql.DataAnnotations;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Store.Users.Entities
|
||||
{
|
||||
|
||||
[Table(Name = "wxxd.user_points_record")]
|
||||
public class UserPointsRecordEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键(自增)
|
||||
/// </summary>
|
||||
[Column(Name = "id", IsPrimary = true, IsIdentity = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名(NOT NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "user_name")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户昵称(NOT NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "user_nick")]
|
||||
public string UserNick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作记录金额,单位元,最小1元(NOT NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "delta_points")]
|
||||
public decimal DeltaPoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 充值或消费后的当前金额(允许 NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "new_points")]
|
||||
public decimal? NewPoints { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型 消费 充值 转入 转出(NOT NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "option_type")]
|
||||
public string OptionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作者类型 管理员 用户(NOT NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "operator_type")]
|
||||
public string OperatorType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际操作者用户名(NOT NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "operator_name")]
|
||||
public string OperatorName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费店铺编号(消费才有值,充值为空,允许 NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "shop_id")]
|
||||
public string? ShopId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 消费店铺名称(消费才有值,充值为空,允许 NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "shop_account")]
|
||||
public string? ShopAccount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注(允许 NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "remark")]
|
||||
public string? Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// (点数转出时的)对方账户(允许 NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "counterparty_account_name")]
|
||||
public string? CounterpartyAccountName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 支付宝订单的外部订单号(允许 NULL)
|
||||
/// </summary>
|
||||
[Column(Name = "out_trade_no")]
|
||||
public string? OutTradeNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 添加时间(NOT NULL,默认 CURRENT_TIMESTAMP)
|
||||
/// </summary>
|
||||
[Column(Name = "add_time")]
|
||||
public DateTime AddTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// OEM是否结算 0未结算 1已结算
|
||||
/// </summary>
|
||||
[Column(Name = "settlement")]
|
||||
public bool Settlement { get; set; }
|
||||
/// <summary>
|
||||
/// 结算时间
|
||||
/// </summary>
|
||||
[Column(Name = "settlement_time")]
|
||||
public DateTime? SettlementTime { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using Riok.Mapperly.Abstractions;
|
||||
using Store.Users.Contracts.Dtos;
|
||||
using Store.Users.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Store.Users.Mappers
|
||||
{
|
||||
[Mapper]
|
||||
internal partial class UserMapper
|
||||
{
|
||||
public partial UserInfo ToInfo(UserEntity entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using FreeSql;
|
||||
using MAX.Core.DependencyInjection;
|
||||
using Store.Users.Contracts.Dtos;
|
||||
using Store.Users.Entities;
|
||||
using Store.Users.Mappers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Store.Users.Repositories
|
||||
{
|
||||
public interface IUserRepository : IBaseRepository<UserEntity>
|
||||
{
|
||||
Task<UserEntity> GetUser(string userName);
|
||||
}
|
||||
internal class UserRepository : BaseRepository<UserEntity>, IUserRepository, ITransientDependency
|
||||
{
|
||||
private readonly IFreeSql _freeSql;
|
||||
|
||||
public UserRepository(IFreeSql freeSql) : base(freeSql)
|
||||
{
|
||||
_freeSql = freeSql;
|
||||
}
|
||||
|
||||
public async Task<UserEntity> GetUser(string userName)
|
||||
{
|
||||
var sql = Where(a => a.UserName == userName).ToSql();
|
||||
var user = await Where(a => a.UserName == userName).FirstAsync();
|
||||
if (user != null)
|
||||
{
|
||||
if (user.IsMainUser == false)
|
||||
{
|
||||
var mainUser = await Where(a => a.UserName == user.ParentUserName).FirstAsync();
|
||||
if (mainUser != null)
|
||||
{
|
||||
user.OemId = mainUser.OemId;
|
||||
user.PostagePerOrder = mainUser.PostagePerOrder;
|
||||
user.RefundPostagePerOrder = mainUser.RefundPostagePerOrder;
|
||||
user.GiftOemAmountPerOrder = mainUser.GiftOemAmountPerOrder;
|
||||
user.SyncLogisticsPerOrder = mainUser.SyncLogisticsPerOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
using MAX.Core.DependencyInjection;
|
||||
using Store.Users.Contracts;
|
||||
using Store.Users.Contracts.Dtos;
|
||||
using Store.Users.Entities;
|
||||
using Store.Users.Mappers;
|
||||
using Store.Users.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Store.Users.Services
|
||||
{
|
||||
internal class UserQueryService : IUserQueryService, ITransientDependency
|
||||
{
|
||||
private readonly IUserRepository _userRepository;
|
||||
|
||||
public UserQueryService(IUserRepository userRepository)
|
||||
{
|
||||
_userRepository = userRepository;
|
||||
}
|
||||
public async Task<UserInfo> GetUser(string userName)
|
||||
{
|
||||
var sql = _userRepository.Where(a => a.UserName == userName).ToSql();
|
||||
var user = await _userRepository.Where(a => a.UserName == userName).FirstAsync();
|
||||
if (user != null)
|
||||
{
|
||||
if (user.IsMainUser == false)
|
||||
{
|
||||
var mainUser = await _userRepository.Where(a => a.UserName == user.ParentUserName).FirstAsync();
|
||||
if (mainUser != null)
|
||||
{
|
||||
user.OemId = mainUser.OemId;
|
||||
user.PostagePerOrder = mainUser.PostagePerOrder;
|
||||
user.RefundPostagePerOrder = mainUser.RefundPostagePerOrder;
|
||||
user.GiftOemAmountPerOrder = mainUser.GiftOemAmountPerOrder;
|
||||
user.SyncLogisticsPerOrder = mainUser.SyncLogisticsPerOrder;
|
||||
}
|
||||
}
|
||||
}
|
||||
return new UserMapper().ToInfo(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using MAX.Core.DependencyInjection;
|
||||
using MAX.Core.Interfaces;
|
||||
|
||||
namespace Store.Users
|
||||
{
|
||||
public class Startup : IStartup
|
||||
{
|
||||
public int Priority => IntPriority.Normal;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
}
|
||||
|
||||
public void Register(IServiceRegistrar registrar)
|
||||
{
|
||||
}
|
||||
|
||||
public void Start(IServiceProvider serviceProvider)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Store.Framework\Store.Framework.csproj" />
|
||||
<ProjectReference Include="..\Store.Shops.Contracts\Store.Shops.Contracts.csproj" />
|
||||
<ProjectReference Include="..\Store.Users.Contracts\Store.Users.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in new issue
Block a user