增加修炼功能

This commit is contained in:
LN
2026-07-04 14:08:35 +08:00
parent 404af92f96
commit e1bff431e4
7 changed files with 247 additions and 2 deletions

View File

@@ -14,5 +14,6 @@ public static class GoodsEnum
Card,//附魔卡片
Mark,//圣痕
Pack,//宝箱
Practise,//修炼道具
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Application.Domain
{
public interface IUnitUserPractiseService
{
Task<bool> DelPractise(string practiseId);
Task<bool> AddPractise(unit_user_practise practise);
Task<unit_user_practise> GetUserPractiseInfo(string practiseId);
Task<List<unit_user_practise>> GetUserPractiseList(string userId, int page, int limit, RefAsync<int> total);
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Application.Domain
{
public class UnitUserPractiseService(ISqlSugarClient DbClient, IRedisCache redis) : IUnitUserPractiseService, ITransient
{
public async Task<bool> DelPractise(string practiseId)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Deleteable<unit_user_practise>().Where(i => i.practiseId == practiseId).ExecuteCommandAsync() > 0;
}
public async Task<bool> AddPractise(unit_user_practise practise)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Insertable(practise).ExecuteCommandAsync() > 0;
}
public async Task<unit_user_practise> GetUserPractiseInfo(string practiseId)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Queryable<unit_user_practise>().Where(i => i.practiseId == practiseId).SingleAsync();
}
public async Task<List<unit_user_practise>> GetUserPractiseList(string userId, int page, int limit, RefAsync<int> total)
{
var db = DbClient.AsTenant().GetConnectionWithAttr<unit_user_practise>();
return await db.Queryable<unit_user_practise>().Where(i => i.userId == userId).ToPageListAsync(page, limit, total);
}
}
}