Commit 3970e648 authored by 罗超's avatar 罗超

测试

parent 52da1db0
using System;
using System.Collections.Generic;
using System.Text;
using VT.FW.DB;
namespace Edu.Model.Entity.Course
{
/// <summary>
/// 未知的用户信息
/// </summary>
[Serializable]
[DB(ConnectionName = "DefaultConnection")]
public class RB_Class_Time_UnKnowUser
{
/// <summary>
/// 编号
/// </summary>
public int Id { get; set; }
/// <summary>
/// 上课计划ID
/// </summary>
public int ClassTimeId { get; set; }
/// <summary>
/// 用户头像
/// </summary>
public string UserAvatar { get; set; }
/// <summary>
/// 发生的FaceID
/// </summary>
public int FaceId { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateDate { get; set; }
/// <summary>
/// 创建人
/// </summary>
public int CreateBy { get; set; }
}
}
using Edu.Model.Entity.Course;
using System;
using System.Collections.Generic;
using System.Text;
namespace Edu.Model.ViewModel.Course
{
public class RB_Class_Time_UnKnowUser_ViewModel:RB_Class_Time_UnKnowUser
{
/// <summary>
/// 创建时间字符串
/// </summary>
public string CreateTimeStr { get { return Common.ConvertHelper.FormatTime(this.CreateDate); } }
/// <summary>
/// 创建人
/// </summary>
public string CreateByName { get; set; }
}
}
...@@ -105,6 +105,11 @@ namespace Edu.Module.Course ...@@ -105,6 +105,11 @@ namespace Edu.Module.Course
/// </summary> /// </summary>
private readonly RB_Class_ConfigRepository class_ConfigRepository = new RB_Class_ConfigRepository(); private readonly RB_Class_ConfigRepository class_ConfigRepository = new RB_Class_ConfigRepository();
/// <summary>
/// 非法用户信息
/// </summary>
private readonly RB_Class_Time_UnKnowRepository unKnowRepository = new RB_Class_Time_UnKnowRepository();
#region 课程管理 #region 课程管理
public List<RB_Course_ViewModel> GetAllCourseChapterCountModule(int groupId,int courseId) public List<RB_Course_ViewModel> GetAllCourseChapterCountModule(int groupId,int courseId)
...@@ -1493,5 +1498,46 @@ namespace Edu.Module.Course ...@@ -1493,5 +1498,46 @@ namespace Edu.Module.Course
} }
#endregion #endregion
#region 非法访问用户
/// <summary>
/// 保存非法访问用信息
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetUnKnownUserModule(RB_Class_Time_UnKnowUser_ViewModel model)
{
bool flag;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Class_Time_UnKnowUser_ViewModel.ClassTimeId) ,model.ClassTimeId},
{nameof(RB_Class_Time_UnKnowUser_ViewModel.UserAvatar) ,model.UserAvatar}
};
flag = chapterRepository.Update(fileds, new WhereHelper(nameof(RB_Class_Time_UnKnowUser_ViewModel.Id), model.Id));
}
else
{
var newId = unKnowRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
/// <summary>
/// 查询指定课程的非法访问用户数据
/// </summary>
/// <returns></returns>
public List<RB_Class_Time_UnKnowUser_ViewModel> GetUnKnowUserByClassTimeModule(int classId)
{
var list = unKnowRepository.GetUnKnowUsersByClassIdRepository(classId);
return list;
}
#endregion
} }
} }
\ No newline at end of file
using Edu.Model.Entity.Course;
using Edu.Model.ViewModel.Course;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Edu.Repository.Course
{
public class RB_Class_Time_UnKnowRepository : BaseRepository<RB_Class_Time_UnKnowUser>
{
/// <summary>
/// 跟进课时编号查询非法用户
/// </summary>
/// <param name="classId"></param>
/// <returns></returns>
public List<RB_Class_Time_UnKnowUser_ViewModel> GetUnKnowUsersByClassIdRepository(int classId)
{
StringBuilder sql = new StringBuilder();
sql.Append("select * from RB_Class_Time_UnKnowUser where ");
sql.AppendFormat("{0}={1}",nameof(RB_Class_Time_UnKnowUser_ViewModel.ClassTimeId),classId);
return Get<RB_Class_Time_UnKnowUser_ViewModel>(sql.ToString()).ToList();
}
}
}
...@@ -1131,5 +1131,48 @@ namespace Edu.WebApi.Controllers.Course ...@@ -1131,5 +1131,48 @@ namespace Edu.WebApi.Controllers.Course
return flag ? ApiResult.Success() : ApiResult.Failed(); return flag ? ApiResult.Success() : ApiResult.Failed();
} }
#endregion #endregion
#region 非法用户管理
/// <summary>
/// 保存非法用户信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ApiResult SetUnKnowUser()
{
RB_Class_Time_UnKnowUser_ViewModel model = JsonHelper.DeserializeObject<RB_Class_Time_UnKnowUser_ViewModel>(RequestParm.Msg.ToString());
model.CreateBy = base.UserInfo.Id;
model.CreateDate = DateTime.Now;
var flag = courseModule.SetUnKnownUserModule(model);
if (flag)
{
return ApiResult.Success();
}
else
{
return ApiResult.Failed();
}
}
/// <summary>
/// 跟进课程编号查询非法用户
/// </summary>
/// <returns></returns>
public ApiResult GetUnKnowUserByClassId()
{
int classId = ParmJObj.GetInt("classId",0);
var list = courseModule.GetUnKnowUserByClassTimeModule(classId);
var result = list.Select(x => new {
x.Id,
x.UserAvatar,
x.CreateTimeStr,
x.FaceId
});
return ApiResult.Success(data:result);
}
#endregion
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment