初始项目
This commit is contained in:
parent
1c6e7d410e
commit
eed70324fd
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
[Route("business/GiftClaim")]
|
|
||||||
public class GiftClaimController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftClaimService _GiftClaimService;
|
|
||||||
|
|
||||||
public GiftClaimController(IGiftClaimService GiftClaimService)
|
|
||||||
{
|
|
||||||
_GiftClaimService = GiftClaimService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品申领表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftclaim:list")]
|
|
||||||
public IActionResult QueryGiftClaim([FromQuery] GiftClaimQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _GiftClaimService.GetList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品申领表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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 });
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品申领表详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("{Id}")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftclaim:query")]
|
|
||||||
public IActionResult GetGiftClaim(int Id)
|
|
||||||
{
|
|
||||||
var response = _GiftClaimService.GetInfo(Id);
|
|
||||||
|
|
||||||
var info = response.Adapt<GiftClaimDto>();
|
|
||||||
return SUCCESS(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ActionPermissionFilter(Permission = "giftclaim:add")]
|
|
||||||
[Log(Title = "礼品申领记录", BusinessType = BusinessType.INSERT)]
|
|
||||||
public IActionResult AddGiftClaim([FromBody] GiftClaimDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<GiftClaim>().ToCreate(HttpContext);
|
|
||||||
|
|
||||||
var response = _GiftClaimService.AddGiftClaim(modal);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
[ActionPermissionFilter(Permission = "giftclaim:edit")]
|
|
||||||
[Log(Title = "礼品申领记录", BusinessType = BusinessType.UPDATE)]
|
|
||||||
public IActionResult UpdateGiftClaim([FromBody] GiftClaimDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<GiftClaim>().ToUpdate(HttpContext);
|
|
||||||
var response = _GiftClaimService.UpdateGiftClaim(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("editStatus")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftclaim:editStatus")]
|
|
||||||
[Log(Title = "礼品申领记录", BusinessType = BusinessType.UPDATE, MessageKey = "giftclaim:status")]
|
|
||||||
public async Task<IActionResult> 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, ""));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("delete/{ids}")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftclaim:delete")]
|
|
||||||
[Log(Title = "礼品申领表", BusinessType = BusinessType.DELETE)]
|
|
||||||
public IActionResult DeleteGiftClaim([FromRoute] string ids)
|
|
||||||
{
|
|
||||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
|
||||||
|
|
||||||
return ToResponse(_GiftClaimService.Delete(idArr));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
[Route("business/GiftConfig")]
|
|
||||||
public class GiftConfigController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftConfigService _GiftConfigService;
|
|
||||||
|
|
||||||
public GiftConfigController(IGiftConfigService GiftConfigService)
|
|
||||||
{
|
|
||||||
_GiftConfigService = GiftConfigService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品小程序列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftconfig:list")]
|
|
||||||
public IActionResult QueryGiftConfig([FromQuery] GiftConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _GiftConfigService.GetList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品小程序详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<GiftConfigDto>();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var tt = _GiftConfigService.AddGiftConfig(new GiftConfig()
|
|
||||||
{
|
|
||||||
HomeImage = "",
|
|
||||||
Extend = "",
|
|
||||||
Extend1 = "",
|
|
||||||
});
|
|
||||||
info = tt.Adapt<GiftConfigDto>();
|
|
||||||
}
|
|
||||||
return SUCCESS(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ActionPermissionFilter(Permission = "giftconfig:add")]
|
|
||||||
[Log(Title = "礼品小程序", BusinessType = BusinessType.INSERT)]
|
|
||||||
public IActionResult AddGiftConfig([FromBody] GiftConfigDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<GiftConfig>().ToCreate(HttpContext);
|
|
||||||
|
|
||||||
var response = _GiftConfigService.AddGiftConfig(modal);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
[ActionPermissionFilter(Permission = "giftconfig:edit")]
|
|
||||||
[Log(Title = "礼品小程序", BusinessType = BusinessType.UPDATE)]
|
|
||||||
public IActionResult UpdateGiftConfig([FromBody] GiftConfigDto parm)
|
|
||||||
{
|
|
||||||
var modal = parm.Adapt<GiftConfig>().ToUpdate(HttpContext);
|
|
||||||
var response = _GiftConfigService.UpdateGiftConfig(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("delete/{ids}")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftconfig:delete")]
|
|
||||||
[Log(Title = "礼品小程序", BusinessType = BusinessType.DELETE)]
|
|
||||||
public IActionResult DeleteGiftConfig([FromRoute] string ids)
|
|
||||||
{
|
|
||||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
|
||||||
|
|
||||||
return ToResponse(_GiftConfigService.Delete(idArr, "删除礼品小程序"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表
|
|
||||||
/// </summary>
|
|
||||||
[Route("business/GiftUser")]
|
|
||||||
public class GiftUserController : BaseController
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftUserService _GiftUserService;
|
|
||||||
|
|
||||||
public GiftUserController(IGiftUserService GiftUserService)
|
|
||||||
{
|
|
||||||
_GiftUserService = GiftUserService;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询微信用户表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("list")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftuser:list")]
|
|
||||||
public IActionResult QueryGiftUser([FromQuery] GiftUserQueryDto parm)
|
|
||||||
{
|
|
||||||
var response = _GiftUserService.GetList(parm);
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询微信用户表详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("{Id}")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftuser:query")]
|
|
||||||
public IActionResult GetGiftUser(int Id)
|
|
||||||
{
|
|
||||||
var response = _GiftUserService.GetInfo(Id);
|
|
||||||
|
|
||||||
var info = response.Adapt<GiftUserDto>();
|
|
||||||
return SUCCESS(info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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<GiftUser>().ToCreate(HttpContext);
|
|
||||||
|
|
||||||
var response = _GiftUserService.AddGiftUser(modal);
|
|
||||||
|
|
||||||
return SUCCESS(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPut]
|
|
||||||
[ActionPermissionFilter(Permission = "giftuser:edit")]
|
|
||||||
[Log(Title = "微信用户表", BusinessType = BusinessType.UPDATE)]
|
|
||||||
public IActionResult UpdateGiftUser([FromBody] GiftUserDto parm)
|
|
||||||
{
|
|
||||||
parm.UpdateTime = DateTime.Now;
|
|
||||||
var modal = parm.Adapt<GiftUser>().ToUpdate(HttpContext);
|
|
||||||
var response = _GiftUserService.UpdateGiftUser(modal);
|
|
||||||
|
|
||||||
return ToResponse(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("delete/{ids}")]
|
|
||||||
[ActionPermissionFilter(Permission = "giftuser:delete")]
|
|
||||||
[Log(Title = "微信用户表", BusinessType = BusinessType.DELETE)]
|
|
||||||
public IActionResult DeleteGiftUser([FromRoute]string ids)
|
|
||||||
{
|
|
||||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
|
||||||
|
|
||||||
return ToResponse(_GiftUserService.Delete(idArr));
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -7,7 +7,7 @@ using MiniExcelLibs;
|
||||||
using ZR.Infrastructure.IPTools;
|
using ZR.Infrastructure.IPTools;
|
||||||
using ZR.Model.Dto;
|
using ZR.Model.Dto;
|
||||||
using ZR.Model.System;
|
using ZR.Model.System;
|
||||||
using ZR.Service.Business.IBusinessService;
|
|
||||||
using ZR.ServiceCore.Resources;
|
using ZR.ServiceCore.Resources;
|
||||||
|
|
||||||
namespace ZR.Admin.WebApi.Controllers
|
namespace ZR.Admin.WebApi.Controllers
|
||||||
|
|
@ -25,10 +25,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||||
private IWebHostEnvironment WebHostEnvironment;
|
private IWebHostEnvironment WebHostEnvironment;
|
||||||
private ISysFileService SysFileService;
|
private ISysFileService SysFileService;
|
||||||
private readonly IStringLocalizer<SharedResource> _localizer;
|
private readonly IStringLocalizer<SharedResource> _localizer;
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftConfigService _GiftConfigService;
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -40,14 +37,13 @@ namespace ZR.Admin.WebApi.Controllers
|
||||||
IStringLocalizer<SharedResource> stringLocalizer,
|
IStringLocalizer<SharedResource> stringLocalizer,
|
||||||
IOptions<OptionsSetting> options,
|
IOptions<OptionsSetting> options,
|
||||||
IWebHostEnvironment webHostEnvironment,
|
IWebHostEnvironment webHostEnvironment,
|
||||||
ISysFileService fileService,
|
ISysFileService fileService)
|
||||||
IGiftConfigService GiftConfigService)
|
|
||||||
{
|
{
|
||||||
WebHostEnvironment = webHostEnvironment;
|
WebHostEnvironment = webHostEnvironment;
|
||||||
SysFileService = fileService;
|
SysFileService = fileService;
|
||||||
OptionsSetting = options.Value;
|
OptionsSetting = options.Value;
|
||||||
_localizer = stringLocalizer;
|
_localizer = stringLocalizer;
|
||||||
_GiftConfigService = GiftConfigService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -63,18 +59,7 @@ namespace ZR.Admin.WebApi.Controllers
|
||||||
return Ok($"请求成功!=>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
return Ok($"请求成功!=>" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// home
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Route("/config")]
|
|
||||||
[HttpGet]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<object> GetConfig()
|
|
||||||
{
|
|
||||||
var response = _GiftConfigService.GetFirst(it => true);
|
|
||||||
return new { home = (response?.HomeImage ?? ""), response.Extend, response.Extend1 };
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查询IP信息
|
/// 查询IP信息
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
using SKIT.FlurlHttpClient.Wechat.Api;
|
using SKIT.FlurlHttpClient.Wechat.Api;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using ZR.Model.Business;
|
|
||||||
using ZR.Service.Business.IBusinessService;
|
|
||||||
using ZR.Model.Business.Dto;
|
|
||||||
using Org.BouncyCastle.Utilities;
|
using Org.BouncyCastle.Utilities;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
|
||||||
|
|
@ -20,200 +18,6 @@ namespace ZR.Admin.WebApi.Controllers
|
||||||
[ApiExplorerSettings(GroupName = "webapi")]
|
[ApiExplorerSettings(GroupName = "webapi")]
|
||||||
public class WebApiController : BaseController
|
public class WebApiController : BaseController
|
||||||
{
|
{
|
||||||
private readonly WechatApiClient _client;
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftClaimService _GiftClaimService;
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftUserService _GiftUserService;
|
|
||||||
private ISysFileService SysFileService;
|
|
||||||
public WebApiController(WechatApiClient client, IGiftUserService GiftUserService, IGiftClaimService giftClaimService, ISysFileService sysFileService)
|
|
||||||
{
|
|
||||||
_client = client;
|
|
||||||
_GiftUserService = GiftUserService;
|
|
||||||
_GiftClaimService = giftClaimService;
|
|
||||||
SysFileService = sysFileService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="code"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
/// <exception cref="Exception"></exception>
|
|
||||||
[HttpPost()]
|
|
||||||
[Route("/userLogin")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<IActionResult> 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<IActionResult> 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<object> list1 = new List<object>();
|
|
||||||
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<IActionResult> 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;
|
|
||||||
}
|
|
||||||
var ip = HttpContextExtension.GetClientUserIp(HttpContext);
|
|
||||||
GeoCodeService geoCodeService = new GeoCodeService(new HttpClient());
|
|
||||||
var resultTuple = await geoCodeService.GetReGeoCodeAsync(giftClaim.Longitude + "," + giftClaim.Latitude);
|
|
||||||
string regeo = "";
|
|
||||||
string geocodedAddress = "";
|
|
||||||
if (resultTuple.HasValue)
|
|
||||||
{
|
|
||||||
var (result, message) = resultTuple.Value;
|
|
||||||
if (result != null)
|
|
||||||
{
|
|
||||||
geocodedAddress = result;
|
|
||||||
}
|
|
||||||
regeo = message ?? "";
|
|
||||||
}
|
|
||||||
//if(t.)
|
|
||||||
var ipAddress = HttpContextExtension.GetIpInfo(ip);
|
|
||||||
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,
|
|
||||||
Longitude = giftClaim.Longitude,
|
|
||||||
Latitude = giftClaim.Latitude,
|
|
||||||
GeocodedAddress = geocodedAddress,
|
|
||||||
IP = ip,
|
|
||||||
Regeo= regeo,
|
|
||||||
IPAddress = ipAddress,
|
|
||||||
|
|
||||||
};
|
|
||||||
_GiftClaimService.AddGiftClaim(giftClaim1);
|
|
||||||
return SUCCESS(new { giftClaim1.Id });
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet()]
|
|
||||||
[Route("/getBannerList")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<IActionResult> GetBannerList()
|
|
||||||
{
|
|
||||||
var list = await SysFileService.AsQueryable().Where(it => it.ClassifyType == "banner").Select(it =>
|
|
||||||
new { it.AccessUrl, it.RealName }).ToListAsync();
|
|
||||||
return SUCCESS(list);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,7 @@ using SKIT.FlurlHttpClient.Wechat.Api.Models;
|
||||||
|
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
using ZR.Model.Business.Dto;
|
|
||||||
using ZR.Model.Business;
|
|
||||||
using ZR.Service.Business.IBusinessService;
|
|
||||||
|
|
||||||
namespace ZR.Admin.WebApi.Controllers
|
namespace ZR.Admin.WebApi.Controllers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -19,19 +16,11 @@ namespace ZR.Admin.WebApi.Controllers
|
||||||
public class WxOpenController : BaseController
|
public class WxOpenController : BaseController
|
||||||
{
|
{
|
||||||
private readonly WechatApiClient _client;
|
private readonly WechatApiClient _client;
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表接口
|
public WxOpenController(WechatApiClient client)
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftClaimService _GiftClaimService;
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表接口
|
|
||||||
/// </summary>
|
|
||||||
private readonly IGiftUserService _GiftUserService;
|
|
||||||
public WxOpenController(WechatApiClient client, IGiftUserService GiftUserService, IGiftClaimService giftClaimService)
|
|
||||||
{
|
{
|
||||||
_client = client;
|
_client = client;
|
||||||
_GiftUserService = GiftUserService;
|
|
||||||
_GiftClaimService = giftClaimService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,69 +49,5 @@ namespace ZR.Admin.WebApi.Controllers
|
||||||
return SUCCESS(new { appId, signature, noncestr, timestamp, url });
|
return SUCCESS(new { appId, signature, noncestr, timestamp, url });
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("login")]
|
|
||||||
[AllowAnonymous]
|
|
||||||
public async Task<IActionResult> 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<IActionResult> 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<object> list1 = new List<object>();
|
|
||||||
list?.ForEach(it =>
|
|
||||||
{
|
|
||||||
list1.Add(new
|
|
||||||
{
|
|
||||||
it.Status,
|
|
||||||
it.Name,
|
|
||||||
it.Address,
|
|
||||||
it.Phone
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return SUCCESS(list1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,9 @@
|
||||||
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
using Microsoft.AspNetCore.Authentication.JwtBearer;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
|
||||||
using Swashbuckle.AspNetCore.Filters;
|
using Swashbuckle.AspNetCore.Filters;
|
||||||
using Swashbuckle.AspNetCore.SwaggerUI;
|
using Swashbuckle.AspNetCore.SwaggerUI;
|
||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace ZR.Admin.WebApi.Extensions
|
namespace ZR.Admin.WebApi.Extensions
|
||||||
|
|
@ -55,9 +57,9 @@ namespace ZR.Admin.WebApi.Extensions
|
||||||
Title = "ZrAdmin.NET Api",
|
Title = "ZrAdmin.NET Api",
|
||||||
Version = "v1",
|
Version = "v1",
|
||||||
Description = "系统管理",
|
Description = "系统管理",
|
||||||
Contact = new OpenApiContact { Name = "Admin doc", Url = new Uri("") }
|
Contact = new OpenApiContact { Name = "Admin doc" }
|
||||||
});
|
});
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//var tempPath = hostEnvironment.ContentRootPath;
|
//var tempPath = hostEnvironment.ContentRootPath;
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Controllers\Business\" />
|
||||||
<Folder Include="Controllers\WebApi\" />
|
<Folder Include="Controllers\WebApi\" />
|
||||||
<Folder Include="Properties\PublishProfiles\" />
|
<Folder Include="Properties\PublishProfiles\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
},
|
},
|
||||||
"dbConfigs": [
|
"dbConfigs": [
|
||||||
{
|
{
|
||||||
"Conn": "Data Source=192.168.195.8;User ID=sa;Password=Dbt@com@123;Initial Catalog=GiftAdmin;Encrypt=True;TrustServerCertificate=True;",
|
"Conn": "Data Source=192.168.195.8;User ID=sa;Password=Dbt@com@123;Initial Catalog=WatermarkCamera;Encrypt=True;TrustServerCertificate=True;",
|
||||||
"DbType": 1, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
"DbType": 1, //数据库类型 MySql = 0, SqlServer = 1, Oracle = 3,PgSql = 4
|
||||||
"ConfigId": "0", //多租户唯一标识
|
"ConfigId": "0", //多租户唯一标识
|
||||||
"IsAutoCloseConnection": true
|
"IsAutoCloseConnection": true
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
"Conn": "Data Source=192.168.195.8;User ID=sa;Password=Dbt@com@123;Encrypt=True;TrustServerCertificate=True;Initial Catalog={dbName};",
|
"Conn": "Data Source=192.168.195.8;User ID=sa;Password=Dbt@com@123;Encrypt=True;TrustServerCertificate=True;Initial Catalog={dbName};",
|
||||||
"DbType": 1,
|
"DbType": 1,
|
||||||
"IsAutoCloseConnection": true,
|
"IsAutoCloseConnection": true,
|
||||||
"DbName": "GiftAdmin" //代码生成默认连接数据库,Oracle库是实例的名称
|
"DbName": "WatermarkCamera" //代码生成默认连接数据库,Oracle库是实例的名称
|
||||||
},
|
},
|
||||||
"urls": "http://*:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
|
"urls": "http://*:8888", //项目启动url,如果改动端口前端对应devServer也需要进行修改
|
||||||
"corsUrls": [ "http://localhost:8887", "http://localhost:8886" ], //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
|
"corsUrls": [ "http://localhost:8887", "http://localhost:8886" ], //跨域地址(前端启动项目,前后端分离单独部署需要设置),多个用","隔开
|
||||||
|
|
|
||||||
|
|
@ -1,202 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Business.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表查询对象
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 审核时间
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "审核时间")]
|
|
||||||
[ExcelColumnName("审核时间")]
|
|
||||||
public DateTime? ReviewAt { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户id
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "微信用户id")]
|
|
||||||
[ExcelColumnName("微信用户id")]
|
|
||||||
public string UserWxOpenId { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 经度
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "经度")]
|
|
||||||
[ExcelColumnName("经度")]
|
|
||||||
public string Latitude { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 纬度
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "纬度")]
|
|
||||||
[ExcelColumnName("纬度")]
|
|
||||||
public string Longitude { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 经纬度地址
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "经纬度地址")]
|
|
||||||
[ExcelColumnName("经纬度地址")]
|
|
||||||
public string GeocodedAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ip地址
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "ip")]
|
|
||||||
[ExcelColumnName("ip")]
|
|
||||||
public string IP { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ip地址
|
|
||||||
/// </summary>
|
|
||||||
[ExcelColumn(Name = "ip地址")]
|
|
||||||
[ExcelColumnName("ip地址")]
|
|
||||||
public string IPAddress { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 纬度
|
|
||||||
/// </summary>
|
|
||||||
public string Latitude { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 经度
|
|
||||||
/// </summary>
|
|
||||||
public string Longitude { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Business.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序查询对象
|
|
||||||
/// </summary>
|
|
||||||
public class GiftConfigQueryDto : PagerInfo
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Business.Dto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表查询对象
|
|
||||||
/// </summary>
|
|
||||||
public class GiftUserQueryDto : PagerInfo
|
|
||||||
{
|
|
||||||
public string Nickname { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表输入输出对象
|
|
||||||
/// </summary>
|
|
||||||
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; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,111 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Business
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("gift_claim")]
|
|
||||||
public class GiftClaim
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 主键
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 用户ID
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "user_id")]
|
|
||||||
public int UserId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 姓名
|
|
||||||
/// </summary>
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 联系方式
|
|
||||||
/// </summary>
|
|
||||||
public string Phone { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 工作单位
|
|
||||||
/// </summary>
|
|
||||||
public string Company { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 收货地址
|
|
||||||
/// </summary>
|
|
||||||
public string Address { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 产品型号
|
|
||||||
/// </summary>
|
|
||||||
public string ProductModel { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 出品编号
|
|
||||||
/// </summary>
|
|
||||||
public string ProductSerialNumber { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 出品年月
|
|
||||||
/// </summary>
|
|
||||||
public string ProductDate { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 出品图片
|
|
||||||
/// </summary>
|
|
||||||
public string ProductImage { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 提交时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? CreatedAt { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 审核状态
|
|
||||||
/// </summary>
|
|
||||||
public int Status { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 审核时间
|
|
||||||
/// </summary>
|
|
||||||
public DateTime? ReviewAt { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户id
|
|
||||||
/// </summary>
|
|
||||||
public string UserWxOpenId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 经度
|
|
||||||
/// </summary>
|
|
||||||
public string Latitude { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 纬度
|
|
||||||
/// </summary>
|
|
||||||
public string Longitude { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// ip地址
|
|
||||||
/// </summary>
|
|
||||||
public string IP { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 经纬度地址
|
|
||||||
/// </summary>
|
|
||||||
public string GeocodedAddress { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// ip地址
|
|
||||||
/// </summary>
|
|
||||||
public string IPAddress { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public string Regeo { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Business
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("gift_config")]
|
|
||||||
public class GiftConfig
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Id
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 首页图片
|
|
||||||
/// </summary>
|
|
||||||
public string HomeImage { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扩展1
|
|
||||||
/// </summary>
|
|
||||||
public string Extend { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 扩展2
|
|
||||||
/// </summary>
|
|
||||||
public string Extend1 { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,71 +0,0 @@
|
||||||
|
|
||||||
namespace ZR.Model.Business
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("gift_user")]
|
|
||||||
public class GiftUser
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 主键ID
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
|
||||||
public int Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 微信openid
|
|
||||||
/// </summary>
|
|
||||||
public string Openid { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 微信unionid
|
|
||||||
/// </summary>
|
|
||||||
public string Unionid { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 昵称
|
|
||||||
/// </summary>
|
|
||||||
public string Nickname { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 头像URL
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "avatar_url")]
|
|
||||||
public string AvatarUrl { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 性别
|
|
||||||
/// </summary>
|
|
||||||
public string Gender { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 手机号
|
|
||||||
/// </summary>
|
|
||||||
public string Phone { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 状态
|
|
||||||
/// </summary>
|
|
||||||
public string Status { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 最后登录时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "last_login_time")]
|
|
||||||
public DateTime? LastLoginTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 创建时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "create_time")]
|
|
||||||
public DateTime? CreateTime { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新时间
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "update_time")]
|
|
||||||
public DateTime? UpdateTime { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Business\" />
|
||||||
<Folder Include="Social\Dto\" />
|
<Folder Include="Social\Dto\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IGiftClaimService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class GiftClaimService : BaseService<GiftClaim>, IGiftClaimService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品申领表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<GiftClaimDto> GetList(GiftClaimQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
//.OrderBy("Id desc")
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToPage<GiftClaim, GiftClaimDto>(parm);
|
|
||||||
//response.Result.ForEach(item =>
|
|
||||||
//{
|
|
||||||
// if (item.ProductImage.IndexOf("http") == -1)
|
|
||||||
// {
|
|
||||||
// item.ProductImage = "" +
|
|
||||||
// }
|
|
||||||
|
|
||||||
//});
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public GiftClaim GetInfo(int Id)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(x => x.Id == Id)
|
|
||||||
.First();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public GiftClaim AddGiftClaim(GiftClaim model)
|
|
||||||
{
|
|
||||||
return Insertable(model).ExecuteReturnEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateGiftClaim(GiftClaim model)
|
|
||||||
{
|
|
||||||
return Update(model, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出礼品申领表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<GiftClaimDto> 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<Model.System.SysDictData>("gift_request_claim"),
|
|
||||||
}, true)
|
|
||||||
.ToPage(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询导出表达式
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static Expressionable<GiftClaim> QueryExp(GiftClaimQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<GiftClaim>();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IGiftConfigService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class GiftConfigService : BaseService<GiftConfig>, IGiftConfigService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询礼品小程序列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<GiftConfigDto> GetList(GiftConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToPage<GiftConfig, GiftConfigDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public GiftConfig GetInfo(int Id)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(x => x.Id == Id)
|
|
||||||
.First();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public GiftConfig AddGiftConfig(GiftConfig model)
|
|
||||||
{
|
|
||||||
return Insertable(model).ExecuteReturnEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改礼品小程序
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateGiftConfig(GiftConfig model)
|
|
||||||
{
|
|
||||||
return Update(model, true, "修改礼品小程序");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询导出表达式
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static Expressionable<GiftConfig> QueryExp(GiftConfigQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<GiftConfig>();
|
|
||||||
|
|
||||||
return predicate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表Service业务层处理
|
|
||||||
/// </summary>
|
|
||||||
[AppService(ServiceType = typeof(IGiftUserService), ServiceLifetime = LifeTime.Transient)]
|
|
||||||
public class GiftUserService : BaseService<GiftUser>, IGiftUserService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 查询微信用户表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<GiftUserDto> GetList(GiftUserQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = QueryExp(parm);
|
|
||||||
|
|
||||||
var response = Queryable()
|
|
||||||
//.OrderBy("Id desc")
|
|
||||||
.Where(predicate.ToExpression())
|
|
||||||
.ToPage<GiftUser, GiftUserDto>(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取详情
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="Id"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public GiftUser GetInfo(int Id)
|
|
||||||
{
|
|
||||||
var response = Queryable()
|
|
||||||
.Where(x => x.Id == Id)
|
|
||||||
.First();
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 添加微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public GiftUser AddGiftUser(GiftUser model)
|
|
||||||
{
|
|
||||||
return Insertable(model).ExecuteReturnEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 修改微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int UpdateGiftUser(GiftUser model)
|
|
||||||
{
|
|
||||||
return Update(model, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 导出微信用户表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public PagedInfo<GiftUserDto> 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<Model.System.SysDictData>("sys_user_sex"),
|
|
||||||
StatusLabel = it.Status.GetConfigValue<Model.System.SysDictData>("sys_common_status"),
|
|
||||||
}, true)
|
|
||||||
.ToPage(parm);
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查询导出表达式
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="parm"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private static Expressionable<GiftUser> QueryExp(GiftUserQueryDto parm)
|
|
||||||
{
|
|
||||||
var predicate = Expressionable.Create<GiftUser>();
|
|
||||||
|
|
||||||
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.Nickname), it => it.Nickname.Contains(parm.Nickname));
|
|
||||||
return predicate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
using ZR.Model.Business.Dto;
|
|
||||||
using ZR.Model.Business;
|
|
||||||
|
|
||||||
namespace ZR.Service.Business.IBusinessService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品申领表service接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IGiftClaimService : IBaseService<GiftClaim>
|
|
||||||
{
|
|
||||||
PagedInfo<GiftClaimDto> GetList(GiftClaimQueryDto parm);
|
|
||||||
|
|
||||||
GiftClaim GetInfo(int Id);
|
|
||||||
|
|
||||||
|
|
||||||
GiftClaim AddGiftClaim(GiftClaim parm);
|
|
||||||
int UpdateGiftClaim(GiftClaim parm);
|
|
||||||
|
|
||||||
|
|
||||||
PagedInfo<GiftClaimDto> ExportList(GiftClaimQueryDto parm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
using ZR.Model.Business.Dto;
|
|
||||||
using ZR.Model.Business;
|
|
||||||
|
|
||||||
namespace ZR.Service.Business.IBusinessService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 礼品小程序service接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IGiftConfigService : IBaseService<GiftConfig>
|
|
||||||
{
|
|
||||||
PagedInfo<GiftConfigDto> GetList(GiftConfigQueryDto parm);
|
|
||||||
|
|
||||||
GiftConfig GetInfo(int Id);
|
|
||||||
|
|
||||||
|
|
||||||
GiftConfig AddGiftConfig(GiftConfig parm);
|
|
||||||
int UpdateGiftConfig(GiftConfig parm);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
using ZR.Model.Business.Dto;
|
|
||||||
using ZR.Model.Business;
|
|
||||||
|
|
||||||
namespace ZR.Service.Business.IBusinessService
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 微信用户表service接口
|
|
||||||
/// </summary>
|
|
||||||
public interface IGiftUserService : IBaseService<GiftUser>
|
|
||||||
{
|
|
||||||
PagedInfo<GiftUserDto> GetList(GiftUserQueryDto parm);
|
|
||||||
|
|
||||||
GiftUser GetInfo(int Id);
|
|
||||||
|
|
||||||
|
|
||||||
GiftUser AddGiftUser(GiftUser parm);
|
|
||||||
int UpdateGiftUser(GiftUser parm);
|
|
||||||
|
|
||||||
|
|
||||||
PagedInfo<GiftUserDto> ExportList(GiftUserQueryDto parm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
<ProjectReference Include="..\ZR.ServiceCore\ZR.ServiceCore.csproj" />
|
<ProjectReference Include="..\ZR.ServiceCore\ZR.ServiceCore.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Business\" />
|
||||||
<Folder Include="IService\" />
|
<Folder Include="IService\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user