feat 添加表情包分类接口

This commit is contained in:
AERWEN\26795 2023-10-29 15:18:49 +08:00
parent fed8e54d63
commit 18f20e0a34
7 changed files with 498 additions and 12 deletions

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using ARW.Model.Models.Business.EmotionManage.EmotionCategorys;
namespace ARW.Model.Dto.Api.EmotionManage.EmotionCategorys
{
/// <summary>
/// 表情包分类查询对象Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
public class EmotionCategoryQueryDtoApi : PagerInfo
{
public string EmotionCategoryName { get; set; }
}
/// <summary>
/// 表情包分类详情输入对象Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
public class EmotionCategoryDtoApi
{
[Required(ErrorMessage = "EmotionCategoryGuid不能为空")]
public long EmotionCategoryGuid { get; set; }
}
}

View File

@ -0,0 +1,133 @@
using Newtonsoft.Json;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
using ARW.Model.Models.Business.EmotionManage.EmotionCategorys;
using System.Collections.Generic;
namespace ARW.Model.Vo.Api.EmotionManage.EmotionCategorys
{
/// <summary>
/// 表情包分类展示对象Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
public class EmotionCategoryVoApi
{
/// <summary>
/// 描述 :
/// </summary>
[EpplusIgnore]
public int EmotionCategoryId { get; set; }
/// <summary>
/// 描述 :
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsTreeKey = true)]
[EpplusIgnore]
public long EmotionCategoryGuid { get; set; }
/// <summary>
/// 描述 :父级guid
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsTreeKey = true)]
[EpplusTableColumn(Header = "父级guid")]
public long EmotionCategoryParentGuid { get; set; }
/// <summary>
/// 描述 :祖级guid
/// </summary>
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsTreeKey = true)]
[EpplusTableColumn(Header = "祖级guid")]
public string EmotionCategoryAncestralGuid { get; set; }
/// <summary>
/// 描述 :名称
/// </summary>
[EpplusTableColumn(Header = "名称")]
public string EmotionCategoryName { get; set; }
/// <summary>
/// 描述 :图片
/// </summary>
[EpplusIgnore]
public string EmotionCategoryImg { get; set; }
/// <summary>
/// 描述 :是否为热门 (1是 2否)
/// </summary>
[EpplusTableColumn(Header = "是否为热门 (1是 2否)")]
public int IsPopular { get; set; }
/// <summary>
/// 描述 :浏览次数
/// </summary>
[EpplusTableColumn(Header = "浏览次数")]
public int EmotionCategoryViewsNum { get; set; }
/// <summary>
/// 描述 :排序
/// </summary>
[EpplusTableColumn(Header = "排序")]
public int EmotionCategorySort { get; set; }
public string ParentName { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[SugarColumn(IsIgnore = true)]
public List<EmotionCategoryVoApi> Children { get; set; }
}
/// <summary>
/// 表情包分类详情展示对象Api
/// </summary>
public class EmotionCategoryApiDetailsVo
{
[EpplusIgnore]
public int EmotionCategoryId { get; set; }
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsTreeKey = true)]
[EpplusIgnore]
public long EmotionCategoryGuid { get; set; }
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsTreeKey = true)]
[EpplusTableColumn(Header = "父级guid")]
public long EmotionCategoryParentGuid { get; set; }
[JsonConverter(typeof(ValueToStringConverter))]
[SugarColumn(IsTreeKey = true)]
[EpplusTableColumn(Header = "祖级guid")]
public string EmotionCategoryAncestralGuid { get; set; }
[EpplusTableColumn(Header = "名称")]
public string EmotionCategoryName { get; set; }
[EpplusIgnore]
public string EmotionCategoryImg { get; set; }
[EpplusTableColumn(Header = "是否为热门 (1是 2否)")]
public int IsPopular { get; set; }
[EpplusTableColumn(Header = "浏览次数")]
public int EmotionCategoryViewsNum { get; set; }
[EpplusTableColumn(Header = "排序")]
public int EmotionCategorySort { get; set; }
public string ParentName { get; set; }
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
[SugarColumn(IsIgnore = true)]
public List<EmotionCategoryVoApi> Children { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using Newtonsoft.Json;
using OfficeOpenXml.Attributes;
using SqlSugar;
using System;
using ARW.Model.Models.Business.EmotionManage.EmotionCategorys;
using System.Collections.Generic;
namespace ARW.Model.Vo.Api.EmotionManage.EmotionCategorys
{
/// <summary>
/// 表情包分类展示对象Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
public class EmotionCategoryListVoApi
{
/// <summary>
/// 描述 :名称
/// </summary>
public string Text { get; set; }
/// <summary>
/// 描述 :
/// </summary>
public int Key { get; set; }
}
}

View File

@ -0,0 +1,157 @@
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.EmotionManage.EmotionCategorys;
using ARW.Service.Api.IBusinessService.EmotionManage.EmotionCategorys;
using ARW.Model.Dto.Api.EmotionManage.EmotionCategorys;
using ARW.Model.Models.Business.EmotionManage.EmotionCategorys;
using ARW.Model.Vo.Api.EmotionManage.EmotionCategorys;
namespace ARW.Service.Api.BusinessService.EmotionManage.EmotionCategorys
{
/// <summary>
/// 表情包分类接口实现类Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
[AppService(ServiceType = typeof(IEmotionCategoryServiceApi), ServiceLifetime = LifeTime.Transient)]
public class EmotionCategoryServiceImplApi : BaseService<EmotionCategory>, IEmotionCategoryServiceApi
{
private readonly EmotionCategoryRepository _EmotionCategoryRepository;
public EmotionCategoryServiceImplApi(EmotionCategoryRepository EmotionCategoryRepository)
{
this._EmotionCategoryRepository = EmotionCategoryRepository;
}
#region Api接口代码
/// <summary>
/// 查询热门表情包分类列表(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public async Task<List<EmotionCategoryListVoApi>> GetHotEmotionCategoryListApi(EmotionCategoryQueryDtoApi parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<EmotionCategory>();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.EmotionCategoryName), s => s.EmotionCategoryName.Contains(parm.EmotionCategoryName));
var query = _EmotionCategoryRepository
.Queryable()
.Where(predicate.ToExpression())
.Where(s => s.IsPopular == 1)
.OrderBy(s => s.EmotionCategorySort, OrderByType.Asc)
.Select(s => new EmotionCategoryListVoApi
{
Key = s.EmotionCategoryId,
Text = s.EmotionCategoryName,
});
return await query.ToListAsync();
}
/// <summary>
/// 查询表情包分类列表(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public async Task<List<EmotionCategoryListVoApi>> GetEmotionCategoryListApi(EmotionCategoryQueryDtoApi parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<EmotionCategory>();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.EmotionCategoryName), s => s.EmotionCategoryName.Contains(parm.EmotionCategoryName));
var query = _EmotionCategoryRepository
.Queryable()
.Where(predicate.ToExpression())
.OrderBy(s => s.EmotionCategorySort, OrderByType.Asc)
.Select(s => new EmotionCategoryListVoApi
{
Key = s.EmotionCategoryId,
Text = s.EmotionCategoryName,
});
return await query.ToListAsync();
}
/// <summary>
/// 查询表情包分类树形列表(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public async Task<List<EmotionCategoryVoApi>> GetEmotionCategoryTreeListApi(EmotionCategoryQueryDtoApi parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create<EmotionCategory>();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.EmotionCategoryName), s => s.EmotionCategoryName.Contains(parm.EmotionCategoryName));
var query = _EmotionCategoryRepository
.Queryable()
.Where(predicate.ToExpression())
.LeftJoin<EmotionCategory>((s, c) => s.EmotionCategoryParentGuid == c.EmotionCategoryGuid)
.OrderBy(s => s.EmotionCategorySort, OrderByType.Asc)
.Select((s, c) => new EmotionCategoryVoApi
{
EmotionCategoryId = s.EmotionCategoryId,
EmotionCategoryGuid = s.EmotionCategoryGuid,
EmotionCategoryParentGuid = s.EmotionCategoryParentGuid,
EmotionCategoryAncestralGuid = s.EmotionCategoryAncestralGuid,
EmotionCategoryName = s.EmotionCategoryName,
EmotionCategoryImg = s.EmotionCategoryImg,
IsPopular = s.IsPopular,
EmotionCategoryViewsNum = s.EmotionCategoryViewsNum,
EmotionCategorySort = s.EmotionCategorySort,
ParentName = c.EmotionCategoryName,
});
return await query.ToTreeAsync(it => it.Children, it => it.EmotionCategoryParentGuid, 0);
}
/// <summary>
/// 查询表情包分类详情(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public async Task<string> GetEmotionCategoryDetails(EmotionCategoryDtoApi parm)
{
var query = _EmotionCategoryRepository
.Queryable()
.Where(s => s.EmotionCategoryGuid == parm.EmotionCategoryGuid)
.Select(s => new EmotionCategoryApiDetailsVo
{
EmotionCategoryId = s.EmotionCategoryId,
EmotionCategoryGuid = s.EmotionCategoryGuid,
EmotionCategoryParentGuid = s.EmotionCategoryParentGuid,
EmotionCategoryAncestralGuid = s.EmotionCategoryAncestralGuid,
EmotionCategoryName = s.EmotionCategoryName,
EmotionCategoryImg = s.EmotionCategoryImg,
IsPopular = s.IsPopular,
EmotionCategoryViewsNum = s.EmotionCategoryViewsNum,
EmotionCategorySort = s.EmotionCategorySort,
}).Take(1);
return await query.ToJsonAsync();
}
#endregion
}
}

