From 8ec93dd42fb034d1bfe368e05ddbf98dbbf4c4c3 Mon Sep 17 00:00:00 2001 From: zpc Date: Fri, 8 Aug 2025 16:42:40 +0800 Subject: [PATCH] 333 --- Infrastructure/WebExtensions/LogoExtension.cs | 6 - .../Business/GiftClaimController.cs | 154 ----------------- .../Business/GiftConfigController.cs | 116 ------------- .../Business/GiftUserController.cs | 121 -------------- .../Controllers/CommonController.cs | 26 +-- .../Controllers/WebApiController.cs | 153 ----------------- .../Controllers/WxOpenController.cs | 77 +-------- .../Extensions/SwaggerExtension.cs | 40 ++--- ZR.Admin.WebApi/Program.cs | 12 +- ZR.Admin.WebApi/appsettings.json | 14 +- ZR.Model/Business/Dto/GiftClaimDto.cs | 156 ------------------ ZR.Model/Business/Dto/GiftConfigDto.cs | 28 ---- ZR.Model/Business/Dto/GiftUserDto.cs | 73 -------- ZR.Model/Business/GiftClaim.cs | 83 ---------- ZR.Model/Business/GiftConfig.cs | 32 ---- ZR.Model/Business/GiftUser.cs | 71 -------- ZR.Service/Business/GiftClaimService.cs | 117 ------------- ZR.Service/Business/GiftConfigService.cs | 79 --------- ZR.Service/Business/GiftUserService.cs | 104 ------------ .../IBusinessService/IGiftClaimService.cs | 22 --- .../IBusinessService/IGiftConfigService.cs | 21 --- .../IBusinessService/IGiftUserService.cs | 22 --- 22 files changed, 38 insertions(+), 1489 deletions(-) delete mode 100644 ZR.Admin.WebApi/Controllers/Business/GiftClaimController.cs delete mode 100644 ZR.Admin.WebApi/Controllers/Business/GiftConfigController.cs delete mode 100644 ZR.Admin.WebApi/Controllers/Business/GiftUserController.cs delete mode 100644 ZR.Model/Business/Dto/GiftClaimDto.cs delete mode 100644 ZR.Model/Business/Dto/GiftConfigDto.cs delete mode 100644 ZR.Model/Business/Dto/GiftUserDto.cs delete mode 100644 ZR.Model/Business/GiftClaim.cs delete mode 100644 ZR.Model/Business/GiftConfig.cs delete mode 100644 ZR.Model/Business/GiftUser.cs delete mode 100644 ZR.Service/Business/GiftClaimService.cs delete mode 100644 ZR.Service/Business/GiftConfigService.cs delete mode 100644 ZR.Service/Business/GiftUserService.cs delete mode 100644 ZR.Service/Business/IBusinessService/IGiftClaimService.cs delete mode 100644 ZR.Service/Business/IBusinessService/IGiftConfigService.cs delete mode 100644 ZR.Service/Business/IBusinessService/IGiftUserService.cs diff --git a/Infrastructure/WebExtensions/LogoExtension.cs b/Infrastructure/WebExtensions/LogoExtension.cs index 22dc791..0d1e9af 100644 --- a/Infrastructure/WebExtensions/LogoExtension.cs +++ b/Infrastructure/WebExtensions/LogoExtension.cs @@ -15,12 +15,6 @@ namespace Infrastructure var url = AppSettings.GetConfig("urls"); Console.WriteLine(content); Console.ForegroundColor = ConsoleColor.Blue; - //Console.WriteLine("🎉源码地址: https://gitee.com/izory/ZrAdminNetCore"); - //Console.WriteLine("📖官方文档:http://www.izhaorui.cn"); - //Console.WriteLine("💰打赏作者:http://www.izhaorui.cn/vip"); - //Console.WriteLine("📱移动端体验:http://demo.izhaorui.cn/h5"); - //Console.WriteLine($"Swagger地址:{url}/swagger/index.html"); - //Console.WriteLine($"初始化种子数据地址:{url}/common/InitSeedData"); } } } diff --git a/ZR.Admin.WebApi/Controllers/Business/GiftClaimController.cs b/ZR.Admin.WebApi/Controllers/Business/GiftClaimController.cs deleted file mode 100644 index 89d72ea..0000000 --- a/ZR.Admin.WebApi/Controllers/Business/GiftClaimController.cs +++ /dev/null @@ -1,154 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using ZR.Model.Business.Dto; -using ZR.Model.Business; -using ZR.Service.Business.IBusinessService; -using System.Threading.Tasks; - -//创建时间:2025-07-30 -namespace ZR.Admin.WebApi.Controllers.Business -{ - /// - /// 礼品申领表 - /// - [Route("business/GiftClaim")] - public class GiftClaimController : BaseController - { - /// - /// 礼品申领表接口 - /// - private readonly IGiftClaimService _GiftClaimService; - - public GiftClaimController(IGiftClaimService GiftClaimService) - { - _GiftClaimService = GiftClaimService; - } - - /// - /// 查询礼品申领表列表 - /// - /// - /// - [HttpGet("list")] - [ActionPermissionFilter(Permission = "giftclaim:list")] - public IActionResult QueryGiftClaim([FromQuery] GiftClaimQueryDto parm) - { - var response = _GiftClaimService.GetList(parm); - return SUCCESS(response); - } - - /// - /// 查询礼品申领表列表 - /// - /// - /// - [HttpGet("statistics")] - public IActionResult getGiftClaimStatistics() - { - var nowDate = DateTime.Now.Date; - var nowCount = _GiftClaimService.AsQueryable().Count(); - var shenheCount = _GiftClaimService.AsQueryable().Where(it => it.Status == 0).Count(); - var shenheCount1 = _GiftClaimService.AsQueryable().Where(it => it.Status == 1).Count(); - var shenheCount2 = _GiftClaimService.AsQueryable().Where(it => it.Status == 2).Count(); - return SUCCESS(new { nowCount, shenheCount, shenheCount1, shenheCount2 }); - } - /// - /// 查询礼品申领表详情 - /// - /// - /// - [HttpGet("{Id}")] - [ActionPermissionFilter(Permission = "giftclaim:query")] - public IActionResult GetGiftClaim(int Id) - { - var response = _GiftClaimService.GetInfo(Id); - - var info = response.Adapt(); - return SUCCESS(info); - } - - /// - /// 添加礼品申领表 - /// - /// - [HttpPost] - [ActionPermissionFilter(Permission = "giftclaim:add")] - [Log(Title = "礼品申领记录", BusinessType = BusinessType.INSERT)] - public IActionResult AddGiftClaim([FromBody] GiftClaimDto parm) - { - var modal = parm.Adapt().ToCreate(HttpContext); - - var response = _GiftClaimService.AddGiftClaim(modal); - - return SUCCESS(response); - } - - /// - /// 更新礼品申领表 - /// - /// - [HttpPut] - [ActionPermissionFilter(Permission = "giftclaim:edit")] - [Log(Title = "礼品申领记录", BusinessType = BusinessType.UPDATE)] - public IActionResult UpdateGiftClaim([FromBody] GiftClaimDto parm) - { - var modal = parm.Adapt().ToUpdate(HttpContext); - var response = _GiftClaimService.UpdateGiftClaim(modal); - - return ToResponse(response); - } - - /// - /// 更新礼品申领表 - /// - /// - [HttpPost("editStatus")] - [ActionPermissionFilter(Permission = "giftclaim:editStatus")] - [Log(Title = "礼品申领记录", BusinessType = BusinessType.UPDATE, MessageKey = "giftclaim:status")] - public async Task UpdateGiftClaimStatus([FromQuery] int id, [FromQuery] int status) - { - var model = await _GiftClaimService.AsQueryable().FirstAsync(it => it.Id == id); - if (model == null) - { - return ToResponse(ResultCode.FAIL, "礼品申领数据不存在"); - } - model.Status = status; - model.ReviewAt = DateTime.Now; - var response = await _GiftClaimService.UpdateAsync(model); - return ToResponse(new ApiResult(response ? 200 : 500, "")); - } - - - /// - /// 删除礼品申领表 - /// - /// - [HttpPost("delete/{ids}")] - [ActionPermissionFilter(Permission = "giftclaim:delete")] - [Log(Title = "礼品申领表", BusinessType = BusinessType.DELETE)] - public IActionResult DeleteGiftClaim([FromRoute] string ids) - { - var idArr = Tools.SplitAndConvert(ids); - - return ToResponse(_GiftClaimService.Delete(idArr)); - } - - /// - /// 导出礼品申领表 - /// - /// - [Log(Title = "礼品申领记录", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)] - [HttpGet("export")] - [ActionPermissionFilter(Permission = "giftclaim:export")] - public IActionResult Export([FromQuery] GiftClaimQueryDto parm) - { - var list = _GiftClaimService.ExportList(parm).Result; - if (list == null || list.Count <= 0) - { - return ToResponse(ResultCode.FAIL, "没有要导出的数据"); - } - var result = ExportExcelMini(list, "礼品申领记录", "礼品申领记录"); - return ExportExcel(result.Item2, result.Item1); - } - - } -} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/Business/GiftConfigController.cs b/ZR.Admin.WebApi/Controllers/Business/GiftConfigController.cs deleted file mode 100644 index 883c1fc..0000000 --- a/ZR.Admin.WebApi/Controllers/Business/GiftConfigController.cs +++ /dev/null @@ -1,116 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using ZR.Model.Business.Dto; -using ZR.Model.Business; -using ZR.Service.Business.IBusinessService; -using ZR.Service.Business; - -//创建时间:2025-07-30 -namespace ZR.Admin.WebApi.Controllers.Business -{ - /// - /// 礼品小程序 - /// - [Route("business/GiftConfig")] - public class GiftConfigController : BaseController - { - /// - /// 礼品小程序接口 - /// - private readonly IGiftConfigService _GiftConfigService; - - public GiftConfigController(IGiftConfigService GiftConfigService) - { - _GiftConfigService = GiftConfigService; - } - - /// - /// 查询礼品小程序列表 - /// - /// - /// - [HttpGet("list")] - [ActionPermissionFilter(Permission = "giftconfig:list")] - public IActionResult QueryGiftConfig([FromQuery] GiftConfigQueryDto parm) - { - var response = _GiftConfigService.GetList(parm); - return SUCCESS(response); - } - - - /// - /// 查询礼品小程序详情 - /// - /// - /// - [HttpGet("{Id}")] - [ActionPermissionFilter(Permission = "giftconfig:query")] - public IActionResult GetGiftConfig(int? Id) - { - var t = _GiftConfigService.Count(it => true); - GiftConfigDto info = new GiftConfigDto(); - if (t > 0) - { - var response = _GiftConfigService.GetFirst(it => true); - info = response.Adapt(); - - } - else - { - var tt = _GiftConfigService.AddGiftConfig(new GiftConfig() - { - HomeImage = "", - Extend = "", - Extend1 = "", - }); - info = tt.Adapt(); - } - return SUCCESS(info); - } - - /// - /// 添加礼品小程序 - /// - /// - [HttpPost] - [ActionPermissionFilter(Permission = "giftconfig:add")] - [Log(Title = "礼品小程序", BusinessType = BusinessType.INSERT)] - public IActionResult AddGiftConfig([FromBody] GiftConfigDto parm) - { - var modal = parm.Adapt().ToCreate(HttpContext); - - var response = _GiftConfigService.AddGiftConfig(modal); - - return SUCCESS(response); - } - - /// - /// 更新礼品小程序 - /// - /// - [HttpPut] - [ActionPermissionFilter(Permission = "giftconfig:edit")] - [Log(Title = "礼品小程序", BusinessType = BusinessType.UPDATE)] - public IActionResult UpdateGiftConfig([FromBody] GiftConfigDto parm) - { - var modal = parm.Adapt().ToUpdate(HttpContext); - var response = _GiftConfigService.UpdateGiftConfig(modal); - - return ToResponse(response); - } - - /// - /// 删除礼品小程序 - /// - /// - [HttpPost("delete/{ids}")] - [ActionPermissionFilter(Permission = "giftconfig:delete")] - [Log(Title = "礼品小程序", BusinessType = BusinessType.DELETE)] - public IActionResult DeleteGiftConfig([FromRoute] string ids) - { - var idArr = Tools.SplitAndConvert(ids); - - return ToResponse(_GiftConfigService.Delete(idArr, "删除礼品小程序")); - } - - } -} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/Business/GiftUserController.cs b/ZR.Admin.WebApi/Controllers/Business/GiftUserController.cs deleted file mode 100644 index 9736011..0000000 --- a/ZR.Admin.WebApi/Controllers/Business/GiftUserController.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using ZR.Model.Business.Dto; -using ZR.Model.Business; -using ZR.Service.Business.IBusinessService; - -//创建时间:2025-07-30 -namespace ZR.Admin.WebApi.Controllers.Business -{ - /// - /// 微信用户表 - /// - [Route("business/GiftUser")] - public class GiftUserController : BaseController - { - /// - /// 微信用户表接口 - /// - private readonly IGiftUserService _GiftUserService; - - public GiftUserController(IGiftUserService GiftUserService) - { - _GiftUserService = GiftUserService; - } - - /// - /// 查询微信用户表列表 - /// - /// - /// - [HttpGet("list")] - [ActionPermissionFilter(Permission = "giftuser:list")] - public IActionResult QueryGiftUser([FromQuery] GiftUserQueryDto parm) - { - var response = _GiftUserService.GetList(parm); - return SUCCESS(response); - } - - - /// - /// 查询微信用户表详情 - /// - /// - /// - [HttpGet("{Id}")] - [ActionPermissionFilter(Permission = "giftuser:query")] - public IActionResult GetGiftUser(int Id) - { - var response = _GiftUserService.GetInfo(Id); - - var info = response.Adapt(); - return SUCCESS(info); - } - - /// - /// 添加微信用户表 - /// - /// - [HttpPost] - [ActionPermissionFilter(Permission = "giftuser:add")] - [Log(Title = "微信用户表", BusinessType = BusinessType.INSERT)] - public IActionResult AddGiftUser([FromBody] GiftUserDto parm) - { - parm.CreateTime= DateTime.Now; - parm.UpdateTime= DateTime.Now; - var modal = parm.Adapt().ToCreate(HttpContext); - - var response = _GiftUserService.AddGiftUser(modal); - - return SUCCESS(response); - } - - /// - /// 更新微信用户表 - /// - /// - [HttpPut] - [ActionPermissionFilter(Permission = "giftuser:edit")] - [Log(Title = "微信用户表", BusinessType = BusinessType.UPDATE)] - public IActionResult UpdateGiftUser([FromBody] GiftUserDto parm) - { - parm.UpdateTime = DateTime.Now; - var modal = parm.Adapt().ToUpdate(HttpContext); - var response = _GiftUserService.UpdateGiftUser(modal); - - return ToResponse(response); - } - - /// - /// 删除微信用户表 - /// - /// - [HttpPost("delete/{ids}")] - [ActionPermissionFilter(Permission = "giftuser:delete")] - [Log(Title = "微信用户表", BusinessType = BusinessType.DELETE)] - public IActionResult DeleteGiftUser([FromRoute]string ids) - { - var idArr = Tools.SplitAndConvert(ids); - - return ToResponse(_GiftUserService.Delete(idArr)); - } - - /// - /// 导出微信用户表 - /// - /// - [Log(Title = "微信用户表", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)] - [HttpGet("export")] - [ActionPermissionFilter(Permission = "giftuser:export")] - public IActionResult Export([FromQuery] GiftUserQueryDto parm) - { - var list = _GiftUserService.ExportList(parm).Result; - if (list == null || list.Count <= 0) - { - return ToResponse(ResultCode.FAIL, "没有要导出的数据"); - } - var result = ExportExcelMini(list, "微信用户表", "微信用户表"); - return ExportExcel(result.Item2, result.Item1); - } - - } -} \ No newline at end of file diff --git a/ZR.Admin.WebApi/Controllers/CommonController.cs b/ZR.Admin.WebApi/Controllers/CommonController.cs index 88e6d40..cd3a304 100644 --- a/ZR.Admin.WebApi/Controllers/CommonController.cs +++ b/ZR.Admin.WebApi/Controllers/CommonController.cs @@ -25,10 +25,7 @@ namespace ZR.Admin.WebApi.Controllers private IWebHostEnvironment WebHostEnvironment; private ISysFileService SysFileService; private readonly IStringLocalizer _localizer; - /// - /// 礼品小程序接口 - /// - private readonly IGiftConfigService _GiftConfigService; + /// /// /// @@ -40,14 +37,14 @@ namespace ZR.Admin.WebApi.Controllers IStringLocalizer stringLocalizer, IOptions options, IWebHostEnvironment webHostEnvironment, - ISysFileService fileService, - IGiftConfigService GiftConfigService) + ISysFileService fileService + ) { WebHostEnvironment = webHostEnvironment; SysFileService = fileService; OptionsSetting = options.Value; _localizer = stringLocalizer; - _GiftConfigService = GiftConfigService; + } /// @@ -60,22 +57,9 @@ namespace ZR.Admin.WebApi.Controllers public IActionResult Index() { var hello = _localizer["hello"].Value; - return Ok($"{hello}看到这里页面说明你已经成功启动了本项目:)\n\n" + - "如果觉得项目有用,打赏作者喝杯咖啡作为奖励\n☛☛http://www.izhaorui.cn/vip\n"); + return Ok($"请求成功-》" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } - /// - /// home - /// - /// - [Route("/config")] - [HttpGet] - [AllowAnonymous] - public async Task GetConfig() - { - var response = _GiftConfigService.GetFirst(it => true); - return new { home = (response?.HomeImage ?? "") }; - } /// /// 查询IP信息 diff --git a/ZR.Admin.WebApi/Controllers/WebApiController.cs b/ZR.Admin.WebApi/Controllers/WebApiController.cs index 112e77a..e30af06 100644 --- a/ZR.Admin.WebApi/Controllers/WebApiController.cs +++ b/ZR.Admin.WebApi/Controllers/WebApiController.cs @@ -21,158 +21,5 @@ namespace ZR.Admin.WebApi.Controllers public class WebApiController : BaseController { private readonly WechatApiClient _client; - /// - /// 礼品申领表接口 - /// - private readonly IGiftClaimService _GiftClaimService; - /// - /// 微信用户表接口 - /// - private readonly IGiftUserService _GiftUserService; - public WebApiController(WechatApiClient client, IGiftUserService GiftUserService, IGiftClaimService giftClaimService) - { - _client = client; - _GiftUserService = GiftUserService; - _GiftClaimService = giftClaimService; - } - - - - /// - /// 1 - /// - /// - /// - /// - [HttpPost()] - [Route("/userLogin")] - [AllowAnonymous] - public async Task GetOpenId([FromQuery] string code) - { - var response = await _client.ExecuteSnsJsCode2SessionAsync(new SnsJsCode2SessionRequest - { - JsCode = code, - GrantType = "authorization_code" - }); - if (!response.IsSuccessful()) - { - throw new Exception($"获取OpenId失败: {response.ErrorMessage}"); // 可以根据需要处理异常 - } - var openId = response.OpenId; - var user = await _GiftUserService.AsQueryable().Where(it => it.Openid == openId).FirstAsync(); - if (user == null) - { - user = new GiftUser() - { - AvatarUrl = "", - CreateTime = DateTime.Now, - Nickname = "微信用户", - Openid = openId, - UpdateTime = DateTime.Now, - LastLoginTime = DateTime.Now, - Phone = "", - Status = "0", - Unionid = "" - }; - _GiftUserService.AddGiftUser(user); - } - return SUCCESS(new { user_id = user.Id }); - - } - [HttpGet("/getRecord")] - [AllowAnonymous] - public async Task GetRecord([FromQuery] int userId) - { - if (userId == 0) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "用户不存在"); - } - var user = await _GiftUserService.AsQueryable().Where(it => it.Id == userId).FirstAsync(); - if (user == null) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "用户不存在"); - } - var list = await _GiftClaimService.AsQueryable().Where(it => it.UserId == userId).OrderByDescending(it => it.Id).ToListAsync(); - List list1 = new List(); - list?.ForEach(it => - { - list1.Add(new - { - it.Status, - it.Name, - it.Address, - it.Phone, - time = it.CreatedAt?.ToString("yyyy-MM-dd") - }); - }); - return SUCCESS(list1); - } - public static string domainUrl = AppSettings.GetConfig("ALIYUN_OSS:domainUrl"); - [HttpPost()] - [Route("/addRecord")] - [AllowAnonymous] - public async Task AddRecord([FromBody] AddGiftClaimDto giftClaim) - { - if (giftClaim.UserId == 0) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "用户不存在"); - } - var user = await _GiftUserService.AsQueryable().Where(it => it.Id == giftClaim.UserId).FirstAsync(); - if (user == null) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "用户不存在"); - } - var images = ImageConverter.Base64ToImageBytes(giftClaim.ProductImage); - if (images.Length == 0) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "图片上传失败"); - } - var imageprx = ImageConverter.GetFileExtensionFromBase64(giftClaim.ProductImage); - var imageName = ImageConverter.GenerateImageFileName(imageprx); - var filePath = "gift/" + DateTime.Now.ToString("yyyy/MMdd/"); - //备份一下本地 - var finalPath = filePath + imageName; - if (!string.IsNullOrEmpty(domainUrl)) - { - var statusCode = AliyunOssHelper.PutObjectFromFile(new MemoryStream(images), finalPath, ""); - } - - try - { - var path = Path.GetFullPath(filePath); - if (!Directory.Exists(path)) - { - Directory.CreateDirectory(path); - } - using (var stream = new FileStream(finalPath, FileMode.Create)) - { - await stream.WriteAsync(images, 0, images.Length); - } - } - catch (Exception ex) - { - } - if (!string.IsNullOrEmpty(domainUrl)) - { - finalPath = domainUrl + "/" + finalPath; - } - GiftClaim giftClaim1 = new GiftClaim() - { - Address = giftClaim.Address, - Name = giftClaim.Name, - Phone = giftClaim.Phone, - UserId = giftClaim.UserId, - Status = 0, - Company = giftClaim.Company, - ProductModel = giftClaim.ProductModel, - ProductDate = giftClaim.ProductDate, - ProductSerialNumber = giftClaim.ProductSerialNumber, - CreatedAt = DateTime.Now, - ProductImage = finalPath, - UserWxOpenId= user.Openid - }; - _GiftClaimService.AddGiftClaim(giftClaim1); - return SUCCESS(new { giftClaim1.Id }); - } } } diff --git a/ZR.Admin.WebApi/Controllers/WxOpenController.cs b/ZR.Admin.WebApi/Controllers/WxOpenController.cs index 24ce5df..ac37457 100644 --- a/ZR.Admin.WebApi/Controllers/WxOpenController.cs +++ b/ZR.Admin.WebApi/Controllers/WxOpenController.cs @@ -19,19 +19,11 @@ namespace ZR.Admin.WebApi.Controllers public class WxOpenController : BaseController { private readonly WechatApiClient _client; - /// - /// 礼品申领表接口 - /// - private readonly IGiftClaimService _GiftClaimService; - /// - /// 微信用户表接口 - /// - private readonly IGiftUserService _GiftUserService; - public WxOpenController(WechatApiClient client, IGiftUserService GiftUserService, IGiftClaimService giftClaimService) + + public WxOpenController(WechatApiClient client) { _client = client; - _GiftUserService = GiftUserService; - _GiftClaimService = giftClaimService; + } @@ -60,69 +52,6 @@ namespace ZR.Admin.WebApi.Controllers return SUCCESS(new { appId, signature, noncestr, timestamp, url }); } - [HttpGet("login")] - [AllowAnonymous] - public async Task GetOpenId([FromQuery] string code) - { - var response = await _client.ExecuteSnsJsCode2SessionAsync(new SnsJsCode2SessionRequest - { - JsCode = code, - GrantType = "authorization_code" - }); - if (!response.IsSuccessful()) - { - throw new Exception($"获取OpenId失败: {response.ErrorMessage}"); // 可以根据需要处理异常 - } - var openId = response.OpenId; - var user = await _GiftUserService.AsQueryable().Where(it => it.Openid == openId).FirstAsync(); - if (user == null) - { - //response. - user = new GiftUser() - { - AvatarUrl = "", - CreateTime = DateTime.Now, - Nickname = "微信用户", - Openid = openId, - UpdateTime = DateTime.Now, - LastLoginTime = DateTime.Now, - Phone = "", - Status = "0", - Unionid = "" - }; - _GiftUserService.AddGiftUser(user); - } - return SUCCESS(new { user_id = user.Id }); - - } - [HttpGet("getRecord")] - [AllowAnonymous] - public async Task GetRecord([FromQuery] int user_id) - { - if (user_id == 0) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "用户不存在"); - } - var user = await _GiftUserService.AsQueryable().Where(it => it.Id == user_id).FirstAsync(); - if (user == null) - { - return ToResponse(ResultCode.CUSTOM_ERROR, "用户不存在"); - } - var list = await _GiftClaimService.AsQueryable().Where(it => it.UserId == user_id).ToListAsync(); - List list1 = new List(); - list?.ForEach(it => - { - list1.Add(new - { - it.Status, - it.Name, - it.Address, - it.Phone - }); - }); - return SUCCESS(list1); - } - } } diff --git a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs index b6f35b6..a27c821 100644 --- a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs +++ b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs @@ -55,27 +55,27 @@ namespace ZR.Admin.WebApi.Extensions Title = "ZrAdmin.NET Api", Version = "v1", Description = "系统管理", - Contact = new OpenApiContact { Name = "ZRAdmin doc", Url = new Uri("https://www.izhaorui.cn/doc") } - }); - c.SwaggerDoc("article", new OpenApiInfo - { - Title = "ZrAdmin.NET Api", - Version = "v1", - Description = "文章管理", - Contact = new OpenApiContact { Name = "ZRAdmin doc", Url = new Uri("https://www.izhaorui.cn/doc") } - }); - c.SwaggerDoc("shopping", new OpenApiInfo - { - Title = "ZrAdmin.NET Api", - Version = "v1", - Description = "商城管理", - }); - c.SwaggerDoc("v1", new OpenApiInfo - { - Title = "ZrAdmin.NET Api", - Version = "v1", - Description = "", + Contact = new OpenApiContact { Name = "admin" } }); + //c.SwaggerDoc("article", new OpenApiInfo + //{ + // Title = "ZrAdmin.NET Api", + // Version = "v1", + // Description = "文章管理", + // Contact = new OpenApiContact { Name = "ZRAdmin doc", Url = new Uri("https://www.izhaorui.cn/doc") } + //}); + //c.SwaggerDoc("shopping", new OpenApiInfo + //{ + // Title = "ZrAdmin.NET Api", + // Version = "v1", + // Description = "商城管理", + //}); + //c.SwaggerDoc("v1", new OpenApiInfo + //{ + // Title = "ZrAdmin.NET Api", + // Version = "v1", + // Description = "", + //}); try { //var tempPath = hostEnvironment.ContentRootPath; diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 1e919d4..b6a1d2f 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -101,7 +101,9 @@ builder.Services.AddSignalR() { options.PayloadSerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase; }); +#if DEBUG builder.Services.AddSwaggerConfig(); +#endif // 显示logo builder.Services.AddLogo(); // 添加本地化服务 @@ -148,10 +150,10 @@ app.Use((context, next) => { //设置可以多次获取body内容 context.Request.EnableBuffering(); - if (context.Request.Query.TryGetValue("access_token", out var token)) - { - context.Request.Headers.Append("Authorization", $"Bearer {token}"); - } + //if (context.Request.Query.TryGetValue("access_token", out var token)) + //{ + // context.Request.Headers.Append("Authorization", $"Bearer {token}"); + //} return next(); }); //开启访问静态文件/wwwroot目录文件,要放在UseRouting前面 @@ -169,7 +171,7 @@ app.UseAuthorization(); //开启缓存 app.UseResponseCaching(); -if (builder.Environment.IsProduction()) +if (builder.Environment.IsProduction()||true) { //恢复/启动任务 app.UseAddTaskSchedulers(); diff --git a/ZR.Admin.WebApi/appsettings.json b/ZR.Admin.WebApi/appsettings.json index 10a43e3..63a6353 100644 --- a/ZR.Admin.WebApi/appsettings.json +++ b/ZR.Admin.WebApi/appsettings.json @@ -13,14 +13,6 @@ "ConfigId": "0", //多租户唯一标识 "IsAutoCloseConnection": true } - //, - //{ - // "Conn": "Data Source=LAPTOP-STKF2M8H\\SQLEXPRESS;User ID=admin;Password=admin123;Initial Catalog=ZrAdmin;Encrypt=True;TrustServerCertificate=True;", - // "DbType": 1, - // "ConfigId": "1", //商城数据库 - // "IsAutoCloseConnection": true - //} - //...下面添加更多的数据库源 ], //代码生成数据库配置 初始化数据:http://localhost:8888/common/initseedData "CodeGenDbConfig": { @@ -33,8 +25,8 @@ "urls": "http://*:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改 "corsUrls": [ "http://localhost:8887", "http://localhost:8886" ], //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开 "JwtSettings": { - "Issuer": "admin.NET", //即token的签发者。 - "Audience": "admin.NET", //指该token是服务于哪个群体的(群体范围) + "Issuer": "OpticalCableAdmin", //即token的签发者。 + "Audience": "OpticalCableAdmin", //指该token是服务于哪个群体的(群体范围) "SecretKey": "SecretKey-ZRADMIN.NET-202311281883831", "Expire": 144000, //jwt登录过期时间(分) "RefreshTokenTime": 7200, //分钟 @@ -99,7 +91,7 @@ ], //redis服务配置 "RedisServer": { - "open": 0, //是否启用redis + "open": 1, //是否启用redis "dbCache": false, //数据库是否使用Redis缓存,如果启用open要为1 "Cache": "192.168.1.41:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=cache:", "Session": "192.168.1.41:6379,defaultDatabase=0,poolsize=50,ssl=false,writeBuffer=10240,prefix=session:" diff --git a/ZR.Model/Business/Dto/GiftClaimDto.cs b/ZR.Model/Business/Dto/GiftClaimDto.cs deleted file mode 100644 index bc29cdd..0000000 --- a/ZR.Model/Business/Dto/GiftClaimDto.cs +++ /dev/null @@ -1,156 +0,0 @@ - -namespace ZR.Model.Business.Dto -{ - /// - /// 礼品申领表查询对象 - /// - public class GiftClaimQueryDto : PagerInfo - { - public string Name { get; set; } - public string Phone { get; set; } - public string Company { get; set; } - public string Address { get; set; } - public string ProductModel { get; set; } - public string ProductSerialNumber { get; set; } - public int? Status { get; set; } - - public string UserWxOpenId { get; set; } - } - - /// - /// 礼品申领表输入输出对象 - /// - public class GiftClaimDto - { - [Required(ErrorMessage = "主键不能为空")] - [ExcelColumn(Name = "主键")] - [ExcelColumnName("主键")] - public int Id { get; set; } - - [Required(ErrorMessage = "用户ID不能为空")] - [ExcelColumn(Name = "用户ID")] - [ExcelColumnName("用户ID")] - public int UserId { get; set; } - - [Required(ErrorMessage = "姓名不能为空")] - [ExcelColumn(Name = "姓名")] - [ExcelColumnName("姓名")] - public string Name { get; set; } - - [Required(ErrorMessage = "联系方式不能为空")] - [ExcelColumn(Name = "联系方式")] - [ExcelColumnName("联系方式")] - public string Phone { get; set; } - - [ExcelColumn(Name = "工作单位")] - [ExcelColumnName("工作单位")] - public string Company { get; set; } - - [Required(ErrorMessage = "收货地址不能为空")] - [ExcelColumn(Name = "收货地址")] - [ExcelColumnName("收货地址")] - public string Address { get; set; } - - [Required(ErrorMessage = "产品型号不能为空")] - [ExcelColumn(Name = "产品型号")] - [ExcelColumnName("产品型号")] - public string ProductModel { get; set; } - - [Required(ErrorMessage = "出品编号不能为空")] - [ExcelColumn(Name = "出品编号")] - [ExcelColumnName("出品编号")] - public string ProductSerialNumber { get; set; } - - [Required(ErrorMessage = "出品年月不能为空")] - [ExcelColumn(Name = "出品年月")] - [ExcelColumnName("出品年月")] - public string ProductDate { get; set; } - - [ExcelColumn(Name = "出品图片")] - [ExcelColumnName("出品图片")] - public string ProductImage { get; set; } - - [ExcelColumn(Name = "提交时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)] - [ExcelColumnName("提交时间")] - public DateTime? CreatedAt { get; set; } - - [Required(ErrorMessage = "审核状态不能为空")] - [ExcelColumn(Name = "审核状态")] - [ExcelColumnName("审核状态")] - public int Status { get; set; } - - - - [ExcelColumn(Name = "审核状态")] - public string StatusLabel { get; set; } - - /// - /// 审核时间 - /// - [ExcelColumn(Name = "审核时间")] - [ExcelColumnName("审核时间")] - public DateTime? ReviewAt { get; set; } - - /// - /// 微信用户id - /// - [ExcelColumn(Name = "微信用户id")] - [ExcelColumnName("微信用户id")] - public string UserWxOpenId { get; set; } - } - /// - /// 礼品申领表输入输出对象 - /// - public class AddGiftClaimDto - { - - [Required(ErrorMessage = "用户ID不能为空")] - [ExcelColumn(Name = "用户ID")] - [ExcelColumnName("用户ID")] - public int UserId { get; set; } - - [Required(ErrorMessage = "姓名不能为空")] - [ExcelColumn(Name = "姓名")] - [ExcelColumnName("姓名")] - public string Name { get; set; } - - [Required(ErrorMessage = "联系方式不能为空")] - [ExcelColumn(Name = "联系方式")] - [ExcelColumnName("联系方式")] - public string Phone { get; set; } - - [ExcelColumn(Name = "工作单位")] - [ExcelColumnName("工作单位")] - public string Company { get; set; } - - [Required(ErrorMessage = "收货地址不能为空")] - [ExcelColumn(Name = "收货地址")] - [ExcelColumnName("收货地址")] - public string Address { get; set; } - - [Required(ErrorMessage = "产品型号不能为空")] - [ExcelColumn(Name = "产品型号")] - [ExcelColumnName("产品型号")] - public string ProductModel { get; set; } - - [Required(ErrorMessage = "出品编号不能为空")] - [ExcelColumn(Name = "出品编号")] - [ExcelColumnName("出品编号")] - public string ProductSerialNumber { get; set; } - - [Required(ErrorMessage = "出品年月不能为空")] - [ExcelColumn(Name = "出品年月")] - [ExcelColumnName("出品年月")] - public string ProductDate { get; set; } - [Required(ErrorMessage = "出品图片不能为空")] - [ExcelColumn(Name = "出品图片")] - [ExcelColumnName("出品图片")] - public string ProductImage { get; set; } - - - - } - - - -} \ No newline at end of file diff --git a/ZR.Model/Business/Dto/GiftConfigDto.cs b/ZR.Model/Business/Dto/GiftConfigDto.cs deleted file mode 100644 index e162c6a..0000000 --- a/ZR.Model/Business/Dto/GiftConfigDto.cs +++ /dev/null @@ -1,28 +0,0 @@ - -namespace ZR.Model.Business.Dto -{ - /// - /// 礼品小程序查询对象 - /// - public class GiftConfigQueryDto : PagerInfo - { - } - - /// - /// 礼品小程序输入输出对象 - /// - public class GiftConfigDto - { - [Required(ErrorMessage = "Id不能为空")] - public int Id { get; set; } - - public string HomeImage { get; set; } - - public string Extend { get; set; } - - public string Extend1 { get; set; } - - - - } -} \ No newline at end of file diff --git a/ZR.Model/Business/Dto/GiftUserDto.cs b/ZR.Model/Business/Dto/GiftUserDto.cs deleted file mode 100644 index 628b2e6..0000000 --- a/ZR.Model/Business/Dto/GiftUserDto.cs +++ /dev/null @@ -1,73 +0,0 @@ - -namespace ZR.Model.Business.Dto -{ - /// - /// 微信用户表查询对象 - /// - public class GiftUserQueryDto : PagerInfo - { - public string Nickname { get; set; } - } - - /// - /// 微信用户表输入输出对象 - /// - public class GiftUserDto - { - [Required(ErrorMessage = "主键ID不能为空")] - [ExcelColumn(Name = "主键ID")] - [ExcelColumnName("主键ID")] - public int Id { get; set; } - - [Required(ErrorMessage = "微信openid不能为空")] - [ExcelColumn(Name = "微信openid")] - [ExcelColumnName("微信openid")] - public string Openid { get; set; } - - [ExcelColumn(Name = "微信unionid")] - [ExcelColumnName("微信unionid")] - public string Unionid { get; set; } - - [ExcelColumn(Name = "昵称")] - [ExcelColumnName("昵称")] - public string Nickname { get; set; } - - [ExcelColumn(Name = "头像URL")] - [ExcelColumnName("头像URL")] - public string AvatarUrl { get; set; } - - [ExcelColumn(Name = "性别")] - [ExcelColumnName("性别")] - public string Gender { get; set; } - - [ExcelColumn(Name = "手机号")] - [ExcelColumnName("手机号")] - public string Phone { get; set; } - - [Required(ErrorMessage = "状态不能为空")] - [ExcelColumn(Name = "状态")] - [ExcelColumnName("状态")] - public string Status { get; set; } - - [ExcelColumn(Name = "最后登录时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)] - [ExcelColumnName("最后登录时间")] - public DateTime? LastLoginTime { get; set; } - - //[Required(ErrorMessage = "创建时间不能为空")] - [ExcelColumn(Name = "创建时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)] - [ExcelColumnName("创建时间")] - public DateTime? CreateTime { get; set; } - - //[Required(ErrorMessage = "更新时间不能为空")] - [ExcelColumn(Name = "更新时间", Format = "yyyy-MM-dd HH:mm:ss", Width = 20)] - [ExcelColumnName("更新时间")] - public DateTime? UpdateTime { get; set; } - - - - [ExcelColumn(Name = "性别")] - public string GenderLabel { get; set; } - [ExcelColumn(Name = "状态")] - public string StatusLabel { get; set; } - } -} \ No newline at end of file diff --git a/ZR.Model/Business/GiftClaim.cs b/ZR.Model/Business/GiftClaim.cs deleted file mode 100644 index 4cdf7e3..0000000 --- a/ZR.Model/Business/GiftClaim.cs +++ /dev/null @@ -1,83 +0,0 @@ - -namespace ZR.Model.Business -{ - /// - /// 礼品申领表 - /// - [SugarTable("gift_claim")] - public class GiftClaim - { - /// - /// 主键 - /// - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 用户ID - /// - [SugarColumn(ColumnName = "user_id")] - public int UserId { get; set; } - - /// - /// 姓名 - /// - public string Name { get; set; } - - /// - /// 联系方式 - /// - public string Phone { get; set; } - - /// - /// 工作单位 - /// - public string Company { get; set; } - - /// - /// 收货地址 - /// - public string Address { get; set; } - - /// - /// 产品型号 - /// - public string ProductModel { get; set; } - - /// - /// 出品编号 - /// - public string ProductSerialNumber { get; set; } - - /// - /// 出品年月 - /// - public string ProductDate { get; set; } - - /// - /// 出品图片 - /// - public string ProductImage { get; set; } - - /// - /// 提交时间 - /// - public DateTime? CreatedAt { get; set; } - - /// - /// 审核状态 - /// - public int Status { get; set; } - - /// - /// 审核时间 - /// - public DateTime? ReviewAt { get; set; } - - /// - /// 微信用户id - /// - public string UserWxOpenId { get; set; } - - } -} \ No newline at end of file diff --git a/ZR.Model/Business/GiftConfig.cs b/ZR.Model/Business/GiftConfig.cs deleted file mode 100644 index 81a117d..0000000 --- a/ZR.Model/Business/GiftConfig.cs +++ /dev/null @@ -1,32 +0,0 @@ - -namespace ZR.Model.Business -{ - /// - /// 礼品小程序 - /// - [SugarTable("gift_config")] - public class GiftConfig - { - /// - /// Id - /// - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 首页图片 - /// - public string HomeImage { get; set; } - - /// - /// 扩展1 - /// - public string Extend { get; set; } - - /// - /// 扩展2 - /// - public string Extend1 { get; set; } - - } -} \ No newline at end of file diff --git a/ZR.Model/Business/GiftUser.cs b/ZR.Model/Business/GiftUser.cs deleted file mode 100644 index ef915f1..0000000 --- a/ZR.Model/Business/GiftUser.cs +++ /dev/null @@ -1,71 +0,0 @@ - -namespace ZR.Model.Business -{ - /// - /// 微信用户表 - /// - [SugarTable("gift_user")] - public class GiftUser - { - /// - /// 主键ID - /// - [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public int Id { get; set; } - - /// - /// 微信openid - /// - public string Openid { get; set; } - - /// - /// 微信unionid - /// - public string Unionid { get; set; } - - /// - /// 昵称 - /// - public string Nickname { get; set; } - - /// - /// 头像URL - /// - [SugarColumn(ColumnName = "avatar_url")] - public string AvatarUrl { get; set; } - - /// - /// 性别 - /// - public string Gender { get; set; } - - /// - /// 手机号 - /// - public string Phone { get; set; } - - /// - /// 状态 - /// - public string Status { get; set; } - - /// - /// 最后登录时间 - /// - [SugarColumn(ColumnName = "last_login_time")] - public DateTime? LastLoginTime { get; set; } - - /// - /// 创建时间 - /// - [SugarColumn(ColumnName = "create_time")] - public DateTime? CreateTime { get; set; } - - /// - /// 更新时间 - /// - [SugarColumn(ColumnName = "update_time")] - public DateTime? UpdateTime { get; set; } - - } -} \ No newline at end of file diff --git a/ZR.Service/Business/GiftClaimService.cs b/ZR.Service/Business/GiftClaimService.cs deleted file mode 100644 index dcf3cd1..0000000 --- a/ZR.Service/Business/GiftClaimService.cs +++ /dev/null @@ -1,117 +0,0 @@ -using Infrastructure.Attribute; -using Infrastructure.Extensions; -using ZR.Model.Business.Dto; -using ZR.Model.Business; -using ZR.Repository; -using ZR.Service.Business.IBusinessService; - -namespace ZR.Service.Business -{ - /// - /// 礼品申领表Service业务层处理 - /// - [AppService(ServiceType = typeof(IGiftClaimService), ServiceLifetime = LifeTime.Transient)] - public class GiftClaimService : BaseService, IGiftClaimService - { - /// - /// 查询礼品申领表列表 - /// - /// - /// - public PagedInfo GetList(GiftClaimQueryDto parm) - { - var predicate = QueryExp(parm); - - var response = Queryable() - //.OrderBy("Id desc") - .Where(predicate.ToExpression()) - .ToPage(parm); - //response.Result.ForEach(item => - //{ - // if (item.ProductImage.IndexOf("http") == -1) - // { - // item.ProductImage = "" + - // } - - //}); - return response; - } - - - /// - /// 获取详情 - /// - /// - /// - public GiftClaim GetInfo(int Id) - { - var response = Queryable() - .Where(x => x.Id == Id) - .First(); - - return response; - } - - /// - /// 添加礼品申领表 - /// - /// - /// - public GiftClaim AddGiftClaim(GiftClaim model) - { - return Insertable(model).ExecuteReturnEntity(); - } - - /// - /// 修改礼品申领表 - /// - /// - /// - public int UpdateGiftClaim(GiftClaim model) - { - return Update(model, true); - } - - /// - /// 导出礼品申领表 - /// - /// - /// - public PagedInfo ExportList(GiftClaimQueryDto parm) - { - parm.PageNum = 1; - parm.PageSize = 100000; - var predicate = QueryExp(parm); - - var response = Queryable() - .Where(predicate.ToExpression()) - .Select((it) => new GiftClaimDto() - { - StatusLabel = it.Status.GetConfigValue("gift_request_claim"), - }, true) - .ToPage(parm); - - return response; - } - - /// - /// 查询导出表达式 - /// - /// - /// - private static Expressionable QueryExp(GiftClaimQueryDto parm) - { - var predicate = Expressionable.Create(); - - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Phone), it => it.Phone.Contains(parm.Phone)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Company), it => it.Company.Contains(parm.Company)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Address), it => it.Address.Contains(parm.Address)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ProductModel), it => it.ProductModel.Contains(parm.ProductModel)); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ProductSerialNumber), it => it.ProductSerialNumber.Contains(parm.ProductSerialNumber)); - predicate = predicate.AndIF(parm.Status != null, it => it.Status == parm.Status); - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.UserWxOpenId), it => it.UserWxOpenId.Contains(parm.UserWxOpenId)); - return predicate; - } - } -} \ No newline at end of file diff --git a/ZR.Service/Business/GiftConfigService.cs b/ZR.Service/Business/GiftConfigService.cs deleted file mode 100644 index b660a60..0000000 --- a/ZR.Service/Business/GiftConfigService.cs +++ /dev/null @@ -1,79 +0,0 @@ -using Infrastructure.Attribute; -using Infrastructure.Extensions; -using ZR.Model.Business.Dto; -using ZR.Model.Business; -using ZR.Repository; -using ZR.Service.Business.IBusinessService; - -namespace ZR.Service.Business -{ - /// - /// 礼品小程序Service业务层处理 - /// - [AppService(ServiceType = typeof(IGiftConfigService), ServiceLifetime = LifeTime.Transient)] - public class GiftConfigService : BaseService, IGiftConfigService - { - /// - /// 查询礼品小程序列表 - /// - /// - /// - public PagedInfo GetList(GiftConfigQueryDto parm) - { - var predicate = QueryExp(parm); - - var response = Queryable() - .Where(predicate.ToExpression()) - .ToPage(parm); - - return response; - } - - - /// - /// 获取详情 - /// - /// - /// - public GiftConfig GetInfo(int Id) - { - var response = Queryable() - .Where(x => x.Id == Id) - .First(); - - return response; - } - - /// - /// 添加礼品小程序 - /// - /// - /// - public GiftConfig AddGiftConfig(GiftConfig model) - { - return Insertable(model).ExecuteReturnEntity(); - } - - /// - /// 修改礼品小程序 - /// - /// - /// - public int UpdateGiftConfig(GiftConfig model) - { - return Update(model, true, "修改礼品小程序"); - } - - /// - /// 查询导出表达式 - /// - /// - /// - private static Expressionable QueryExp(GiftConfigQueryDto parm) - { - var predicate = Expressionable.Create(); - - return predicate; - } - } -} \ No newline at end of file diff --git a/ZR.Service/Business/GiftUserService.cs b/ZR.Service/Business/GiftUserService.cs deleted file mode 100644 index e510496..0000000 --- a/ZR.Service/Business/GiftUserService.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Infrastructure.Attribute; -using Infrastructure.Extensions; -using ZR.Model.Business.Dto; -using ZR.Model.Business; -using ZR.Repository; -using ZR.Service.Business.IBusinessService; - -namespace ZR.Service.Business -{ - /// - /// 微信用户表Service业务层处理 - /// - [AppService(ServiceType = typeof(IGiftUserService), ServiceLifetime = LifeTime.Transient)] - public class GiftUserService : BaseService, IGiftUserService - { - /// - /// 查询微信用户表列表 - /// - /// - /// - public PagedInfo GetList(GiftUserQueryDto parm) - { - var predicate = QueryExp(parm); - - var response = Queryable() - //.OrderBy("Id desc") - .Where(predicate.ToExpression()) - .ToPage(parm); - - return response; - } - - - /// - /// 获取详情 - /// - /// - /// - public GiftUser GetInfo(int Id) - { - var response = Queryable() - .Where(x => x.Id == Id) - .First(); - - return response; - } - - /// - /// 添加微信用户表 - /// - /// - /// - public GiftUser AddGiftUser(GiftUser model) - { - return Insertable(model).ExecuteReturnEntity(); - } - - /// - /// 修改微信用户表 - /// - /// - /// - public int UpdateGiftUser(GiftUser model) - { - return Update(model, true); - } - - /// - /// 导出微信用户表 - /// - /// - /// - public PagedInfo ExportList(GiftUserQueryDto parm) - { - parm.PageNum = 1; - parm.PageSize = 100000; - var predicate = QueryExp(parm); - - var response = Queryable() - .Where(predicate.ToExpression()) - .Select((it) => new GiftUserDto() - { - GenderLabel = it.Gender.GetConfigValue("sys_user_sex"), - StatusLabel = it.Status.GetConfigValue("sys_common_status"), - }, true) - .ToPage(parm); - - return response; - } - - /// - /// 查询导出表达式 - /// - /// - /// - private static Expressionable QueryExp(GiftUserQueryDto parm) - { - var predicate = Expressionable.Create(); - - predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Nickname), it => it.Nickname.Contains(parm.Nickname)); - return predicate; - } - } -} \ No newline at end of file diff --git a/ZR.Service/Business/IBusinessService/IGiftClaimService.cs b/ZR.Service/Business/IBusinessService/IGiftClaimService.cs deleted file mode 100644 index 109ade5..0000000 --- a/ZR.Service/Business/IBusinessService/IGiftClaimService.cs +++ /dev/null @@ -1,22 +0,0 @@ -using ZR.Model.Business.Dto; -using ZR.Model.Business; - -namespace ZR.Service.Business.IBusinessService -{ - /// - /// 礼品申领表service接口 - /// - public interface IGiftClaimService : IBaseService - { - PagedInfo GetList(GiftClaimQueryDto parm); - - GiftClaim GetInfo(int Id); - - - GiftClaim AddGiftClaim(GiftClaim parm); - int UpdateGiftClaim(GiftClaim parm); - - - PagedInfo ExportList(GiftClaimQueryDto parm); - } -} diff --git a/ZR.Service/Business/IBusinessService/IGiftConfigService.cs b/ZR.Service/Business/IBusinessService/IGiftConfigService.cs deleted file mode 100644 index 21b2164..0000000 --- a/ZR.Service/Business/IBusinessService/IGiftConfigService.cs +++ /dev/null @@ -1,21 +0,0 @@ -using ZR.Model.Business.Dto; -using ZR.Model.Business; - -namespace ZR.Service.Business.IBusinessService -{ - /// - /// 礼品小程序service接口 - /// - public interface IGiftConfigService : IBaseService - { - PagedInfo GetList(GiftConfigQueryDto parm); - - GiftConfig GetInfo(int Id); - - - GiftConfig AddGiftConfig(GiftConfig parm); - int UpdateGiftConfig(GiftConfig parm); - - - } -} diff --git a/ZR.Service/Business/IBusinessService/IGiftUserService.cs b/ZR.Service/Business/IBusinessService/IGiftUserService.cs deleted file mode 100644 index 293243c..0000000 --- a/ZR.Service/Business/IBusinessService/IGiftUserService.cs +++ /dev/null @@ -1,22 +0,0 @@ -using ZR.Model.Business.Dto; -using ZR.Model.Business; - -namespace ZR.Service.Business.IBusinessService -{ - /// - /// 微信用户表service接口 - /// - public interface IGiftUserService : IBaseService - { - PagedInfo GetList(GiftUserQueryDto parm); - - GiftUser GetInfo(int Id); - - - GiftUser AddGiftUser(GiftUser parm); - int UpdateGiftUser(GiftUser parm); - - - PagedInfo ExportList(GiftUserQueryDto parm); - } -}