提交
This commit is contained in:
parent
2a6d268488
commit
abcda60338
103
CoreCms.Net.IRepository/SQ/ISQReservationEvaluateRepository.cs
Normal file
103
CoreCms.Net.IRepository/SQ/ISQReservationEvaluateRepository.cs
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2025/9/12 16:38:57
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
namespace CoreCms.Net.IRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// 对局评价表 工厂接口
|
||||
/// </summary>
|
||||
public interface ISQReservationEvaluateRepository : IBaseRepository<SQReservationEvaluate>
|
||||
{
|
||||
#region 重写增删改查操作===========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> InsertAsync(SQReservationEvaluate entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> UpdateAsync(SQReservationEvaluate entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> UpdateAsync(List<SQReservationEvaluate> entity);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SQReservationEvaluate>> GetCaChe();
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
Task<List<SQReservationEvaluate>> UpdateCaChe();
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
new Task<IPageList<SQReservationEvaluate>> QueryPageAsync(
|
||||
Expression<Func<SQReservationEvaluate, bool>> predicate,
|
||||
Expression<Func<SQReservationEvaluate, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
|
||||
}
|
||||
}
|
||||
99
CoreCms.Net.IServices/SQ/ISQReservationEvaluateServices.cs
Normal file
99
CoreCms.Net.IServices/SQ/ISQReservationEvaluateServices.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2025/9/12 16:38:57
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.IServices
|
||||
{
|
||||
/// <summary>
|
||||
/// 对局评价表 服务工厂接口
|
||||
/// </summary>
|
||||
public interface ISQReservationEvaluateServices : IBaseServices<SQReservationEvaluate>
|
||||
{
|
||||
#region 重写增删改查操作===========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> InsertAsync(SQReservationEvaluate entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> UpdateAsync(SQReservationEvaluate entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> UpdateAsync(List<SQReservationEvaluate> entity);
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> DeleteByIdAsync(object id);
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
new Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
Task<List<SQReservationEvaluate>> GetCaChe();
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
Task<List<SQReservationEvaluate>> UpdateCaChe();
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
new Task<IPageList<SQReservationEvaluate>> QueryPageAsync(
|
||||
Expression<Func<SQReservationEvaluate, bool>> predicate,
|
||||
Expression<Func<SQReservationEvaluate, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false);
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
128
CoreCms.Net.Model/Entities/SQ/SQReservationEvaluate.cs
Normal file
128
CoreCms.Net.Model/Entities/SQ/SQReservationEvaluate.cs
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2025/9/12 16:38:57
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using SqlSugar;
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace CoreCms.Net.Model.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 对局评价表
|
||||
/// </summary>
|
||||
public partial class SQReservationEvaluate
|
||||
{
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public SQReservationEvaluate()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[Display(Name = "主键")]
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 对局id
|
||||
/// </summary>
|
||||
[Display(Name = "对局id")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 reservation_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
[Display(Name = "用户id")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 user_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 被评价用户id
|
||||
/// </summary>
|
||||
[Display(Name = "被评价用户id")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public int to_user_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
[Display(Name = "角色")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Int32 role { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 牌品等级
|
||||
/// </summary>
|
||||
[Display(Name = "牌品等级")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Decimal play_level { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 牌技等级
|
||||
/// </summary>
|
||||
[Display(Name = "牌技等级")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.Decimal skills_level { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 评价时间
|
||||
/// </summary>
|
||||
[Display(Name = "评价时间")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
|
||||
|
||||
|
||||
public System.DateTime created_at { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -132,5 +132,12 @@ namespace CoreCms.Net.Model.Entities
|
|||
/// </summary>
|
||||
[Display(Name = "是否需要退款。0 无需退款,未交押金,1 交押金,待退款,2,交押金,退款中,3 退款成功,9退款失败")]
|
||||
public System.Int32 is_refund { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否赴约
|
||||
/// </summary>
|
||||
[Display(Name = "是否赴约")]
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Int32 is_arrive { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,5 +142,21 @@ namespace CoreCms.Net.Model.Entities
|
|||
[SugarColumn(ColumnDescription = "删除标志 有数据就是删除")]
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Boolean isDelete { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 牌品等级
|
||||
/// </summary>
|
||||
[Display(Name = "牌品等级")]
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Decimal play_level { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 牌技等级
|
||||
/// </summary>
|
||||
[Display(Name = "牌技等级")]
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Decimal skills_level { get; set; }
|
||||
}
|
||||
}
|
||||
69
CoreCms.Net.Model/ViewModels/SQ/SQReservationEvaluateDto.cs
Normal file
69
CoreCms.Net.Model/ViewModels/SQ/SQReservationEvaluateDto.cs
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
using SqlSugar;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CoreCms.Net.Model.ViewModels.SQ;
|
||||
|
||||
public class SQReservationEvaluateDto
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 对局id
|
||||
/// </summary>
|
||||
[Display(Name = "对局id")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Int32 reservation_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 被评价用户id
|
||||
/// </summary>
|
||||
[Display(Name = "被评价用户id")]
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public int to_user_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 牌品等级
|
||||
/// </summary>
|
||||
[Display(Name = "牌品等级")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Decimal play_level { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 牌技等级
|
||||
/// </summary>
|
||||
[Display(Name = "牌技等级")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public System.Decimal skills_level { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SQReservationEvaluateFDto
|
||||
{
|
||||
|
||||
public System.Decimal level { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[Display(Name = " ")]
|
||||
|
||||
[Required(ErrorMessage = "请输入{0}")]
|
||||
public int rs_count { get; set; }
|
||||
}
|
||||
|
||||
|
|
@ -92,4 +92,20 @@ namespace CoreCms.Net.Model.ViewModels.SQ
|
|||
/// </summary>
|
||||
public int UserBlackStatus { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class SQReservationParticipantsApiEavDto : SQReservationParticipantsApiDto
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public decimal play_level { get; set; }
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public decimal skills_level { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
245
CoreCms.Net.Repository/SQ/SQReservationEvaluateRepository.cs
Normal file
245
CoreCms.Net.Repository/SQ/SQReservationEvaluateRepository.cs
Normal file
|
|
@ -0,0 +1,245 @@
|
|||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2025/9/12 16:38:57
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Caching.Manual;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Repository
|
||||
{
|
||||
/// <summary>
|
||||
/// 对局评价表 接口实现
|
||||
/// </summary>
|
||||
public class SQReservationEvaluateRepository : BaseRepository<SQReservationEvaluate>, ISQReservationEvaluateRepository
|
||||
{
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
public SQReservationEvaluateRepository(IUnitOfWork unitOfWork) : base(unitOfWork)
|
||||
{
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(SQReservationEvaluate entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Insertable(entity).ExecuteReturnIdentityAsync() > 0;
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.CreateSuccess : GlobalConstVars.CreateFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(SQReservationEvaluate entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var oldModel = await DbClient.Queryable<SQReservationEvaluate>().In(entity.id).SingleAsync();
|
||||
if (oldModel == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
//事物处理过程开始
|
||||
oldModel.id = entity.id;
|
||||
oldModel.reservation_id = entity.reservation_id;
|
||||
oldModel.user_id = entity.user_id;
|
||||
oldModel.role = entity.role;
|
||||
oldModel.play_level = entity.play_level;
|
||||
oldModel.skills_level = entity.skills_level;
|
||||
oldModel.is_arrive = entity.is_arrive;
|
||||
oldModel.created_at = entity.created_at;
|
||||
|
||||
//事物处理过程结束
|
||||
var bl = await DbClient.Updateable(oldModel).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<SQReservationEvaluate> entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Updateable(entity).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.EditSuccess : GlobalConstVars.EditFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<SQReservationEvaluate>(id).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var bl = await DbClient.Deleteable<SQReservationEvaluate>().In(ids).ExecuteCommandHasChangeAsync();
|
||||
jm.code = bl ? 0 : 1;
|
||||
jm.msg = bl ? GlobalConstVars.DeleteSuccess : GlobalConstVars.DeleteFailure;
|
||||
if (bl)
|
||||
{
|
||||
await UpdateCaChe();
|
||||
}
|
||||
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SQReservationEvaluate>> GetCaChe()
|
||||
{
|
||||
var cache = ManualDataCache.Instance.Get<List<SQReservationEvaluate>>(GlobalConstVars.CacheSQReservationEvaluate);
|
||||
if (cache != null)
|
||||
{
|
||||
return cache;
|
||||
}
|
||||
return await UpdateCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<SQReservationEvaluate>> UpdateCaChe()
|
||||
{
|
||||
var list = await DbClient.Queryable<SQReservationEvaluate>().With(SqlWith.NoLock).ToListAsync();
|
||||
ManualDataCache.Instance.Set(GlobalConstVars.CacheSQReservationEvaluate, list);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<SQReservationEvaluate>> QueryPageAsync(Expression<Func<SQReservationEvaluate, bool>> predicate,
|
||||
Expression<Func<SQReservationEvaluate, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
RefAsync<int> totalCount = 0;
|
||||
List<SQReservationEvaluate> page;
|
||||
if (blUseNoLock)
|
||||
{
|
||||
page = await DbClient.Queryable<SQReservationEvaluate>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new SQReservationEvaluate
|
||||
{
|
||||
id = p.id,
|
||||
reservation_id = p.reservation_id,
|
||||
user_id = p.user_id,
|
||||
role = p.role,
|
||||
play_level = p.play_level,
|
||||
skills_level = p.skills_level,
|
||||
is_arrive = p.is_arrive,
|
||||
created_at = p.created_at,
|
||||
|
||||
}).With(SqlWith.NoLock).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
page = await DbClient.Queryable<SQReservationEvaluate>()
|
||||
.OrderByIF(orderByExpression != null, orderByExpression, orderByType)
|
||||
.WhereIF(predicate != null, predicate).Select(p => new SQReservationEvaluate
|
||||
{
|
||||
id = p.id,
|
||||
reservation_id = p.reservation_id,
|
||||
user_id = p.user_id,
|
||||
role = p.role,
|
||||
play_level = p.play_level,
|
||||
skills_level = p.skills_level,
|
||||
is_arrive = p.is_arrive,
|
||||
created_at = p.created_at,
|
||||
|
||||
}).ToPageListAsync(pageIndex, pageSize, totalCount);
|
||||
}
|
||||
var list = new PageList<SQReservationEvaluate>(page, pageIndex, pageSize, totalCount);
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
137
CoreCms.Net.Services/SQ/SQReservationEvaluateServices.cs
Normal file
137
CoreCms.Net.Services/SQ/SQReservationEvaluateServices.cs
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2025/9/12 16:38:57
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.IRepository;
|
||||
using CoreCms.Net.IRepository.UnitOfWork;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.ViewModels.Basics;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using SqlSugar;
|
||||
|
||||
|
||||
namespace CoreCms.Net.Services
|
||||
{
|
||||
/// <summary>
|
||||
/// 对局评价表 接口实现
|
||||
/// </summary>
|
||||
public class SQReservationEvaluateServices : BaseServices<SQReservationEvaluate>, ISQReservationEvaluateServices
|
||||
{
|
||||
private readonly ISQReservationEvaluateRepository _dal;
|
||||
private readonly IUnitOfWork _unitOfWork;
|
||||
|
||||
public SQReservationEvaluateServices(IUnitOfWork unitOfWork, ISQReservationEvaluateRepository dal)
|
||||
{
|
||||
this._dal = dal;
|
||||
base.BaseDal = dal;
|
||||
_unitOfWork = unitOfWork;
|
||||
}
|
||||
|
||||
#region 实现重写增删改查操作==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步插入方法
|
||||
/// </summary>
|
||||
/// <param name="entity">实体数据</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> InsertAsync(SQReservationEvaluate entity)
|
||||
{
|
||||
return await _dal.InsertAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(SQReservationEvaluate entity)
|
||||
{
|
||||
return await _dal.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写异步更新方法方法
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> UpdateAsync(List<SQReservationEvaluate> entity)
|
||||
{
|
||||
return await _dal.UpdateAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID的数据
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdAsync(object id)
|
||||
{
|
||||
return await _dal.DeleteByIdAsync(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重写删除指定ID集合的数据(批量删除)
|
||||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public new async Task<AdminUiCallBack> DeleteByIdsAsync(int[] ids)
|
||||
{
|
||||
return await _dal.DeleteByIdsAsync(ids);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取缓存的所有数据==========================================================
|
||||
|
||||
/// <summary>
|
||||
/// 获取缓存的所有数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SQReservationEvaluate>> GetCaChe()
|
||||
{
|
||||
return await _dal.GetCaChe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新cache
|
||||
/// </summary>
|
||||
public async Task<List<SQReservationEvaluate>> UpdateCaChe()
|
||||
{
|
||||
return await _dal.UpdateCaChe();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 重写根据条件查询分页数据
|
||||
/// <summary>
|
||||
/// 重写根据条件查询分页数据
|
||||
/// </summary>
|
||||
/// <param name="predicate">判断集合</param>
|
||||
/// <param name="orderByType">排序方式</param>
|
||||
/// <param name="pageIndex">当前页面索引</param>
|
||||
/// <param name="pageSize">分布大小</param>
|
||||
/// <param name="orderByExpression"></param>
|
||||
/// <param name="blUseNoLock">是否使用WITH(NOLOCK)</param>
|
||||
/// <returns></returns>
|
||||
public new async Task<IPageList<SQReservationEvaluate>> QueryPageAsync(Expression<Func<SQReservationEvaluate, bool>> predicate,
|
||||
Expression<Func<SQReservationEvaluate, object>> orderByExpression, OrderByType orderByType, int pageIndex = 1,
|
||||
int pageSize = 20, bool blUseNoLock = false)
|
||||
{
|
||||
return await _dal.QueryPageAsync(predicate, orderByExpression, orderByType, pageIndex, pageSize, blUseNoLock);
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,646 @@
|
|||
/***********************************************************************
|
||||
* Project: CoreCms
|
||||
* ProjectName: 核心内容管理系统
|
||||
* Web: https://www.corecms.net
|
||||
* Author: 大灰灰
|
||||
* Email: jianweie@163.com
|
||||
* CreateTime: 2025/9/12 16:38:57
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Model.Entities;
|
||||
using CoreCms.Net.Model.Entities.Expression;
|
||||
using CoreCms.Net.Model.FromBody;
|
||||
using CoreCms.Net.Model.ViewModels.UI;
|
||||
using CoreCms.Net.Filter;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.IServices;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.HSSF.UserModel;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Web.Admin.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// 对局评价表
|
||||
///</summary>
|
||||
[Description("对局评价表")]
|
||||
[Route("api/[controller]/[action]")]
|
||||
[ApiController]
|
||||
[RequiredErrorForAdmin]
|
||||
[Authorize]
|
||||
public class SQReservationEvaluateController : ControllerBase
|
||||
{
|
||||
private readonly IWebHostEnvironment _webHostEnvironment;
|
||||
private readonly ISQReservationEvaluateServices _SQReservationEvaluateServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
public SQReservationEvaluateController(IWebHostEnvironment webHostEnvironment
|
||||
,ISQReservationEvaluateServices SQReservationEvaluateServices
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
_SQReservationEvaluateServices = SQReservationEvaluateServices;
|
||||
}
|
||||
|
||||
#region 获取列表============================================================
|
||||
// POST: Api/SQReservationEvaluate/GetPageList
|
||||
/// <summary>
|
||||
/// 获取列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("获取列表")]
|
||||
public async Task<AdminUiCallBack> GetPageList()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
var pageCurrent = Request.Form["page"].FirstOrDefault().ObjectToInt(1);
|
||||
var pageSize = Request.Form["limit"].FirstOrDefault().ObjectToInt(30);
|
||||
var where = PredicateBuilder.True<SQReservationEvaluate>();
|
||||
//获取排序字段
|
||||
var orderField = Request.Form["orderField"].FirstOrDefault();
|
||||
|
||||
Expression<Func<SQReservationEvaluate, object>> orderEx = orderField switch
|
||||
{
|
||||
"id" => p => p.id,"reservation_id" => p => p.reservation_id,"user_id" => p => p.user_id,"role" => p => p.role,"play_level" => p => p.play_level,"skills_level" => p => p.skills_level,"is_arrive" => p => p.is_arrive,"created_at" => p => p.created_at,
|
||||
_ => p => p.id
|
||||
};
|
||||
|
||||
//设置排序方式
|
||||
var orderDirection = Request.Form["orderDirection"].FirstOrDefault();
|
||||
var orderBy = orderDirection switch
|
||||
{
|
||||
"asc" => OrderByType.Asc,
|
||||
"desc" => OrderByType.Desc,
|
||||
_ => OrderByType.Desc
|
||||
};
|
||||
//查询筛选
|
||||
|
||||
//主键 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//对局id int
|
||||
var reservation_id = Request.Form["reservation_id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (reservation_id > 0)
|
||||
{
|
||||
where = where.And(p => p.reservation_id == reservation_id);
|
||||
}
|
||||
//用户id int
|
||||
var user_id = Request.Form["user_id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (user_id > 0)
|
||||
{
|
||||
where = where.And(p => p.user_id == user_id);
|
||||
}
|
||||
//角色 int
|
||||
var role = Request.Form["role"].FirstOrDefault().ObjectToInt(0);
|
||||
if (role > 0)
|
||||
{
|
||||
where = where.And(p => p.role == role);
|
||||
}
|
||||
//牌品等级 decimal
|
||||
var play_level = Request.Form["play_level"].FirstOrDefault().ObjectToDecimal(0);
|
||||
if (play_level > 0)
|
||||
{
|
||||
where = where.And(p => p.play_level == play_level);
|
||||
}
|
||||
//牌技等级 decimal
|
||||
var skills_level = Request.Form["skills_level"].FirstOrDefault().ObjectToDecimal(0);
|
||||
if (skills_level > 0)
|
||||
{
|
||||
where = where.And(p => p.skills_level == skills_level);
|
||||
}
|
||||
//是否赴约 int
|
||||
var is_arrive = Request.Form["is_arrive"].FirstOrDefault().ObjectToInt(0);
|
||||
if (is_arrive > 0)
|
||||
{
|
||||
where = where.And(p => p.is_arrive == is_arrive);
|
||||
}
|
||||
//评价时间 datetime
|
||||
var created_at = Request.Form["created_at"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(created_at))
|
||||
{
|
||||
if (created_at.Contains("到"))
|
||||
{
|
||||
var dts = created_at.Split("到");
|
||||
var dtStart = dts[0].Trim().ObjectToDate();
|
||||
where = where.And(p => p.created_at > dtStart);
|
||||
var dtEnd = dts[1].Trim().ObjectToDate();
|
||||
where = where.And(p => p.created_at < dtEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
var dt = created_at.ObjectToDate();
|
||||
where = where.And(p => p.created_at > dt);
|
||||
}
|
||||
}
|
||||
//获取数据
|
||||
var list = await _SQReservationEvaluateServices.QueryPageAsync(where, orderEx, orderBy, pageCurrent, pageSize, true);
|
||||
//返回数据
|
||||
jm.data = list;
|
||||
jm.code = 0;
|
||||
jm.count = list.TotalCount;
|
||||
jm.msg = "数据调用成功!";
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 首页数据============================================================
|
||||
// POST: Api/SQReservationEvaluate/GetIndex
|
||||
/// <summary>
|
||||
/// 首页数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("首页数据")]
|
||||
public AdminUiCallBack GetIndex()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建数据============================================================
|
||||
// POST: Api/SQReservationEvaluate/GetCreate
|
||||
/// <summary>
|
||||
/// 创建数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建数据")]
|
||||
public AdminUiCallBack GetCreate()
|
||||
{
|
||||
//返回数据
|
||||
var jm = new AdminUiCallBack { code = 0 };
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 创建提交============================================================
|
||||
// POST: Api/SQReservationEvaluate/DoCreate
|
||||
/// <summary>
|
||||
/// 创建提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("创建提交")]
|
||||
public async Task<AdminUiCallBack> DoCreate([FromBody]SQReservationEvaluate entity)
|
||||
{
|
||||
var jm = await _SQReservationEvaluateServices.InsertAsync(entity);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑数据============================================================
|
||||
// POST: Api/SQReservationEvaluate/GetEdit
|
||||
/// <summary>
|
||||
/// 编辑数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑数据")]
|
||||
public async Task<AdminUiCallBack> GetEdit([FromBody]FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _SQReservationEvaluateServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
jm.data = model;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 编辑提交============================================================
|
||||
// POST: Api/SQReservationEvaluate/Edit
|
||||
/// <summary>
|
||||
/// 编辑提交
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("编辑提交")]
|
||||
public async Task<AdminUiCallBack> DoEdit([FromBody]SQReservationEvaluate entity)
|
||||
{
|
||||
var jm = await _SQReservationEvaluateServices.UpdateAsync(entity);
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除数据============================================================
|
||||
// POST: Api/SQReservationEvaluate/DoDelete/10
|
||||
/// <summary>
|
||||
/// 单选删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("单选删除")]
|
||||
public async Task<AdminUiCallBack> DoDelete([FromBody]FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _SQReservationEvaluateServices.ExistsAsync(p => p.id == entity.id, true);
|
||||
if (!model)
|
||||
{
|
||||
jm.msg = GlobalConstVars.DataisNo;
|
||||
return jm;
|
||||
}
|
||||
jm = await _SQReservationEvaluateServices.DeleteByIdAsync(entity.id);
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 批量删除============================================================
|
||||
// POST: Api/SQReservationEvaluate/DoBatchDelete/10,11,20
|
||||
/// <summary>
|
||||
/// 批量删除
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("批量删除")]
|
||||
public async Task<AdminUiCallBack> DoBatchDelete([FromBody]FMArrayIntIds entity)
|
||||
{
|
||||
var jm = await _SQReservationEvaluateServices.DeleteByIdsAsync(entity.id);
|
||||
return jm;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 预览数据============================================================
|
||||
// POST: Api/SQReservationEvaluate/GetDetails/10
|
||||
/// <summary>
|
||||
/// 预览数据
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("预览数据")]
|
||||
public async Task<AdminUiCallBack> GetDetails([FromBody]FMIntId entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var model = await _SQReservationEvaluateServices.QueryByIdAsync(entity.id, false);
|
||||
if (model == null)
|
||||
{
|
||||
jm.msg = "不存在此信息";
|
||||
return jm;
|
||||
}
|
||||
jm.code = 0;
|
||||
jm.data = model;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 选择导出============================================================
|
||||
// POST: Api/SQReservationEvaluate/SelectExportExcel/10
|
||||
/// <summary>
|
||||
/// 选择导出
|
||||
/// </summary>
|
||||
/// <param name="entity"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("选择导出")]
|
||||
public async Task<AdminUiCallBack> SelectExportExcel([FromBody]FMArrayIntIds entity)
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
//创建Excel文件的对象
|
||||
var book = new HSSFWorkbook();
|
||||
//添加一个sheet
|
||||
var mySheet = book.CreateSheet("Sheet1");
|
||||
//获取list数据
|
||||
var listModel = await _SQReservationEvaluateServices.QueryListByClauseAsync(p => entity.id.Contains(p.id), p => p.id, OrderByType.Asc, true);
|
||||
//给sheet1添加第一行的头部标题
|
||||
var headerRow = mySheet.CreateRow(0);
|
||||
var headerStyle = ExcelHelper.GetHeaderStyle(book);
|
||||
|
||||
var cell0 = headerRow.CreateCell(0);
|
||||
cell0.SetCellValue("主键");
|
||||
cell0.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(0, 10 * 256);
|
||||
|
||||
var cell1 = headerRow.CreateCell(1);
|
||||
cell1.SetCellValue("对局id");
|
||||
cell1.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(1, 10 * 256);
|
||||
|
||||
var cell2 = headerRow.CreateCell(2);
|
||||
cell2.SetCellValue("用户id");
|
||||
cell2.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(2, 10 * 256);
|
||||
|
||||
var cell3 = headerRow.CreateCell(3);
|
||||
cell3.SetCellValue("角色");
|
||||
cell3.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(3, 10 * 256);
|
||||
|
||||
var cell4 = headerRow.CreateCell(4);
|
||||
cell4.SetCellValue("牌品等级");
|
||||
cell4.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(4, 10 * 256);
|
||||
|
||||
var cell5 = headerRow.CreateCell(5);
|
||||
cell5.SetCellValue("牌技等级");
|
||||
cell5.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(5, 10 * 256);
|
||||
|
||||
var cell6 = headerRow.CreateCell(6);
|
||||
cell6.SetCellValue("是否赴约");
|
||||
cell6.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(6, 10 * 256);
|
||||
|
||||
var cell7 = headerRow.CreateCell(7);
|
||||
cell7.SetCellValue("评价时间");
|
||||
cell7.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(7, 10 * 256);
|
||||
|
||||
headerRow.Height = 30 * 20;
|
||||
var commonCellStyle = ExcelHelper.GetCommonStyle(book);
|
||||
|
||||
//将数据逐步写入sheet1各个行
|
||||
for (var i = 0; i < listModel.Count; i++)
|
||||
{
|
||||
var rowTemp = mySheet.CreateRow(i + 1);
|
||||
|
||||
var rowTemp0 = rowTemp.CreateCell(0);
|
||||
rowTemp0.SetCellValue(listModel[i].id.ToString());
|
||||
rowTemp0.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp1 = rowTemp.CreateCell(1);
|
||||
rowTemp1.SetCellValue(listModel[i].reservation_id.ToString());
|
||||
rowTemp1.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp2 = rowTemp.CreateCell(2);
|
||||
rowTemp2.SetCellValue(listModel[i].user_id.ToString());
|
||||
rowTemp2.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp3 = rowTemp.CreateCell(3);
|
||||
rowTemp3.SetCellValue(listModel[i].role.ToString());
|
||||
rowTemp3.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp4 = rowTemp.CreateCell(4);
|
||||
rowTemp4.SetCellValue(listModel[i].play_level.ToString());
|
||||
rowTemp4.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp5 = rowTemp.CreateCell(5);
|
||||
rowTemp5.SetCellValue(listModel[i].skills_level.ToString());
|
||||
rowTemp5.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp6 = rowTemp.CreateCell(6);
|
||||
rowTemp6.SetCellValue(listModel[i].is_arrive.ToString());
|
||||
rowTemp6.CellStyle = commonCellStyle;
|
||||
|
||||
var rowTemp7 = rowTemp.CreateCell(7);
|
||||
rowTemp7.SetCellValue(listModel[i].created_at.ToString());
|
||||
rowTemp7.CellStyle = commonCellStyle;
|
||||
|
||||
}
|
||||
// 导出excel
|
||||
string webRootPath = _webHostEnvironment.WebRootPath;
|
||||
string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
||||
string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-SQReservationEvaluate导出(选择结果).xls";
|
||||
string filePath = webRootPath + tpath;
|
||||
DirectoryInfo di = new DirectoryInfo(filePath);
|
||||
if (!di.Exists)
|
||||
{
|
||||
di.Create();
|
||||
}
|
||||
FileStream fileHssf = new FileStream(filePath + fileName, FileMode.Create);
|
||||
book.Write(fileHssf);
|
||||
fileHssf.Close();
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = GlobalConstVars.ExcelExportSuccess;
|
||||
jm.data = tpath + fileName;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 查询导出============================================================
|
||||
// POST: Api/SQReservationEvaluate/QueryExportExcel/10
|
||||
/// <summary>
|
||||
/// 查询导出
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Description("查询导出")]
|
||||
public async Task<AdminUiCallBack> QueryExportExcel()
|
||||
{
|
||||
var jm = new AdminUiCallBack();
|
||||
|
||||
var where = PredicateBuilder.True<SQReservationEvaluate>();
|
||||
//查询筛选
|
||||
|
||||
//主键 int
|
||||
var id = Request.Form["id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (id > 0)
|
||||
{
|
||||
where = where.And(p => p.id == id);
|
||||
}
|
||||
//对局id int
|
||||
var reservation_id = Request.Form["reservation_id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (reservation_id > 0)
|
||||
{
|
||||
where = where.And(p => p.reservation_id == reservation_id);
|
||||
}
|
||||
//用户id int
|
||||
var user_id = Request.Form["user_id"].FirstOrDefault().ObjectToInt(0);
|
||||
if (user_id > 0)
|
||||
{
|
||||
where = where.And(p => p.user_id == user_id);
|
||||
}
|
||||
//角色 int
|
||||
var role = Request.Form["role"].FirstOrDefault().ObjectToInt(0);
|
||||
if (role > 0)
|
||||
{
|
||||
where = where.And(p => p.role == role);
|
||||
}
|
||||
//牌品等级 decimal
|
||||
var play_level = Request.Form["play_level"].FirstOrDefault().ObjectToDecimal(0);
|
||||
if (play_level > 0)
|
||||
{
|
||||
where = where.And(p => p.play_level == play_level);
|
||||
}
|
||||
//牌技等级 decimal
|
||||
var skills_level = Request.Form["skills_level"].FirstOrDefault().ObjectToDecimal(0);
|
||||
if (skills_level > 0)
|
||||
{
|
||||
where = where.And(p => p.skills_level == skills_level);
|
||||
}
|
||||
//是否赴约 int
|
||||
var is_arrive = Request.Form["is_arrive"].FirstOrDefault().ObjectToInt(0);
|
||||
if (is_arrive > 0)
|
||||
{
|
||||
where = where.And(p => p.is_arrive == is_arrive);
|
||||
}
|
||||
//评价时间 datetime
|
||||
var created_at = Request.Form["created_at"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(created_at))
|
||||
{
|
||||
var dt = created_at.ObjectToDate();
|
||||
where = where.And(p => p.created_at > dt);
|
||||
}
|
||||
//获取数据
|
||||
//创建Excel文件的对象
|
||||
var book = new HSSFWorkbook();
|
||||
//添加一个sheet
|
||||
var mySheet = book.CreateSheet("Sheet1");
|
||||
//获取list数据
|
||||
var listModel = await _SQReservationEvaluateServices.QueryListByClauseAsync(where, p => p.id, OrderByType.Asc, true);
|
||||
//给sheet1添加第一行的头部标题
|
||||
var headerRow = mySheet.CreateRow(0);
|
||||
var headerStyle = ExcelHelper.GetHeaderStyle(book);
|
||||
|
||||
var cell0 = headerRow.CreateCell(0);
|
||||
cell0.SetCellValue("主键");
|
||||
cell0.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(0, 10 * 256);
|
||||
|
||||
var cell1 = headerRow.CreateCell(1);
|
||||
cell1.SetCellValue("对局id");
|
||||
cell1.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(1, 10 * 256);
|
||||
|
||||
var cell2 = headerRow.CreateCell(2);
|
||||
cell2.SetCellValue("用户id");
|
||||
cell2.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(2, 10 * 256);
|
||||
|
||||
var cell3 = headerRow.CreateCell(3);
|
||||
cell3.SetCellValue("角色");
|
||||
cell3.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(3, 10 * 256);
|
||||
|
||||
var cell4 = headerRow.CreateCell(4);
|
||||
cell4.SetCellValue("牌品等级");
|
||||
cell4.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(4, 10 * 256);
|
||||
|
||||
var cell5 = headerRow.CreateCell(5);
|
||||
cell5.SetCellValue("牌技等级");
|
||||
cell5.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(5, 10 * 256);
|
||||
|
||||
var cell6 = headerRow.CreateCell(6);
|
||||
cell6.SetCellValue("是否赴约");
|
||||
cell6.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(6, 10 * 256);
|
||||
|
||||
var cell7 = headerRow.CreateCell(7);
|
||||
cell7.SetCellValue("评价时间");
|
||||
cell7.CellStyle = headerStyle;
|
||||
mySheet.SetColumnWidth(7, 10 * 256);
|
||||
|
||||
|
||||
headerRow.Height = 30 * 20;
|
||||
var commonCellStyle = ExcelHelper.GetCommonStyle(book);
|
||||
|
||||
//将数据逐步写入sheet1各个行
|
||||
for (var i = 0; i < listModel.Count; i++)
|
||||
{
|
||||
var rowTemp = mySheet.CreateRow(i + 1);
|
||||
|
||||
|
||||
var rowTemp0 = rowTemp.CreateCell(0);
|
||||
rowTemp0.SetCellValue(listModel[i].id.ToString());
|
||||
rowTemp0.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp1 = rowTemp.CreateCell(1);
|
||||
rowTemp1.SetCellValue(listModel[i].reservation_id.ToString());
|
||||
rowTemp1.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp2 = rowTemp.CreateCell(2);
|
||||
rowTemp2.SetCellValue(listModel[i].user_id.ToString());
|
||||
rowTemp2.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp3 = rowTemp.CreateCell(3);
|
||||
rowTemp3.SetCellValue(listModel[i].role.ToString());
|
||||
rowTemp3.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp4 = rowTemp.CreateCell(4);
|
||||
rowTemp4.SetCellValue(listModel[i].play_level.ToString());
|
||||
rowTemp4.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp5 = rowTemp.CreateCell(5);
|
||||
rowTemp5.SetCellValue(listModel[i].skills_level.ToString());
|
||||
rowTemp5.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp6 = rowTemp.CreateCell(6);
|
||||
rowTemp6.SetCellValue(listModel[i].is_arrive.ToString());
|
||||
rowTemp6.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
|
||||
var rowTemp7 = rowTemp.CreateCell(7);
|
||||
rowTemp7.SetCellValue(listModel[i].created_at.ToString());
|
||||
rowTemp7.CellStyle = commonCellStyle;
|
||||
|
||||
|
||||
}
|
||||
// 写入到excel
|
||||
string webRootPath = _webHostEnvironment.WebRootPath;
|
||||
string tpath = "/files/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
|
||||
string fileName = DateTime.Now.ToString("yyyyMMddHHmmssfff") + "-SQReservationEvaluate导出(查询结果).xls";
|
||||
string filePath = webRootPath + tpath;
|
||||
DirectoryInfo di = new DirectoryInfo(filePath);
|
||||
if (!di.Exists)
|
||||
{
|
||||
di.Create();
|
||||
}
|
||||
FileStream fileHssf = new FileStream(filePath + fileName, FileMode.Create);
|
||||
book.Write(fileHssf);
|
||||
fileHssf.Close();
|
||||
|
||||
jm.code = 0;
|
||||
jm.msg = GlobalConstVars.ExcelExportSuccess;
|
||||
jm.data = tpath + fileName;
|
||||
|
||||
return jm;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,91 @@
|
|||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-SQReservationEvaluate-createForm" id="LAY-app-SQReservationEvaluate-createForm">
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="id" class="layui-form-label layui-form-required">主键</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入主键" lay-reqText="请输入主键并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="reservation_id" class="layui-form-label layui-form-required">对局id</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="reservation_id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入对局id" lay-reqText="请输入对局id并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="user_id" class="layui-form-label layui-form-required">用户id</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="user_id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入用户id" lay-reqText="请输入用户id并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="role" class="layui-form-label layui-form-required">角色</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="role" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入角色" lay-reqText="请输入角色并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="play_level" class="layui-form-label layui-form-required">牌品等级</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="play_level" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入牌品等级" lay-reqText="请输入牌品等级" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="skills_level" class="layui-form-label layui-form-required">牌技等级</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="skills_level" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入牌技等级" lay-reqText="请输入牌技等级" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="is_arrive" class="layui-form-label layui-form-required">是否赴约</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="is_arrive" lay-verType="tips" lay-verify="required|number" class="layui-input" value="1" placeholder="请输入是否赴约" lay-reqText="请输入是否赴约并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="created_at" class="layui-form-label layui-form-required">评价时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="created_at" id="createTime-SQReservationEvaluate-created_at" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" placeholder="请输入评价时间" lay-reqText="请输入评价时间" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-SQReservationEvaluate-createForm-submit" id="LAY-app-SQReservationEvaluate-createForm-submit" value="确认添加">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug= layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
laydate.render({
|
||||
elem: '#createTime-SQReservationEvaluate-created_at',
|
||||
type: 'datetime'
|
||||
});
|
||||
form.verify({
|
||||
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-SQReservationEvaluate-createForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,99 @@
|
|||
<script type="text/html" template lay-done="layui.data.done(d);">
|
||||
<table class="layui-table layui-form" lay-filter="LAY-app-SQReservationEvaluate-detailsForm" id="LAY-app-SQReservationEvaluate-detailsForm">
|
||||
<colgroup>
|
||||
<col width="100">
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="id">主键</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="reservation_id">对局id</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.reservation_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="user_id">用户id</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.user_id || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="role">角色</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.role || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="play_level">牌品等级</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.play_level || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="skills_level">牌技等级</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.skills_level || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="is_arrive">是否赴约</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.is_arrive || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<label for="created_at">评价时间</label>
|
||||
</td>
|
||||
<td>
|
||||
{{ d.params.data.created_at || '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</script>
|
||||
<script>
|
||||
var debug= layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
|
||||
layui.use(['admin', 'form', 'coreHelper'], function () {
|
||||
var $ = layui.$
|
||||
, setter = layui.setter
|
||||
, admin = layui.admin
|
||||
, coreHelper = layui.coreHelper
|
||||
, form = layui.form;
|
||||
form.render(null, 'LAY-app-SQReservationEvaluate-detailsForm');
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<script type="text/html" template lay-done="layui.data.sendParams(d);">
|
||||
<div class="layui-form coreshop-form layui-form-pane" lay-filter="LAY-app-SQReservationEvaluate-editForm" id="LAY-app-SQReservationEvaluate-editForm">
|
||||
<input type="hidden" name="id" value="{{d.params.data.id || '' }}" />
|
||||
<div class="layui-form-item">
|
||||
<label for="id" class="layui-form-label layui-form-required">主键</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.id || '' }}" placeholder="请输入主键" lay-reqText="请输入主键并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="reservation_id" class="layui-form-label layui-form-required">对局id</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="reservation_id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.reservation_id || '' }}" placeholder="请输入对局id" lay-reqText="请输入对局id并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="user_id" class="layui-form-label layui-form-required">用户id</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="user_id" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.user_id || '' }}" placeholder="请输入用户id" lay-reqText="请输入用户id并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="role" class="layui-form-label layui-form-required">角色</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="role" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.role || '' }}" placeholder="请输入角色" lay-reqText="请输入角色并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="play_level" class="layui-form-label layui-form-required">牌品等级</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="play_level" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入牌品等级" lay-reqText="请输入牌品等级" value="{{d.params.data.play_level || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="skills_level" class="layui-form-label layui-form-required">牌技等级</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="skills_level" lay-verType="tips" lay-verify="required" class="layui-input" placeholder="请输入牌技等级" lay-reqText="请输入牌技等级" value="{{d.params.data.skills_level || '' }}" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="is_arrive" class="layui-form-label layui-form-required">是否赴约</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="number" min="0" max="999999" name="is_arrive" lay-verType="tips" lay-verify="required|number" class="layui-input" value="{{d.params.data.is_arrive || '' }}" placeholder="请输入是否赴约" lay-reqText="请输入是否赴约并为数字" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label for="created_at" class="layui-form-label layui-form-required">评价时间</label>
|
||||
<div class="layui-input-block">
|
||||
<input name="created_at" id="editTime-SQReservationEvaluate-created_at" type="text" lay-verType="tips" lay-verify="required|datetime" class="layui-input" placeholder="请输入评价时间" lay-reqText="请输入评价时间" value="{{d.params.data.created_at || '' }}"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item text-right core-hidden">
|
||||
<input type="button" class="layui-btn" lay-submit lay-filter="LAY-app-SQReservationEvaluate-editForm-submit" id="LAY-app-SQReservationEvaluate-editForm-submit" value="确认编辑">
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
<script>
|
||||
var debug= layui.setter.debug;
|
||||
layui.data.sendParams = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d.params.data); }
|
||||
layui.use(['admin', 'form', 'laydate', 'upload', 'coreHelper', 'cropperImg'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, form = layui.form
|
||||
, admin = layui.admin
|
||||
, laydate = layui.laydate
|
||||
, upload = layui.upload
|
||||
, cropperImg = layui.cropperImg
|
||||
, coreHelper = layui.coreHelper;
|
||||
|
||||
laydate.render({
|
||||
elem: '#editTime-SQReservationEvaluate-created_at',
|
||||
type: 'datetime'
|
||||
});
|
||||
form.verify({
|
||||
|
||||
});
|
||||
//重载form
|
||||
form.render(null, 'LAY-app-SQReservationEvaluate-editForm');
|
||||
})
|
||||
};
|
||||
</script>
|
||||
|
|
@ -0,0 +1,401 @@
|
|||
<title>对局评价表</title>
|
||||
<!--当前位置开始-->
|
||||
<div class="layui-card layadmin-header">
|
||||
<div class="layui-breadcrumb" lay-filter="breadcrumb">
|
||||
<script type="text/html" template lay-done="layui.data.updateMainBreadcrumb();">
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<!--当前位置结束-->
|
||||
<style>
|
||||
/* 重写样式 */
|
||||
</style>
|
||||
<script type="text/html" template lay-type="Post" lay-url="Api/SQReservationEvaluate/GetIndex" lay-done="layui.data.done(d);">
|
||||
|
||||
</script>
|
||||
<div class="table-body">
|
||||
<table id="LAY-app-SQReservationEvaluate-tableBox" lay-filter="LAY-app-SQReservationEvaluate-tableBox"></table>
|
||||
</div>
|
||||
|
||||
<script type="text/html" id="LAY-app-SQReservationEvaluate-toolbar">
|
||||
<div class="layui-form coreshop-toolbar-search-form">
|
||||
<div class="layui-form-item">
|
||||
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="id">主键</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="id" placeholder="请输入主键" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="reservation_id">对局id</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="reservation_id" placeholder="请输入对局id" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="user_id">用户id</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="user_id" placeholder="请输入用户id" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="role">角色</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="role" placeholder="请输入角色" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="play_level">牌品等级</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="play_level" placeholder="请输入牌品等级" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="skills_level">牌技等级</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="skills_level" placeholder="请输入牌技等级" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="is_arrive">是否赴约</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="is_arrive" placeholder="请输入是否赴约" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label" for="created_at">评价时间</label>
|
||||
<div class="layui-input-inline" style="width: 260px;">
|
||||
<input type="text" name="created_at" id="searchTime-SQReservationEvaluate-created_at" placeholder="请输入评价时间" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="LAY-app-SQReservationEvaluate-search"><i class="layui-icon layui-icon-search"></i>筛选</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-SQReservationEvaluate-pagebar">
|
||||
<div class="layui-btn-container">
|
||||
<button class="layui-btn layui-btn-sm" lay-event="addData"><i class="layui-icon layui-icon-add-1"></i>添加数据</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="batchDelete"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="selectExportExcel"><i class="layui-icon layui-icon-add-circle"></i>选择导出</button>
|
||||
<button class="layui-btn layui-btn-sm" lay-event="queryExportExcel"><i class="layui-icon layui-icon-download-circle"></i>查询导出</button>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="LAY-app-SQReservationEvaluate-tableBox-bar">
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">查看</a>
|
||||
<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
|
||||
<a class="layui-btn layui-btn-danger layui-btn-xs" data-dropdown="#SQReservationEvaluateTbDelDrop{{d.LAY_INDEX}}" no-shade="true">删除</a>
|
||||
<div class="dropdown-menu-nav dropdown-popconfirm dropdown-top-right layui-hide" id="SQReservationEvaluateTbDelDrop{{d.LAY_INDEX}}"
|
||||
style="max-width: 200px;white-space: normal;min-width: auto;margin-left: 10px;">
|
||||
<div class="dropdown-anchor"></div>
|
||||
<div class="dropdown-popconfirm-title">
|
||||
<i class="layui-icon layui-icon-help"></i>
|
||||
确定要删除吗?
|
||||
</div>
|
||||
<div class="dropdown-popconfirm-btn">
|
||||
<a class="layui-btn layui-btn-primary cursor" btn-cancel>取消</a>
|
||||
<a class="layui-btn layui-btn-normal cursor" lay-event="del">确定</a>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
var indexData;
|
||||
var debug= layui.setter.debug;
|
||||
layui.data.done = function (d) {
|
||||
//开启调试情况下获取接口赋值数据
|
||||
if (debug) { console.log(d); }
|
||||
|
||||
indexData = d.data;
|
||||
layui.use(['index', 'table', 'laydate', 'util', 'coredropdown', 'coreHelper'],
|
||||
function () {
|
||||
var $ = layui.$
|
||||
, admin = layui.admin
|
||||
, table = layui.table
|
||||
, form = layui.form
|
||||
, laydate = layui.laydate
|
||||
, setter = layui.setter
|
||||
, coreHelper = layui.coreHelper
|
||||
, util = layui.util
|
||||
, view = layui.view;
|
||||
|
||||
var searchwhere;
|
||||
//监听搜索
|
||||
form.on('submit(LAY-app-SQReservationEvaluate-search)',
|
||||
function(data) {
|
||||
var field = data.field;
|
||||
searchwhere = field;
|
||||
//执行重载
|
||||
table.reloadData('LAY-app-SQReservationEvaluate-tableBox',{ where: field });
|
||||
});
|
||||
//数据绑定
|
||||
table.render({
|
||||
elem: '#LAY-app-SQReservationEvaluate-tableBox',
|
||||
url: layui.setter.apiUrl + 'Api/SQReservationEvaluate/GetPageList',
|
||||
method: 'POST',
|
||||
toolbar: '#LAY-app-SQReservationEvaluate-toolbar',
|
||||
pagebar: '#LAY-app-SQReservationEvaluate-pagebar',
|
||||
className: 'pagebarbox',
|
||||
defaultToolbar: ['filter', 'print', 'exports'],
|
||||
height: 'full-127',//面包屑142px,搜索框4行172,3行137,2行102,1行67
|
||||
page: true,
|
||||
limit: 30,
|
||||
limits: [10, 15, 20, 25, 30, 50, 100, 200],
|
||||
text: {none: '暂无相关数据'},
|
||||
cols: [
|
||||
[
|
||||
{ type: "checkbox", fixed: "left" },
|
||||
{ field: 'id', title: '主键', width: 60, sort: false},
|
||||
{ field: 'reservation_id', title: '对局id', sort: false,width: 105 },
|
||||
{ field: 'user_id', title: '用户id', sort: false,width: 105 },
|
||||
{ field: 'role', title: '角色', sort: false,width: 105 },
|
||||
{ field: 'play_level', title: '牌品等级', sort: false,width: 105 },
|
||||
{ field: 'skills_level', title: '牌技等级', sort: false,width: 105 },
|
||||
{ field: 'is_arrive', title: '是否赴约', sort: false,width: 105 },
|
||||
{ field: 'created_at', title: '评价时间', width: 130, sort: false},
|
||||
{ width: 162, align: 'center', title:'操作', fixed: 'right', toolbar: '#LAY-app-SQReservationEvaluate-tableBox-bar' }
|
||||
]
|
||||
]
|
||||
});
|
||||
//监听排序事件
|
||||
table.on('sort(LAY-app-SQReservationEvaluate-tableBox)', function(obj){
|
||||
table.reloadData('LAY-app-SQReservationEvaluate-tableBox', {
|
||||
initSort: obj, //记录初始排序,如果不设的话,将无法标记表头的排序状态。
|
||||
where: { //请求参数(注意:这里面的参数可任意定义,并非下面固定的格式)
|
||||
orderField: obj.field, //排序字段
|
||||
orderDirection: obj.type //排序方式
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听行双击事件
|
||||
table.on('rowDouble(LAY-app-SQReservationEvaluate-tableBox)', function (obj) {
|
||||
//查看详情
|
||||
doDetails(obj);
|
||||
});
|
||||
//头工具栏事件
|
||||
table.on('pagebar(LAY-app-SQReservationEvaluate-tableBox)', function (obj) {
|
||||
var checkStatus = table.checkStatus(obj.config.id);
|
||||
switch (obj.event) {
|
||||
case 'addData':
|
||||
doCreate();
|
||||
break;
|
||||
case 'batchDelete':
|
||||
doBatchDelete(checkStatus);
|
||||
break;
|
||||
case 'selectExportExcel':
|
||||
doSelectExportExcel(checkStatus);
|
||||
break;
|
||||
case 'queryExportExcel':
|
||||
doQueryExportexcel();
|
||||
break;
|
||||
};
|
||||
});
|
||||
//监听工具条
|
||||
table.on('tool(LAY-app-SQReservationEvaluate-tableBox)',
|
||||
function(obj) {
|
||||
if (obj.event === 'detail') {
|
||||
doDetails(obj);
|
||||
} else if (obj.event === 'del') {
|
||||
doDelete(obj);
|
||||
} else if (obj.event === 'edit') {
|
||||
doEdit(obj)
|
||||
}
|
||||
});
|
||||
//执行创建操作
|
||||
function doCreate(){
|
||||
coreHelper.Post("Api/SQReservationEvaluate/GetCreate", null, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '创建数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-SQReservationEvaluate-create',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('base/SQReservationEvaluate/create', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-SQReservationEvaluate-createForm-submit)',
|
||||
function(data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/SQReservationEvaluate/DoCreate", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-SQReservationEvaluate-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-SQReservationEvaluate-createForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行编辑操作
|
||||
function doEdit(obj){
|
||||
coreHelper.Post("Api/SQReservationEvaluate/GetEdit", {id:obj.data.id}, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '编辑数据',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-SQReservationEvaluate-edit',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('base/SQReservationEvaluate/edit', { data: e.data }).done(function () {
|
||||
//监听提交
|
||||
form.on('submit(LAY-app-SQReservationEvaluate-editForm-submit)',
|
||||
function(data) {
|
||||
var field = data.field; //获取提交的字段
|
||||
|
||||
|
||||
if (debug) { console.log(field); } //开启调试返回数据
|
||||
//提交 Ajax 成功后,关闭当前弹层并重载表格
|
||||
coreHelper.Post("Api/SQReservationEvaluate/DoEdit", field, function (e) {
|
||||
console.log(e)
|
||||
if (e.code === 0) {
|
||||
layui.table.reloadData('LAY-app-SQReservationEvaluate-tableBox'); //重载表格
|
||||
layer.close(index); //再执行关闭
|
||||
layer.msg(e.msg);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
, btn: ['确定', '取消']
|
||||
, yes: function (index, layero) {
|
||||
layero.contents().find("#LAY-app-SQReservationEvaluate-editForm-submit").click();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行预览操作
|
||||
function doDetails(obj) {
|
||||
coreHelper.Post("Api/SQReservationEvaluate/GetDetails", { id: obj.data.id }, function (e) {
|
||||
if (e.code === 0) {
|
||||
admin.popup({
|
||||
shadeClose: false,
|
||||
title: '查看详情',
|
||||
area: ['1200px', '90%'],
|
||||
id: 'LAY-popup-SQReservationEvaluate-details',
|
||||
success: function (layero, index) {
|
||||
view(this.id).render('base/SQReservationEvaluate/details', { data: e.data }).done(function () {
|
||||
form.render();
|
||||
});
|
||||
// 禁止弹窗出现滚动条
|
||||
$(layero).children('.layui-layer-content').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
//执行单个删除
|
||||
function doDelete(obj){
|
||||
coreHelper.Post("Api/SQReservationEvaluate/DoDelete", { id: obj.data.id }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-SQReservationEvaluate-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
}
|
||||
//执行批量删除
|
||||
function doBatchDelete(checkStatus){
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择要删除的数据');
|
||||
}
|
||||
layer.confirm('确定删除吗?删除后将无法恢复。',
|
||||
function(index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function(index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
coreHelper.Post("Api/SQReservationEvaluate/DoBatchDelete", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
table.reloadData('LAY-app-SQReservationEvaluate-tableBox');
|
||||
layer.msg(e.msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
//执行查询条件导出excel
|
||||
function doQueryExportexcel(){
|
||||
layer.confirm('确定根据当前的查询条件导出数据吗?',
|
||||
function(index) {
|
||||
var field = searchwhere;
|
||||
coreHelper.PostForm("Api/SQReservationEvaluate/QueryExportExcel", field, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
//执行选择目录导出数据
|
||||
function doSelectExportExcel(checkStatus){
|
||||
var checkData = checkStatus.data;
|
||||
if (checkData.length === 0) {
|
||||
return layer.msg('请选择您要导出的数据');
|
||||
}
|
||||
layer.confirm('确定导出选择的内容吗?',
|
||||
function(index) {
|
||||
var delidsStr = [];
|
||||
layui.each(checkData,
|
||||
function(index, item) {
|
||||
delidsStr.push(item.id);
|
||||
});
|
||||
layer.close(index);
|
||||
coreHelper.Post("Api/SQReservationEvaluate/SelectExportExcel", { id: delidsStr }, function (e) {
|
||||
if (debug) { console.log(e); } //开启调试返回数据
|
||||
if (e.code === 0) {
|
||||
window.open(e.data);
|
||||
} else {
|
||||
layer.msg(e.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
laydate.render({
|
||||
elem: '#searchTime-SQReservationEvaluate-created_at',
|
||||
type: 'datetime',
|
||||
range: '到',
|
||||
});
|
||||
|
||||
//监听 表格复选框操作
|
||||
|
||||
|
||||
//重载form
|
||||
form.render();
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
@ -26,6 +26,7 @@ using System.Linq;
|
|||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Services.SQ;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using ToolGood.Words.internals;
|
||||
namespace CoreCms.Net.Web.WebApi.Controllers;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -47,6 +48,8 @@ public class SQController : ControllerBase
|
|||
private readonly SqlSugarScope _dbBase;
|
||||
private readonly ICoreCmsUserBlacklistServices _coreCmsUserBlacklistServices;
|
||||
|
||||
private readonly ISQReservationEvaluateServices _sQReservationEvaluateServices;
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
///</summary>
|
||||
|
|
@ -61,6 +64,9 @@ public class SQController : ControllerBase
|
|||
, IHttpContextUser user
|
||||
, IUnitOfWork unitOfWork
|
||||
, ICoreCmsUserBlacklistServices coreCmsUserBlacklistServices
|
||||
,
|
||||
ISQReservationEvaluateServices sQReservationEvaluateServices
|
||||
|
||||
)
|
||||
{
|
||||
_webHostEnvironment = webHostEnvironment;
|
||||
|
|
@ -74,6 +80,7 @@ public class SQController : ControllerBase
|
|||
_user = user;
|
||||
_dbBase = unitOfWork.GetDbClient();
|
||||
_coreCmsUserBlacklistServices = coreCmsUserBlacklistServices;
|
||||
_sQReservationEvaluateServices = sQReservationEvaluateServices;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -161,4 +168,146 @@ public class SQController : ControllerBase
|
|||
};
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取预约评价
|
||||
/// </summary>
|
||||
/// <param name="reId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Authorize]
|
||||
public async Task<WebApiDto> GetEvaluateServices([FromQuery] int reId)
|
||||
{
|
||||
var userId = _user.ID;
|
||||
var list = await _sQReservationEvaluateServices.QueryListByClauseAsync(it => it.reservation_id == reId && it.user_id == userId);
|
||||
var participants = await _dbBase.Ado.SqlQueryAsync<SQReservationParticipantsApiDto>($"select p.id,p.reservation_id,p.status,p.join_time,p.user_id, p.role,u.nickName UserName,u.avatarImage AvatarImage,ISNULL(u.play_level,4) play_level,ISNULL(u.skills_level,4) skills_level from SQReservationParticipants p inner join CoreCmsUser u on p.user_id=u.id where p.status=0 and p.reservation_id ={reId} and p.is_arrive=1 ");
|
||||
if (participants == null)
|
||||
{
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 0,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
List<object> obj = new List<object>();
|
||||
foreach (var item in participants)
|
||||
{
|
||||
if (item.user_id == userId)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var is_evaluate = false;
|
||||
decimal play_level = 0;
|
||||
decimal skills_level = 0;
|
||||
decimal user_play_level = 4;
|
||||
decimal user_skills_level = 4;
|
||||
DateTime? now = null;
|
||||
if (list.Count > 0)
|
||||
{
|
||||
var e = list.Find(it => it.to_user_id == item.user_id);
|
||||
if (e != null)
|
||||
{
|
||||
is_evaluate = true;
|
||||
play_level = e.play_level;
|
||||
skills_level = e.skills_level;
|
||||
now = e.created_at;
|
||||
user_play_level = e.play_level;
|
||||
user_skills_level = e.skills_level;
|
||||
}
|
||||
}
|
||||
var o = new
|
||||
{
|
||||
item.UserName,
|
||||
item.user_id,
|
||||
item.AvatarImage,
|
||||
user_play_level,
|
||||
user_skills_level,
|
||||
is_evaluate,
|
||||
play_level,
|
||||
skills_level,
|
||||
evaluate_at = now
|
||||
};
|
||||
obj.Add(o);
|
||||
}
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 0,
|
||||
Data = obj
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="evaluate"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Authorize]
|
||||
public async Task<WebApiDto> AddEvaluateServices([FromBody] SQReservationEvaluateDto evaluate)
|
||||
{
|
||||
var userId = _user.ID;
|
||||
var reId = evaluate.reservation_id;
|
||||
var list = await _sQReservationEvaluateServices.QueryListByClauseAsync(it => it.reservation_id == reId && it.user_id == userId);
|
||||
var participants = await _dbBase.Ado.SqlQueryAsync<SQReservationParticipantsApiEavDto>($"select p.id,p.reservation_id,p.status,p.join_time,p.user_id, p.role,u.nickName UserName,u.avatarImage AvatarImage,ISNULL(u.play_level,4) play_level,ISNULL(u.skills_level,4) skills_level from SQReservationParticipants p inner join CoreCmsUser u on p.user_id=u.id where p.status=0 and p.reservation_id ={reId} and p.is_arrive=1 ");
|
||||
if (participants == null)
|
||||
{
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 0,
|
||||
Data = null
|
||||
};
|
||||
}
|
||||
List<object> obj = new List<object>();
|
||||
var p = participants.Find(it => it.user_id == evaluate.to_user_id);
|
||||
if (p == null)
|
||||
{
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 500,
|
||||
Data = null,
|
||||
Msg = "未找到对局记录"
|
||||
};
|
||||
}
|
||||
SQReservationEvaluate sQReservationEvaluate = new SQReservationEvaluate()
|
||||
{
|
||||
created_at = DateTime.Now,
|
||||
play_level = evaluate.play_level,
|
||||
reservation_id = evaluate.reservation_id,
|
||||
role = p.role,
|
||||
skills_level = evaluate.skills_level,
|
||||
to_user_id = evaluate.to_user_id,
|
||||
user_id = userId,
|
||||
};
|
||||
await _sQReservationEvaluateServices.InsertAsync(sQReservationEvaluate);
|
||||
var play_level = _dbBase.Ado.SqlQuerySingle<SQReservationEvaluateFDto>($"select ISNULL(sum(play_level),0) level,count(1) rscount from SQReservationEvaluate where to_user_id={evaluate.to_user_id} ");
|
||||
|
||||
var skills_level = _dbBase.Ado.SqlQuerySingle<SQReservationEvaluateFDto>($"select ISNULL(sum(skills_level),0) level,count(1) rscount from SQReservationEvaluate where to_user_id={evaluate.to_user_id} ");
|
||||
//先加4
|
||||
play_level.level += 4;
|
||||
if (play_level.rs_count > 0)
|
||||
{
|
||||
play_level.level = play_level.level / play_level.rs_count;
|
||||
}
|
||||
//先加4
|
||||
skills_level.level += 4;
|
||||
if (skills_level.rs_count > 0)
|
||||
{
|
||||
skills_level.level = skills_level.level / skills_level.rs_count;
|
||||
}
|
||||
if (play_level.rs_count > 0 || skills_level.rs_count > 0)
|
||||
{
|
||||
await _userServices.UpdateAsync(it => new CoreCmsUser
|
||||
{
|
||||
play_level = play_level.level,
|
||||
skills_level = skills_level.level
|
||||
}, it => it.id == evaluate.to_user_id);
|
||||
}
|
||||
return new WebApiDto()
|
||||
{
|
||||
Code = 0,
|
||||
Data = null,
|
||||
Msg = "评价成功"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user