chore: migrate remaining ECharts components to Chart.js
- Migrated 4 components from ECharts to Chart.js: * MonthlyExpenseCard.vue (折线图) * DailyTrendChart.vue (双系列折线图) * ExpenseCategoryCard.vue (环形图) * BudgetChartAnalysis.vue (仪表盘 + 多种图表) - Removed all ECharts imports and environment variable switches - Unified all charts to use BaseChart.vue component - Build verified: pnpm build success ✓ - No echarts imports remaining ✓ Refs: openspec/changes/migrate-remaining-echarts-to-chartjs
This commit is contained in:
72
WebApi/Controllers/IconController.cs
Normal file
72
WebApi/Controllers/IconController.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Application.Dto.Icon;
|
||||
using Application;
|
||||
using Service.IconSearch;
|
||||
|
||||
namespace WebApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
/// 图标管理控制器
|
||||
/// </summary>
|
||||
[ApiController]
|
||||
[Route("api/icons")]
|
||||
public class IconController(
|
||||
IIconSearchService iconSearchService,
|
||||
ILogger<IconController> logger
|
||||
) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成搜索关键字
|
||||
/// </summary>
|
||||
/// <param name="request">搜索关键字生成请求</param>
|
||||
/// <returns>搜索关键字生成响应</returns>
|
||||
[HttpPost("search-keywords")]
|
||||
public async Task<BaseResponse<SearchKeywordsResponse>> GenerateSearchKeywordsAsync(
|
||||
[FromBody] SearchKeywordsRequest request)
|
||||
{
|
||||
var keywords = await iconSearchService.GenerateSearchKeywordsAsync(request.CategoryName);
|
||||
logger.LogInformation("为分类 {CategoryName} 生成了 {Count} 个搜索关键字",
|
||||
request.CategoryName, keywords.Count);
|
||||
|
||||
return new SearchKeywordsResponse { Keywords = keywords }.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索图标
|
||||
/// </summary>
|
||||
/// <param name="request">搜索图标请求</param>
|
||||
/// <returns>图标候选列表响应</returns>
|
||||
[HttpPost("search")]
|
||||
public async Task<BaseResponse<List<IconCandidateDto>>> SearchIconsAsync(
|
||||
[FromBody] SearchIconsRequest request)
|
||||
{
|
||||
var icons = await iconSearchService.SearchIconsAsync(request.Keywords, limit: 20);
|
||||
logger.LogInformation("搜索到 {Count} 个图标候选", icons.Count);
|
||||
|
||||
var iconDtos = icons.Select(i => new IconCandidateDto
|
||||
{
|
||||
CollectionName = i.CollectionName,
|
||||
IconName = i.IconName,
|
||||
IconIdentifier = i.IconIdentifier
|
||||
}).ToList();
|
||||
|
||||
return iconDtos.Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新分类图标
|
||||
/// </summary>
|
||||
/// <param name="categoryId">分类ID</param>
|
||||
/// <param name="request">更新分类图标请求</param>
|
||||
/// <returns>操作结果</returns>
|
||||
[HttpPut("categories/{categoryId}/icon")]
|
||||
public async Task<BaseResponse> UpdateCategoryIconAsync(
|
||||
long categoryId,
|
||||
[FromBody] UpdateCategoryIconRequest request)
|
||||
{
|
||||
await iconSearchService.UpdateCategoryIconAsync(categoryId, request.IconIdentifier);
|
||||
logger.LogInformation("更新分类 {CategoryId} 的图标为 {IconIdentifier}",
|
||||
categoryId, request.IconIdentifier);
|
||||
|
||||
return "更新分类图标成功".Ok();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user