View File

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ARW.Model;
using ARW.Model.Dto.Api.EmotionManage.EmotionCategorys;
using ARW.Model.Models.Business.EmotionManage.EmotionCategorys;
using ARW.Model.Vo.Api.EmotionManage.EmotionCategorys;
namespace ARW.Service.Api.IBusinessService.EmotionManage.EmotionCategorys
{
/// <summary>
/// 表情包分类接口类Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
public interface IEmotionCategoryServiceApi : IBaseService<EmotionCategory>
{
/// <summary>
/// 获取热门表情包分类列表(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
Task<List<EmotionCategoryListVoApi>> GetHotEmotionCategoryListApi(EmotionCategoryQueryDtoApi parm);
/// <summary>
/// 获取表情包分类列表(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
Task<List<EmotionCategoryListVoApi>> GetEmotionCategoryListApi(EmotionCategoryQueryDtoApi parm);
/// <summary>
/// 获取表情包分类树形列表(Api)
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
Task<List<EmotionCategoryVoApi>> GetEmotionCategoryTreeListApi(EmotionCategoryQueryDtoApi parm);
}
}

View File

@ -0,0 +1,87 @@
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.Admin.WebApi.Controllers;
using ARW.Model.Dto.Api.EmotionManage.EmotionCategorys;
using ARW.Service.Api.IBusinessService.EmotionManage.EmotionCategorys;
using ARW.Model.Models.Business.EmotionManage.EmotionCategorys;
using ARW.Model.Vo.Api.EmotionManage.EmotionCategorys;
using Microsoft.AspNetCore.Authorization;
using Geocoding;
namespace ARW.WebApi.Controllers.Api.EmotionManage.EmotionCategorys
{
/// <summary>
/// 表情包分类控制器Api
///
/// @author lwh
/// @date 2023-10-29
/// </summary>
[Verify]
[Route("api/[controller]")]
public class EmotionCategoryApiController : BaseController
{
private readonly IEmotionCategoryServiceApi _EmotionCategoryServiceApi;
/// <summary>
/// 依赖注入
/// </summary>
/// <param name="EmotionCategoryServiceApi">表情包分类表情包分类Api服务</param>
public EmotionCategoryApiController(IEmotionCategoryServiceApi EmotionCategoryServiceApi)
{
_EmotionCategoryServiceApi = EmotionCategoryServiceApi;
}
/// <summary>
/// 获取热门表情包分类列表(Api)
/// </summary>
/// <param name="parm">查询参数</param>
/// <returns></returns>
[HttpGet("getHotEmotionCategoryList")]
public async Task<IActionResult> GetHotEmotionCategoryListApi([FromQuery] EmotionCategoryQueryDtoApi parm)
{
var res = await _EmotionCategoryServiceApi.GetHotEmotionCategoryListApi(parm);
return SUCCESS(res);
}
/// <summary>
/// 获取表情包分类列表(Api)
/// </summary>
/// <param name="parm">查询参数</param>
/// <returns></returns>
[HttpGet("getEmotionCategoryList")]
public async Task<IActionResult> GetEmotionCategoryListApi([FromQuery] EmotionCategoryQueryDtoApi parm)
{
var res = await _EmotionCategoryServiceApi.GetEmotionCategoryListApi(parm);
return SUCCESS(res);
}
/// <summary>
/// 获取表情包分类树形列表(Api)
/// </summary>
/// <param name="parm">查询参数</param>
/// <returns></returns>
[HttpGet("getEmotionCategoryTreeList")]
public async Task<IActionResult> GetEmotionCategoryTreeListApi([FromQuery] EmotionCategoryQueryDtoApi parm)
{
var res = await _EmotionCategoryServiceApi.GetEmotionCategoryTreeListApi(parm);
if (res == null)
res = new List<EmotionCategoryVoApi>();
return SUCCESS(res);
}
}
}

