feat: 新增任务系统应用服务

This commit is contained in:
chenchun
2024-08-12 17:43:24 +08:00
parent b4751ea87a
commit 6095f2174f
6 changed files with 67 additions and 16 deletions

View File

@@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment;
public class AssignmentGetListInput
{
}

View File

@@ -0,0 +1,8 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment;
public class AssignmentGetListOutputDto:EntityDto<Guid>
{
}

View File

@@ -7,10 +7,5 @@ namespace Yi.Framework.Bbs.Application.Contracts.IServices
/// </summary>
public interface ISettingService : IApplicationService
{
/// <summary>
/// 获取配置标题
/// </summary>
/// <returns></returns>
Task<string> GetTitleAsync();
}
}

View File

@@ -0,0 +1,51 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Users;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Assignment;
using Yi.Framework.Bbs.Domain.Managers;
namespace Yi.Framework.Bbs.Application.Services;
/// <summary>
/// 任务系统
/// </summary>
[Authorize]
public class AssignmentService : ApplicationService
{
private readonly AssignmentManager _assignmentManager;
public AssignmentService(AssignmentManager assignmentManager)
{
_assignmentManager = assignmentManager;
}
/// <summary>
/// 接收任务
/// </summary>
/// <param name="id"></param>
[HttpPost("assignment/accept/{id}")]
public async Task AcceptAsync(Guid id)
{
await _assignmentManager.AcceptAsync(CurrentUser.GetId(), id);
}
/// <summary>
/// 接收任务奖励
/// </summary>
/// <param name="id"></param>
[HttpPost("assignment/receive-rewards/{id}")]
public async Task ReceiveRewardsAsync(Guid id)
{
await _assignmentManager.ReceiveRewardsAsync(id);
}
/// <summary>
/// 查询任务
/// </summary>
public async Task<PagedResultDto<AssignmentGetListOutputDto>> GetListAsync(AssignmentGetListInput input)
{
throw new NotImplementedException();
}
}

View File

@@ -9,15 +9,6 @@ namespace Yi.Framework.Bbs.Application.Services
public class SettingService : ApplicationService,
ISettingService
{
/// <summary>
/// 获取配置标题
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public Task<string> GetTitleAsync()
{
return Task.FromResult("你好世界");
}
/// <summary>
/// 获取头像文件
@@ -25,9 +16,7 @@ namespace Yi.Framework.Bbs.Application.Services
/// <returns></returns>
public List<string> GetIcon()
{
return Directory.GetFiles("wwwroot/icon").Select(x => "wwwroot/icon/"+ Path.GetFileName(x)).ToList();
}
}
}