diff --git a/README.md b/README.md index ebf7270..7ea4c0d 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ # 在解决方案下运行 docker build -t miaoyu:dev-0.0.3 -f src/2-api/HuanMeng.MiaoYu.WebApi/Dockerfile . docker build -t miaoyu:dev-0.0.4 --build-arg VERSION=7.0 --build-arg TARGET=dev -f src/2-api/HuanMeng.MiaoYu.WebApi/Dockerfile . -docker build -t miaoyuapi:dev-1.2.7 --build-arg VERSION=1.2.7 --build-arg TARGET=dev -f src/2-api/HuanMeng.MiaoYu.WebApi/Dockerfile . +docker build -t miaoyuapi:dev-1.2.8 -t miaoyuapi:latest -t 123.207.203.228:92/miaoyuapi:dev-1.2.8 -t 123.207.203.228:92/miaoyuapi:latest --build-arg VERSION=1.2.8 --build-arg TARGET=dev -f src/2-api/HuanMeng.MiaoYu.WebApi/Dockerfile . +docker push 123.207.203.228:92/miaoyuapi:dev-1.2.8 +docker push 123.207.203.228:92/miaoyuapi:latest docker tag miaoyuapi:dev-1.2.7 123.207.203.228:92/miaoyuapi:dev-1.2.7 docker push 123.207.203.228:92/miaoyuapi:dev-1.2.7 //docker build -t myregistry.com/myusername/myapp:v1.0 . diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/CharacterEntityCache.cs b/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/CharacterEntityCache.cs index d157f7b..4aceb50 100644 --- a/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/CharacterEntityCache.cs +++ b/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/CharacterEntityCache.cs @@ -17,7 +17,7 @@ namespace HuanMeng.MiaoYu.Code.Cache.Special public class CharacterEntityCache(CacheBase cacheBase, object CharacterCacheLock) : MiaoYuDataEntityCache(cacheBase, CharacterCacheLock) { /// - /// 锁 + /// /// private IMapper mapper = cacheBase.Mapper; diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/ProductEntityCache.cs b/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/ProductEntityCache.cs new file mode 100644 index 0000000..6030ecb --- /dev/null +++ b/src/0-core/HuanMeng.MiaoYu.Code/Cache/Special/ProductEntityCache.cs @@ -0,0 +1,150 @@ +using AutoMapper; + +using HuanMeng.MiaoYu.Code.Cache.Contract; +using HuanMeng.MiaoYu.Model.Dto.Account; +using HuanMeng.MiaoYu.Model.Dto.Cache; +using HuanMeng.MiaoYu.Model.Dto.Shop; +using HuanMeng.MiaoYu.Model.EnumModel.Product; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HuanMeng.MiaoYu.Code.Cache.Special +{ + /// + /// + /// + /// + public class ProductEntityCache(CacheBase cacheBase) : MiaoYuDataEntityCache(cacheBase, _productLock) + { + /// + /// + /// + private IMapper mapper = cacheBase.Mapper; + private static object _productLock = new object(); + /// + /// 获取缓存数据 + /// + /// + public override List GetDataList() + { + var list = _dao.daoDbMiaoYu.context.T_Products.AsNoTracking().Where(it => it.IsProductDelisting == 1).ToList(); + if (list == null) + { + list = new List(); + } + var images = MiaoYuCacheExtend.GetMiaoYuDataEntityCacheList(cacheBase); + var products = mapper.Map>(list); + var rewards = _dao.daoDbMiaoYu.context.T_Products_Reward.AsNoTracking().ToList(); + products.ForEach(product => + { + //获取所有奖励 + var _rewards = rewards.Where(it => it.T_ProductId == product.Id).ToList(); + product.Rewards = _rewards; + if (product.Rewards == null) + { + product.Rewards = new List(); + } + product.ProductImg = images.GetImageUrl(product.ProductImgId); + product.FirstChargeImg = images.GetImageUrl(product.FirstChargeImgId ?? 0); + //product.pr + }); + return products; + } + + + /// + /// + /// + /// + /// + /// + public virtual List GetProductRecharge(int productType, Dictionary userOrderBy) + { + if (userOrderBy == null) + { + userOrderBy = new Dictionary(); + } + //string key = $"Cache:{_dao.daoDbMiaoYu.context.TenantInfo?.TenantId}:MiaoYu:Product:${productType}"; + var list = this.DataList; + var productCaches = list.Where(it => it.ProductType == productType).ToList(); + List currencyRecharge = new List(); + if (productCaches != null && productCaches.Count > 0) + { + foreach (var product in productCaches) + { + var currencyCount = product.Rewards.Where(it => it.CurrencyType == (int)UserCurrencyType.语珠).Sum(it => it.Money); + var imgUrl = product.ProductImg; + var price = product.Price; + if (product.IsFirstCharge && userOrderBy.ContainsKey(product.ProductId)) + { + imgUrl = product.FirstChargeImg; + currencyCount = product.Rewards.Where(it => it.CurrencyType == (int)UserCurrencyType.语珠).Select(it => it.Money + it.FirstChargeMoney).Sum() ?? 0; + price = product.FirstChargePrice ?? 0; + } + var t = new CurrencyRecharge() + { + Id = product.Id, + Price = price, + ProductId = product.ProductId, + CurrencyType = product.ProductType, + Discount = "", + CurrencyCount = currencyCount, + ImgUrl = imgUrl, + }; + currencyRecharge.Add(t); + } + } + return currencyRecharge; + } + + /// + /// + /// + /// + /// + public virtual List GetMallItemDto(Dictionary userOrderBy) + { + List mallItemDtos = new List(); + if (userOrderBy == null) + { + userOrderBy = new Dictionary(); + } + var list = this.DataList; + var productCaches = list.Where(it => it.ProductType == (int)ProductType.记忆卡).ToList(); + + if (productCaches != null && productCaches.Count > 0) + { + foreach (var product in productCaches) + { + + var imgUrl = product.ProductImg; + var price = product.Price; + if (product.IsFirstCharge && userOrderBy.ContainsKey(product.ProductId)) + { + imgUrl = product.FirstChargeImg; + + price = product.FirstChargePrice ?? 0; + } + var t = new MallItemDto() + { + + Price = price, + ProductId = product.ProductId, + PriceType = 0, + ProductName = product.ProductName, + PropName = product.ProductName, + PropId = product.Id, + PropType = (int)ProductType.记忆卡, + ImgUrl = imgUrl, + }; + mallItemDtos.Add(t); + } + } + return mallItemDtos; + } + } +} diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Mall/ProductBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Mall/ProductBLL.cs new file mode 100644 index 0000000..9a98cfe --- /dev/null +++ b/src/0-core/HuanMeng.MiaoYu.Code/Mall/ProductBLL.cs @@ -0,0 +1,63 @@ +using HuanMeng.MiaoYu.Code.Cache.Special; +using HuanMeng.MiaoYu.Model.Dto.Account; +using HuanMeng.MiaoYu.Model.Dto.Shop; +using HuanMeng.MiaoYu.Model.EnumModel.Product; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HuanMeng.MiaoYu.Code.Mall +{ + /// + /// + /// + public class ProductBLL : MiaoYuBase + { + public ProductBLL(IServiceProvider serviceProvider) : base(serviceProvider) + { + } + /// + /// 获取我的页面产品列表 + /// + /// + + public async Task> GetMyAccountInfoList() + { + MyAccountInfoDto myAccountInfoDto = new MyAccountInfoDto(); + if (_UserId == 0) + { + + myAccountInfoDto.Currency = 0; + } + else + { + UserInfoBLL user = new UserInfoBLL(Dao, _UserId); + myAccountInfoDto.Currency = user[UserCurrencyType.语珠]?.CurrencyMoney ?? 0; + } + ProductEntityCache productEntityCache = new ProductEntityCache(this); + var list = productEntityCache.GetProductRecharge((int)ProductType.我的页面, null); + myAccountInfoDto.CurrencyRechargeList = list; + return new BaseResponse(ResonseCode.Success, "", myAccountInfoDto); + + } + + /// + /// + /// + /// + public async Task> GetShopInfoListAsync() + { + ShopInfoDto myAccountInfoDto = new ShopInfoDto(); + UserInfoBLL user = new UserInfoBLL(Dao, _UserId); + ProductEntityCache productEntityCache = new ProductEntityCache(this); + var list = productEntityCache.GetMallItemDto(null); + myAccountInfoDto.Mall = list; + myAccountInfoDto.Purchased = new List(); + return new BaseResponse(ResonseCode.Success, "", myAccountInfoDto); + } + + } +} diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Mall/ShoppingMallBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Mall/ShoppingMallBLL.cs deleted file mode 100644 index ab77ccf..0000000 --- a/src/0-core/HuanMeng.MiaoYu.Code/Mall/ShoppingMallBLL.cs +++ /dev/null @@ -1,52 +0,0 @@ -using HuanMeng.DotNetCore.Base; -using HuanMeng.MiaoYu.Code.Cache; -using HuanMeng.MiaoYu.Model.Dto.Shop; -using HuanMeng.MiaoYu.Model.EnumModel.ShoppingMall; - -using Microsoft.EntityFrameworkCore; - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HuanMeng.MiaoYu.Code.Mall -{ - /// - /// 商城 - /// - /// - public class ShoppingMallBLL(IServiceProvider serviceProvider) : MiaoYuBase(serviceProvider) - { - /// - /// 获取商城列表 - /// - /// - public async Task> GetShoppingMall() - { - BaseResponse baseResponse = new BaseResponse() { }; - baseResponse.Data = new ShopInfoDto(); - var list = await Dao.daoDbMiaoYu.context.T_ShoppingMall.Where(it => it.PropType == (int)MallPropType.商城 && it.IsProductDelisting == 0).OrderBy(it => it.PropId).ToListAsync(); - //MallItemDto - List mallItemDtos = new List(); - list.ForEach(it => - { - MallItemDto mallItemDto = new MallItemDto() - { - PropId = it.Id, - //PropCount = 9999, - PriceType = it.PropType, - ImgUrl = it.PropImgId.GetImageUrl(MiaoYuCache), - PropName = it.PropName, - Price = it.Price, - PropType = it.PropType, - - }; - mallItemDtos.Add(mallItemDto); - }); - baseResponse.Data.Mall = mallItemDtos; - return baseResponse; - } - } -} diff --git a/src/0-core/HuanMeng.MiaoYu.Code/Users/UserBLL.cs b/src/0-core/HuanMeng.MiaoYu.Code/Users/UserBLL.cs index 8964810..e6140b0 100644 --- a/src/0-core/HuanMeng.MiaoYu.Code/Users/UserBLL.cs +++ b/src/0-core/HuanMeng.MiaoYu.Code/Users/UserBLL.cs @@ -110,9 +110,13 @@ namespace HuanMeng.MiaoYu.Code.Users var user = await Dao.daoDbMiaoYu.context.T_User.FirstOrDefaultAsync(it => it.Id == _UserId); var userData = await Dao.daoDbMiaoYu.context.T_User_Data.FirstOrDefaultAsync(it => it.Id == _UserId); //获取用户余额 - var Currency = user.GetUserCurrencyMoney(UserCurrencyType.付费币, Dao); - var RemainingChatCount = user.GetUserCurrencyMoney(UserCurrencyType.聊天次数, Dao); - var memoryCard = user.GetUserCurrencyMoney(UserCurrencyType.记忆卡, Dao); + UserInfoBLL userInfoBLL = new UserInfoBLL(Dao, _UserId); + var Currency = userInfoBLL[UserCurrencyType.语珠]?.CurrencyMoney; + //var Currency = user.GetUserCurrencyMoney(UserCurrencyType.语珠, Dao); + var RemainingChatCount = userInfoBLL[UserCurrencyType.聊天次数].CurrencyMoney; + //var RemainingChatCount = user.GetUserCurrencyMoney(UserCurrencyType.聊天次数, Dao); + var memoryCard = userInfoBLL[UserCurrencyType.记忆卡].CurrencyMoney; + //var memoryCard = user.GetUserCurrencyMoney(UserCurrencyType.记忆卡, Dao); //获取聊天次数 var hasTalked = Dao.daoDbMiaoYu.context.T_User_Chat.Where(it => it.UserId == _UserId && !it.IsDelete && it.TotalToken > 0).Count(); List characters = new List(); diff --git a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/MiaoYuContext.cs b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/MiaoYuContext.cs index 2eeb00c..f17bb41 100644 --- a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/MiaoYuContext.cs +++ b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/MiaoYuContext.cs @@ -111,7 +111,12 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext /// /// 商城表 /// - public virtual DbSet T_ShoppingMall { get; set; } + public virtual DbSet T_Products { get; set; } + + /// + /// 产品表奖励 + /// + public virtual DbSet T_Products_Reward { get; set; } /// /// 交易记录表 @@ -606,37 +611,37 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext } }); - modelBuilder.Entity(entity => + modelBuilder.Entity(entity => { - entity.HasKey(e => e.Id).HasName("PK__T_Shoppi__3214EC07DC10A165"); + entity.HasKey(e => e.Id).HasName("PK__T_Products__3214EC07DC10A165"); entity.ToTable(tb => tb.HasComment("商城表")); - entity.Property(e => e.Id) - .ValueGeneratedNever() - .HasComment("道具Id"); + entity.Property(e => e.Id).HasComment("道具Id"); entity.Property(e => e.CreateTime) .HasComment("创建时间") .HasColumnType("datetime"); + entity.Property(e => e.FirstChargeImgId).HasComment("首充图片"); + entity.Property(e => e.FirstChargePrice) + .HasComment("首充价格") + .HasColumnType("decimal(10, 2)"); + entity.Property(e => e.IsFirstCharge).HasComment("是否有首充"); entity.Property(e => e.IsProductDelisting).HasComment("商品是否下架 0否1是"); - entity.Property(e => e.LaunchDateTime) - .HasComment("商品上架时间") - .HasColumnType("datetime"); + entity.Property(e => e.OrderById).HasComment("排序"); entity.Property(e => e.Price) .HasComment("价格") .HasColumnType("decimal(10, 2)"); - entity.Property(e => e.PropDesc) + entity.Property(e => e.ProductDesc) .HasMaxLength(255) .HasComment("道具描述"); - entity.Property(e => e.PropId) + entity.Property(e => e.ProductId) .HasMaxLength(50) .HasComment("道具Id"); - entity.Property(e => e.PropImgId).HasComment("道具图片配置 图片id"); - entity.Property(e => e.PropName) + entity.Property(e => e.ProductImgId).HasComment("道具图片配置 图片id"); + entity.Property(e => e.ProductName) .HasMaxLength(100) .HasComment("道具名称"); - entity.Property(e => e.PropType).HasComment("道具类型,0商城,1商店"); - entity.Property(e => e.StockCount).HasComment("库存数量"); + entity.Property(e => e.ProductType).HasComment("道具类型,0商城,1商店"); entity.Property(e => e.TenantId).HasComment("租户ID"); entity.Property(e => e.UpdateTime) .HasComment("更新时间") @@ -648,6 +653,26 @@ public partial class MiaoYuContext : MultiTenantDbContext//DbContext } }); + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Id).HasName("PK__T_Produc__3214EC07CE29C08E"); + + entity.ToTable(tb => tb.HasComment("产品表奖励")); + + entity.Property(e => e.CurrencyType).HasComment("奖励类型"); + entity.Property(e => e.FirstChargeMoney).HasComment("首充送多少奖励"); + entity.Property(e => e.Money).HasComment("送多少奖励"); + entity.Property(e => e.ProductId) + .HasMaxLength(50) + .HasComment("所属商品"); + entity.Property(e => e.T_ProductId).HasComment("所属商品"); + //添加全局筛选器 + if (this.TenantInfo != null) + { + entity.HasQueryFilter(it => it.TenantId == this.TenantInfo.TenantId); + } + }); + modelBuilder.Entity(entity => { entity.HasKey(e => e.Id).HasName("PK__Transact__3214EC070BEE5E59"); diff --git a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_ShoppingMall.cs b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_Products.cs similarity index 61% rename from src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_ShoppingMall.cs rename to src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_Products.cs index 31bc523..22895e0 100644 --- a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_ShoppingMall.cs +++ b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_Products.cs @@ -5,33 +5,65 @@ namespace HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu; /// /// 商城表 /// -public partial class T_ShoppingMall: MultiTenantEntity +public partial class T_Products: MultiTenantEntity { /// /// 道具Id /// public virtual int Id { get; set; } + public override Guid TenantId { get; set; } + + /// + /// 道具Id + /// + public virtual string ProductId { get; set; } = null!; + /// /// 道具名称 /// - public virtual string PropName { get; set; } = null!; + public virtual string ProductName { get; set; } = null!; + + /// + /// 道具类型,0商城,1商店 + /// + public virtual int ProductType { get; set; } /// /// 道具描述 /// - public virtual string? PropDesc { get; set; } + public virtual string? ProductDesc { get; set; } + + /// + /// 价格 + /// + public virtual decimal Price { get; set; } /// /// 道具图片配置 图片id /// - public virtual int PropImgId { get; set; } + public virtual int ProductImgId { get; set; } /// /// 商品是否下架 0否1是 /// public virtual int IsProductDelisting { get; set; } + /// + /// 是否有首充 + /// + public virtual bool IsFirstCharge { get; set; } + + /// + /// 首充图片 + /// + public virtual int? FirstChargeImgId { get; set; } + + /// + /// 首充价格 + /// + public virtual decimal? FirstChargePrice { get; set; } + /// /// 创建时间 /// @@ -42,30 +74,8 @@ public partial class T_ShoppingMall: MultiTenantEntity /// public virtual DateTime? UpdateTime { get; set; } - public override Guid TenantId { get; set; } - /// - /// 商品上架时间 + /// 排序 /// - public virtual DateTime? LaunchDateTime { get; set; } - - /// - /// 库存数量 - /// - public virtual int? StockCount { get; set; } - - /// - /// 道具类型,0商城,1商店 - /// - public virtual int PropType { get; set; } - - /// - /// 价格 - /// - public virtual decimal Price { get; set; } - - /// - /// 道具Id - /// - public virtual string PropId { get; set; } = null!; + public virtual int? OrderById { get; set; } } diff --git a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_Products_Reward.cs b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_Products_Reward.cs new file mode 100644 index 0000000..8bffd03 --- /dev/null +++ b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_Products_Reward.cs @@ -0,0 +1,38 @@ +using System; + +namespace HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu; + +/// +/// 产品表奖励 +/// +public partial class T_Products_Reward: MultiTenantEntity +{ + public virtual int Id { get; set; } + + /// + /// 奖励类型 + /// + public virtual int CurrencyType { get; set; } + + /// + /// 送多少奖励 + /// + public virtual int Money { get; set; } + + /// + /// 所属商品 + /// + public virtual int T_ProductId { get; set; } + + /// + /// 首充送多少奖励 + /// + public virtual int? FirstChargeMoney { get; set; } + + /// + /// 所属商品 + /// + public virtual string? ProductId { get; set; } + + public override Guid TenantId { get; set; } + } diff --git a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_User_Currency.cs b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_User_Currency.cs index 9669557..208e18a 100644 --- a/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_User_Currency.cs +++ b/src/0-core/HuanMeng.MiaoYu.Model/DbSqlServer/Db_MiaoYu/T_User_Currency.cs @@ -10,7 +10,7 @@ public partial class T_User_Currency: MultiTenantEntity public virtual int Id { get; set; } /// - /// 货币类型 付费币、免费币 + /// 货币类型 语珠、免费币 /// public virtual int CurrencyType { get; set; } diff --git a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Account/MyAccountInfoDto.cs b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Account/MyAccountInfoDto.cs index 6457ff2..32cbf80 100644 --- a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Account/MyAccountInfoDto.cs +++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Account/MyAccountInfoDto.cs @@ -14,7 +14,7 @@ namespace HuanMeng.MiaoYu.Model.Dto.Account /// /// 我的余额 /// - public int Currency { get; set; } + public decimal Currency { get; set; } /// /// 充值页面信息 @@ -32,6 +32,11 @@ namespace HuanMeng.MiaoYu.Model.Dto.Account /// public int Id { get; set; } + /// + /// 产品Id + /// + public string ProductId { get; set; } + /// /// 金币数量 /// @@ -40,12 +45,12 @@ namespace HuanMeng.MiaoYu.Model.Dto.Account /// /// 价格 /// - public int Price { get; set; } + public decimal Price { get; set; } /// /// 折扣 -0.1 -10% /// - public string Discount { get;set; } + public string Discount { get; set; } /// /// 金币类型 @@ -58,5 +63,5 @@ namespace HuanMeng.MiaoYu.Model.Dto.Account public string? ImgUrl { get; set; } } - + } diff --git a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Cache/ProductCache.cs b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Cache/ProductCache.cs new file mode 100644 index 0000000..8b00c05 --- /dev/null +++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Cache/ProductCache.cs @@ -0,0 +1,33 @@ +using AutoMapper; + +using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HuanMeng.MiaoYu.Model.Dto.Cache +{ + /// + /// 产品列表 + /// + [AutoMap(typeof(T_Products))] + public class ProductCache : T_Products + { + /// + /// 道具图片配置 + /// + public virtual string ProductImg { get; set; } + + /// + /// 首充图片 + /// + public virtual string FirstChargeImg { get; set; } + /// + /// 奖励列表 + /// + public List Rewards { get; set; } + } +} diff --git a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Shop/ShopInfoDto.cs b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Shop/ShopInfoDto.cs index 83bf252..2250c84 100644 --- a/src/0-core/HuanMeng.MiaoYu.Model/Dto/Shop/ShopInfoDto.cs +++ b/src/0-core/HuanMeng.MiaoYu.Model/Dto/Shop/ShopInfoDto.cs @@ -2,6 +2,7 @@ using AutoMapper; using HuanMeng.MiaoYu.Model.DbSqlServer.Db_MiaoYu; using HuanMeng.MiaoYu.Model.Dto.Account; + using System; using System.Collections.Generic; using System.Linq; @@ -37,15 +38,19 @@ namespace HuanMeng.MiaoYu.Model.Dto.Shop ///// //public int PropId { get; set; } + /// + /// 产品Id + /// + public string ProductId { get; set; } /// /// 道具名称 /// public string PropName { get; set; } /// - /// 道具剩余数量 + /// 道具名称 /// - public int PropCount { get; set; } + public string ProductName { get; set; } /// /// 道具类型 diff --git a/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/Product/ProductType.cs b/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/Product/ProductType.cs new file mode 100644 index 0000000..c772e5d --- /dev/null +++ b/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/Product/ProductType.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace HuanMeng.MiaoYu.Model.EnumModel.Product +{ + /// + /// + /// + public enum ProductType + { + /// + /// + /// + 我的页面 = 0, + /// + /// + /// + 记忆卡 = 1 + } +} diff --git a/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/ShoppingMall/MallPropType.cs b/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/ShoppingMall/MallPropType.cs deleted file mode 100644 index 5b42246..0000000 --- a/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/ShoppingMall/MallPropType.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace HuanMeng.MiaoYu.Model.EnumModel.ShoppingMall -{ - /// - ///商城商品类型 - /// - public enum MallPropType - { - 商城 = 0, - 商店 = 1 - } -} diff --git a/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/User/UserCurrencyType.cs b/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/User/UserCurrencyType.cs index e0a8972..ace48c1 100644 --- a/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/User/UserCurrencyType.cs +++ b/src/0-core/HuanMeng.MiaoYu.Model/EnumModel/User/UserCurrencyType.cs @@ -16,9 +16,9 @@ namespace HuanMeng.MiaoYu.Model.EnumModel.User /// 免费币 = 0, /// - /// 付费币 + /// 语珠 /// - 付费币 = 1, + 语珠 = 1, /// /// 聊天次数 /// @@ -27,6 +27,8 @@ namespace HuanMeng.MiaoYu.Model.EnumModel.User /// /// 记忆卡数量 /// - 记忆卡 = 3 + 记忆卡 = 3, + + } } diff --git a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/AccountController.cs b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/AccountController.cs index ad75a6c..8bde8c2 100644 --- a/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/AccountController.cs +++ b/src/2-api/HuanMeng.MiaoYu.WebApi/Controllers/AccountController.cs @@ -2,6 +2,7 @@ using Azure; using HuanMeng.DotNetCore.Base; using HuanMeng.DotNetCore.Utility; +using HuanMeng.MiaoYu.Code.Mall; using HuanMeng.MiaoYu.Code.Other; using HuanMeng.MiaoYu.Code.Users; using HuanMeng.MiaoYu.Model.Dto; @@ -83,8 +84,10 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers [HttpGet] public async Task> GetMyAccount() { - var obj = JsonConvert.DeserializeObject("{\"Currency\":1,\"CurrencyRechargeList\":[{\"Id\":0,\"CurrencyCount\":100,\"Price\":10,\"Discount\":\" 0%\",\"CurrencyType\":0,\"ImgUrl\":\"\"},{\"Id\":1,\"CurrencyCount\":200,\"Price\":20,\"Discount\":\" -10%\",\"CurrencyType\":0,\"ImgUrl\":\"\"}]}"); - return new BaseResponse(ResonseCode.Success, "", obj); + ProductBLL productBLL= new ProductBLL(ServiceProvider); + return await productBLL.GetMyAccountInfoList(); + //var obj = JsonConvert.DeserializeObject("{\"Currency\":1,\"CurrencyRechargeList\":[{\"Id\":0,\"CurrencyCount\":100,\"Price\":10,\"Discount\":\" 0%\",\"CurrencyType\":0,\"ImgUrl\":\"\"},{\"Id\":1,\"CurrencyCount\":200,\"Price\":20,\"Discount\":\" -10%\",\"CurrencyType\":0,\"ImgUrl\":\"\"}]}"); + //return new BaseResponse(ResonseCode.Success, "", obj); } /// @@ -106,8 +109,10 @@ namespace HuanMeng.MiaoYu.WebApi.Controllers [HttpGet] public async Task> GetMallItem() { - var obj = JsonConvert.DeserializeObject("{\"Mall\":[{\"PropId\":1,\"PropName\":\"记忆卡1\",\"PropCount\":100,\"PropType\":0,\"Price\":10,\"PriceType\":0,\"ImgUrl\":\"https://cos.shhuanmeng.com/image/20240718110512.png\"},{\"PropId\":2,\"PropName\":\"记忆卡2\",\"PropCount\":100,\"PropType\":0,\"Price\":20,\"PriceType\":0,\"ImgUrl\":\"https://cos.shhuanmeng.com/image/20240718110518.png\"}],\"Purchased\":[{\"PropId\":2,\"PropName\":\"记忆卡2\",\"PropCount\":100,\"PropType\":0,\"Price\":20,\"PriceType\":0,\"ImgUrl\":\"https://cos.shhuanmeng.com/image/20240718110518.png\",\"BuyingTime\":\"2024-07-09 03:33:09.563\"}]}"); - return new BaseResponse(ResonseCode.Success, "", obj); + ProductBLL productBLL = new ProductBLL(ServiceProvider); + return await productBLL.GetShopInfoListAsync(); + //var obj = JsonConvert.DeserializeObject("{\"Mall\":[{\"PropId\":1,\"PropName\":\"记忆卡1\",\"PropCount\":100,\"PropType\":0,\"Price\":10,\"PriceType\":0,\"ImgUrl\":\"https://cos.shhuanmeng.com/image/20240718110512.png\"},{\"PropId\":2,\"PropName\":\"记忆卡2\",\"PropCount\":100,\"PropType\":0,\"Price\":20,\"PriceType\":0,\"ImgUrl\":\"https://cos.shhuanmeng.com/image/20240718110518.png\"}],\"Purchased\":[{\"PropId\":2,\"PropName\":\"记忆卡2\",\"PropCount\":100,\"PropType\":0,\"Price\":20,\"PriceType\":0,\"ImgUrl\":\"https://cos.shhuanmeng.com/image/20240718110518.png\",\"BuyingTime\":\"2024-07-09 03:33:09.563\"}]}"); + //return new BaseResponse(ResonseCode.Success, "", obj); } ///