feat 添加轮播图
This commit is contained in:
parent
39cdde64a0
commit
efcf747dd9
54
ARW.Model/Dto/Business/Advertisement/Banners/BannerDto.cs
Normal file
54
ARW.Model/Dto/Business/Advertisement/Banners/BannerDto.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using ARW.Model.Models.Business.Advertisement.Banners;
|
||||
|
||||
namespace ARW.Model.Dto.Business.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图输入对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class BannerDto
|
||||
{
|
||||
|
||||
public int BannerId { get; set; }
|
||||
|
||||
public long BannerGuid { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "位置不能为空")]
|
||||
public int BannerPosition { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "图片不能为空")]
|
||||
public string BannerImg { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "排序不能为空")]
|
||||
public int BannerSort { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 轮播图查询对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class BannerQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public int? BannerPosition { get; set; }
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
65
ARW.Model/Models/Business/Advertisement/Banners/Banner.cs
Normal file
65
ARW.Model/Models/Business/Advertisement/Banners/Banner.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ARW.Model.Models.Business.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图,数据实体对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[SugarTable("tb_banner")]
|
||||
public class Banner : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "banner_id")]
|
||||
public int BannerId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "banner_guid")]
|
||||
public long BannerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :位置
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "banner_position")]
|
||||
public int BannerPosition { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :图片
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "banner_img")]
|
||||
public string BannerImg { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :排序
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "banner_sort")]
|
||||
public int BannerSort { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
49
ARW.Model/Vo/Business/Advertisement/Banners/BannerVo.cs
Normal file
49
ARW.Model/Vo/Business/Advertisement/Banners/BannerVo.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图展示对象
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public class BannerVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int BannerId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long BannerGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :位置
|
||||
/// </summary>
|
||||
public int BannerPosition { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :图片
|
||||
/// </summary>
|
||||
public string BannerImg { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :排序
|
||||
/// </summary>
|
||||
public int BannerSort { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using Infrastructure.Attribute;
|
||||
using ARW.Repository.System;
|
||||
using ARW.Model.Models.Business.Advertisement.Banners;
|
||||
|
||||
namespace ARW.Repository.Business.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图仓储
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class BannerRepository : BaseRepository<Banner>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,36 +1,12 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.ShopManager.Shops;
|
||||
using ARW.Service.Api.IBusinessService.ShopManager.Shops;
|
||||
using ARW.Model.Dto.Api.ShopManager.Shops;
|
||||
using ARW.Model.Models.Business.ShopManager.Shops;
|
||||
using ARW.Model.Vo.Api.ShopManager.Shops;
|
||||
using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
|
||||
using ARW.Repository.Business.GoodsManager.GoodsCategorys;
|
||||
using ARW.Repository.Business.Custom.Customers;
|
||||
using ARW.Model.Models.Business.Custom.Customers;
|
||||
using ARW.Repository.Business.LogisticsManage.Deliverys;
|
||||
using ARW.Service.Business.IBusinessService.LogisticsManage.Deliverys;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.Goodss;
|
||||
using ARW.Model.Models.Business.LogisticsManage.Deliverys;
|
||||
using ARW.Model.Models.Business.LogisticsManage.DeliveryRules;
|
||||
using ARW.Service.Business.IBusinessService.GoodsManager.GoodsServicess;
|
||||
using ARW.Model.Models.Business.GoodsManager.GoodsServicess;
|
||||
using ARW.Model.Models.Business.Payments;
|
||||
using Aliyun.OSS;
|
||||
using ARW.Service.Business.IBusinessService.Payments;
|
||||
using Infrastructure;
|
||||
using static Infrastructure.WeChat.TenPay.Pay;
|
||||
using Infrastructure.WeChat.TenPay;
|
||||
using System.Net.Http;
|
||||
using Senparc.CO2NET.HttpUtility;
|
||||
using ARW.Service.Api.IBusinessService.PayManage;
|
||||
using ARW.Repository.Business.Payments;
|
||||
@ -39,12 +15,12 @@ using ARW.Repository.Business.OrderManage.Orders;
|
||||
namespace ARW.Service.Api.BusinessService.PaymentManage
|
||||
{
|
||||
/// <summary>
|
||||
/// 店铺接口实现类Api
|
||||
/// 支付业务实现类Api
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-06-12
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IShopServiceApi), ServiceLifetime = LifeTime.Transient)]
|
||||
[AppService(ServiceType = typeof(IPayServiceApi), ServiceLifetime = LifeTime.Transient)]
|
||||
public class PayServiceApi : BaseService<Payment>, IPayServiceApi
|
||||
{
|
||||
private readonly ShopRepository _ShopRepository;
|
||||
|
@ -0,0 +1,93 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Infrastructure;
|
||||
using ARW.Model;
|
||||
using ARW.Repository;
|
||||
using ARW.Repository.Business.Advertisement.Banners;
|
||||
using ARW.Service.Business.IBusinessService.Advertisement.Banners;
|
||||
using ARW.Model.Dto.Business.Advertisement.Banners;
|
||||
using ARW.Model.Models.Business.Advertisement.Banners;
|
||||
using ARW.Model.Vo.Business.Advertisement.Banners;
|
||||
|
||||
namespace ARW.Service.Business.BusinessService.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图接口实现类
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IBannerService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class BannerServiceImpl : BaseService<Banner>, IBannerService
|
||||
{
|
||||
private readonly BannerRepository _BannerRepository;
|
||||
|
||||
public BannerServiceImpl(BannerRepository BannerRepository)
|
||||
{
|
||||
this._BannerRepository = BannerRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询轮播图分页列表
|
||||
/// </summary>
|
||||
public async Task<PagedInfo<BannerVo>> GetBannerList(BannerQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<Banner>();
|
||||
|
||||
predicate = predicate.AndIF(parm.BannerPosition != null, s => s.BannerPosition == parm.BannerPosition);
|
||||
var query = _BannerRepository
|
||||
.Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderBy(s => s.BannerSort,OrderByType.Asc)
|
||||
.Select(s => new BannerVo
|
||||
{
|
||||
BannerId = s.BannerId,
|
||||
BannerGuid = s.BannerGuid,
|
||||
BannerPosition = s.BannerPosition,
|
||||
BannerImg = s.BannerImg,
|
||||
BannerSort = s.BannerSort,
|
||||
});
|
||||
|
||||
|
||||
return await query.ToPageAsync(parm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改轮播图
|
||||
/// </summary>
|
||||
public async Task<string> AddOrUpdateBanner(Banner model)
|
||||
{
|
||||
if (model.BannerId != 0)
|
||||
{
|
||||
var response = await _BannerRepository.UpdateAsync(model);
|
||||
return "修改成功!";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
var response = await _BannerRepository.InsertReturnSnowflakeIdAsync(model);
|
||||
return "添加成功!";
|
||||
}
|
||||
}
|
||||
|
||||
#region Excel处理
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -83,7 +83,7 @@ namespace ARW.Service.Business.BusinessService.OrderManage.Orders
|
||||
.Queryable()
|
||||
.LeftJoin<Customer>((s, c) => s.CustomerGuid == c.CustomerGuid)
|
||||
.Where(predicate.ToExpression())
|
||||
.WhereIF(!string.IsNullOrEmpty(parm.CustomerNickNme), (s, c) => c.CustomerNickname.Contains(parm.CustomerNickNme) )
|
||||
.WhereIF(!string.IsNullOrEmpty(parm.CustomerNickNme), (s, c) => c.CustomerNickname.Contains(parm.CustomerNickNme))
|
||||
.WhereIF(!string.IsNullOrEmpty(parm.CustomerPhome), (s, c) => c.CustomerMobilePhoneNumber.Contains(parm.CustomerPhome))
|
||||
.OrderBy(s => s.Create_time, OrderByType.Desc)
|
||||
.Select((s, c) => new OrderVo
|
||||
@ -321,8 +321,9 @@ namespace ARW.Service.Business.BusinessService.OrderManage.Orders
|
||||
{
|
||||
var specName = await _GoodsSkuService.GetSpecValueFullName(orderGoods.GoodsSkuId);
|
||||
var sku = await _GoodsSkuService.GetByIdAsync(orderGoods.GoodsSkuId);
|
||||
if (sku != null)
|
||||
orderGoodsInfo.GoodsPrice = sku.GoodsSkuPrice;
|
||||
orderGoodsInfo.GoodsSpecName = specName;
|
||||
orderGoodsInfo.GoodsPrice = sku.GoodsSkuPrice;
|
||||
orderGoodsInfo.GoodsCoding = goods.GoodsCoding;
|
||||
}
|
||||
else
|
||||
|
@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ARW.Model;
|
||||
using ARW.Model.Dto.Business.Advertisement.Banners;
|
||||
using ARW.Model.Models.Business.Advertisement.Banners;
|
||||
using ARW.Model.Vo.Business.Advertisement.Banners;
|
||||
|
||||
namespace ARW.Service.Business.IBusinessService.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图接口类
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
public interface IBannerService : IBaseService<Banner>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取轮播图分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<BannerVo>> GetBannerList(BannerQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改轮播图
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateBanner(Banner parm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -131,7 +131,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
throw new CustomException("订单关闭失败!");
|
||||
else
|
||||
{
|
||||
var respones = _PaymentService.UpdateAsync(f => new Payment
|
||||
var respones = _PayServiceApi.UpdateAsync(f => new Payment
|
||||
{
|
||||
PaymentStatus = 3,
|
||||
Update_time = DateTime.Now
|
||||
@ -153,7 +153,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
public async Task<IActionResult> Refund([FromBody] OrderQueryDto parm)
|
||||
{
|
||||
Pay pay = new Pay(_httpClient);
|
||||
var payment = _PaymentService.GetFirstAsync(s => s.PaymentNumber == parm.outTradeNo).Result;
|
||||
var payment = _PayServiceApi.GetFirstAsync(s => s.PaymentNumber == parm.outTradeNo).Result;
|
||||
var transactionId = payment.PaymentWeixinNumber;
|
||||
string paymentRefundNumber = "";
|
||||
if (!string.IsNullOrEmpty(payment.PaymentRefundNumber))
|
||||
@ -167,7 +167,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
throw new CustomException("订单退款失败!");
|
||||
else
|
||||
{
|
||||
var respones = _PaymentService.UpdateAsync(f => new Payment
|
||||
var respones = _PayServiceApi.UpdateAsync(f => new Payment
|
||||
{
|
||||
PaymentRefundNumber = res.out_refund_no,
|
||||
}, f => f.PaymentNumber == res.out_trade_no);
|
||||
@ -195,7 +195,7 @@ namespace ARW.WebApi.Controllers.Api.Wechat.WxPay
|
||||
logger.Info("退款回调之业务:", res.refund_status);
|
||||
// 业务
|
||||
|
||||
var respones = _PaymentService.UpdateAsync(f => new Payment
|
||||
var respones = _PayServiceApi.UpdateAsync(f => new Payment
|
||||
{
|
||||
PaymentRefundNumber = res.out_refund_no,
|
||||
PaymentStatus = 4,
|
||||
|
@ -0,0 +1,98 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Enums;
|
||||
using Infrastructure.Model;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ARW.Admin.WebApi.Extensions;
|
||||
using ARW.Admin.WebApi.Filters;
|
||||
using ARW.Common;
|
||||
using ARW.Model.Dto.Business.Advertisement.Banners;
|
||||
using ARW.Service.Business.IBusinessService.Advertisement.Banners;
|
||||
using ARW.Admin.WebApi.Controllers;
|
||||
using ARW.Model.Models.Business.Advertisement.Banners;
|
||||
using ARW.Model.Vo.Business.Advertisement.Banners;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using ARW.Admin.WebApi.Framework;
|
||||
|
||||
|
||||
namespace ARW.WebApi.Controllers.Business.Advertisement.Banners
|
||||
{
|
||||
/// <summary>
|
||||
/// 轮播图控制器
|
||||
///
|
||||
/// @author lwh
|
||||
/// @date 2023-10-09
|
||||
/// </summary>
|
||||
[Verify]
|
||||
[Route("business/[controller]")]
|
||||
public class BannerController : BaseController
|
||||
{
|
||||
private readonly IBannerService _BannerService;
|
||||
|
||||
/// <summary>
|
||||
/// 依赖注入
|
||||
/// </summary>
|
||||
/// <param name="BannerService">轮播图服务</param>
|
||||
public BannerController(IBannerService BannerService)
|
||||
{
|
||||
_BannerService = BannerService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取轮播图列表
|
||||
/// </summary>
|
||||
/// <param name="parm">查询参数</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("getBannerList")]
|
||||
[ActionPermissionFilter(Permission = "business:banner:list")]
|
||||
public async Task<IActionResult> GetBannerList([FromQuery] BannerQueryDto parm)
|
||||
{
|
||||
var res = await _BannerService.GetBannerList(parm);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改轮播图
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("addOrUpdateBanner")]
|
||||
[ActionPermissionFilter(Permission = "business:banner:addOrUpdate")]
|
||||
[Log(Title = "添加或修改轮播图", BusinessType = BusinessType.ADDORUPDATE)]
|
||||
public async Task<IActionResult> AddOrUpdateBanner([FromBody] BannerDto parm)
|
||||
{
|
||||
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||
|
||||
var modal = new Banner();
|
||||
if (parm.BannerId != 0) modal = parm.Adapt<Banner>().ToUpdate(HttpContext);
|
||||
else modal = parm.Adapt<Banner>().ToCreate(HttpContext);
|
||||
|
||||
var res = await _BannerService.AddOrUpdateBanner(modal);
|
||||
return SUCCESS(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除轮播图
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
[ActionPermissionFilter(Permission = "business:banner:delete")]
|
||||
[Log(Title = "轮播图删除", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult Delete(string ids)
|
||||
{
|
||||
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
var response = _BannerService.Delete(idsArr);
|
||||
return SUCCESS("删除成功!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -47,7 +47,7 @@
|
||||
"autoPre": true, //自动去除表前缀
|
||||
"author": "admin",
|
||||
"tablePrefix": "tb_", //"表前缀(生成类名不会包含表前缀,多个用逗号分隔)",
|
||||
"vuePath": "D:\\.Net\\Aerwen\\shop_template\\shop_template_back" //前端代码存储路径eg:D:\Work\ARWAdmin-Vue3
|
||||
"vuePath": "D:\\Programming\\Net\\Aerwen\\template\\shop\\shop_back" //前端代码存储路径eg:D:\Work\ARWAdmin-Vue3
|
||||
},
|
||||
//邮箱配置信息
|
||||
"MailOptions": {
|
||||
|
Loading…
Reference in New Issue
Block a user