View File

@ -145,22 +145,22 @@
"WeixinAppSecret": "9d0ba50302d9ae27916314605b9aa04e", // "WeixinAppSecret": "9d0ba50302d9ae27916314605b9aa04e", //
//V3 //V3
"TenPayV3_AppId": "wx8b03fffabbbfe804", // AppId "TenPayV3_AppId": "wxcdeaf70fb4239637", // AppId
"TenPayV3_AppSecret": "233a99954667ccfd6697dd3d31743fde", // AppSecret "TenPayV3_AppSecret": "38cd5c14af77f86d505437e706633bee", // AppSecret
"TenPayV3_SubAppId": "", //AppId "TenPayV3_SubAppId": "", //AppId
"TenPayV3_SubAppSecret": "", //AppSecret "TenPayV3_SubAppSecret": "", //AppSecret
"TenPayV3_MchName": "阿尔文电商", // "TenPayV3_MchName": "", //
"TenPayV3_MchId": "1645875842", // "TenPayV3_MchId": "", //
"TenPayV3_SubMchId": "", // "TenPayV3_SubMchId": "", //
"TenPayV3_Key": "", // () Key "TenPayV3_Key": "", // () Key
"TenPayV3_CertPath": "D:\\.Net\\Aerwen\\micro_mall_api\\wecaht_information\\cert\\apiclient_cert.p12", //D:\\cert\\apiclient_cert.p12 "TenPayV3_CertPath": "", //D:\\cert\\apiclient_cert.p12
"TenPayV3_CertSecret": "1645875842", // MchId "TenPayV3_CertSecret": "", // MchId
"TenPayV3_TenpayNotify": "http://shop.api.aerwen.net/api/WxPay/Notify", // "TenPayV3_TenpayNotify": "", //
"TenPayV3_RefundNotify": "http://shop.api.aerwen.net/api/WxPay/refundNotifyUrl", // 退 "TenPayV3_RefundNotify": "", // 退
"TenPayV3_WxOpenNotify": "http://shop.api.aerwen.net/api/WxPay/Notify", // "TenPayV3_WxOpenNotify": "", //
"TenPayV3_PrivateKey": "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7wzMe6ZBFh+Zsa4cZf0s2dfMfDlmbGD7KEly6l1aK42YsR+5VpFcB+TJH3pVAsRO0X//mMrQXDqlAzha8PgMKa5PuSc6LevfUaX6nHf454AwaTXc3CHdhClNbrHdaAqh+LqxvrAJwZydrBGwI9IgW73Ze0oFWiNGt7aLhnH30CxC1vmHkq/BrTsV7qUVenjJmmxdSR3SwtRI1IdeWOdTXasR4LU5hROvnVs/HIjzQTp+J3XMwf4zaOZgWTqz+23KZhuCVE9ZXe+quJCgWvuT+O8Do9SyG5iAZMlLg6nZYGy3L6cke/Am3KZDD9cUwQI+uS3z3gF0TYiG8fQVoJl25AgMBAAECggEBAJ+9diR6eO9uqy7aXFno3kg7GNf3EWzNt72a2aE1V79Zr3dEyxO5ePyI0aorR7d971GpysBBqs1i/8POkbEc4OFgnL5BtKMdvvLLvaDX942tex51gVMktMuuSTTZCcFeOZMAiluHb5vJZtO5M2B7CbzZhU8usDK6vAjI/6YJyW5w9cp9JLQwRGHe4P9aSbqlCE0swMDzdpGCvXB6GTSlATQtNkjnaPeZpv1HtOgJk72HNV56BY55zsYSrhTA+7Pd5jKCGPdQry84RkBnbTzM/BlFBfR5LXzwCH/cRBz3cgdhoklxT730oBnbaHDERzan4GbDY7pKqF6bIM8mJou2AbECgYEA6RikdNXFmbmuJ8GDgt/wtuEAsEQLovoCw2KFGGMk1Uu5rZJ908OKJ0aTzMdTXQEz4+QBqstJNzg2VA1blnTw/06l0RjprcJ0Ibq9BB0vCfFjR2R3OhiZlq/KjFHIeJ14+qhKKQlZ+inCL4G5VGRcR2MuHCmq3Msa6wAkCBMp7vsCgYEAzjY4p9TldFg+qJIv2x53Gz0SbqIA3g0L08tSvlxI2sWkluWMk1KVU6pMsInL/eogEGqYV/n1kjjTVJp75G7fxThdeO9BUxlpwmjTYXGlMUkLGB3/LXw//IKi6dWDJoZUW60z/yYfsPnM9/eYLXRF4dsHlb6nJvISXCLjZ4OdN9sCgYAPhJd2O8ES8dyZQvXJYbU5x5LvKSiJKhHDBi0MKZWLKaZr2sPLtEnfQYCXcnGnUGwu8L/3qd7u8SwUvmrpglGE/axmVj1AVyC6Gh95RaQbClnsp9CUKo0XDg7y9oLdHMawEUIWp0u5LsyBsyYuaxwFmKG6OD/qwQ7CtFixvOzevwKBgHZC0FEoHoOPzDd+xyVCHoqnhred/yNZlgvb0lNLt5iHurGzaeBffzYhN6QTEsNHDyZ7C22A853tKv2dLyo9j+WaQrkFdZBDxcxxs7BxrYxLWKp3IY4jcMrO3MF/6pwgc6az+Vr9sTUcvbkD7Ok8gotZwsrVMSV7tJ3UgFgwOez7AoGAB2TKMM7QrVfotvDtcDR689NvJ55RGWiKZv/BzsT5zE7LJH+0jwWl1jy24I1DSGgsPmLAt29+VLfgwfAyCz5ytMgvx6iu+cnsyriK3/SNdFZtymUegkIdzSONXslVZYqFsBKQz/M+BmgPvnQao/e8r8eWpIBZLBr93ud+LpDmEio=", // "TenPayV3_PrivateKey": "", //
"TenPayV3_SerialNumber": "6C34D380F6B239BEE351D9EB4AD2655FF38D4AAA", // "TenPayV3_SerialNumber": "", //
"TenPayV3_ApiV3Key": "3aF7gH1jKmN5pR8tU2xW4z7C9vY0BqXr" //APIv3 "TenPayV3_ApiV3Key": "" //APIv3
} }
} }