1
This commit is contained in:
parent
af59007db1
commit
bed62d31e8
@ -21,6 +21,8 @@ namespace asg_form.Controllers
|
|||||||
{
|
{
|
||||||
public long id { get; set; }
|
public long id { get; set; }
|
||||||
public string chinaname { get; set; }
|
public string chinaname { get; set; }
|
||||||
|
public string createPerson { get; set; }
|
||||||
|
public string createUserid { get; set; }
|
||||||
public long userId { get; set; }
|
public long userId { get; set; }
|
||||||
public string taskName { get; set; }
|
public string taskName { get; set; }
|
||||||
public string taskDescription { get; set; }
|
public string taskDescription { get; set; }
|
||||||
@ -34,6 +36,8 @@ namespace asg_form.Controllers
|
|||||||
public class TaskCreate
|
public class TaskCreate
|
||||||
{
|
{
|
||||||
public string Chinaname { get; set; }
|
public string Chinaname { get; set; }
|
||||||
|
public string CreatePerson { get; set; }
|
||||||
|
public string CreateUserid { get; set; }
|
||||||
public long UserId { get; set; }
|
public long UserId { get; set; }
|
||||||
public string TaskName { get; set; }
|
public string TaskName { get; set; }
|
||||||
public string TaskDescription { get; set; }
|
public string TaskDescription { get; set; }
|
||||||
@ -66,6 +70,8 @@ namespace asg_form.Controllers
|
|||||||
var task = new TaskDB
|
var task = new TaskDB
|
||||||
{
|
{
|
||||||
chinaname = taskinfo.Chinaname,
|
chinaname = taskinfo.Chinaname,
|
||||||
|
createPerson = taskinfo.CreatePerson,
|
||||||
|
createUserid = taskinfo.CreateUserid,
|
||||||
userId = taskinfo.UserId,
|
userId = taskinfo.UserId,
|
||||||
taskName = taskinfo.TaskName,
|
taskName = taskinfo.TaskName,
|
||||||
taskDescription = taskinfo.TaskDescription,
|
taskDescription = taskinfo.TaskDescription,
|
||||||
@ -150,7 +156,15 @@ namespace asg_form.Controllers
|
|||||||
task.lastOperateTime = dateString.ToString();
|
task.lastOperateTime = dateString.ToString();
|
||||||
await userManager.UpdateAsync(user);
|
await userManager.UpdateAsync(user);
|
||||||
await sub.SaveChangesAsync();
|
await sub.SaveChangesAsync();
|
||||||
return Ok(new error_mb { code = 200, message = "成功修改" });
|
var result = new
|
||||||
|
{
|
||||||
|
approvalPerson = user.chinaname,
|
||||||
|
status = task.status,
|
||||||
|
taskid = msg.taskid,
|
||||||
|
code = 200,
|
||||||
|
message = "成功修改"
|
||||||
|
};
|
||||||
|
return Ok(result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,20 +231,6 @@ namespace asg_form.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("api/v1/Find_nbadmin")]
|
|
||||||
[HttpGet]
|
|
||||||
[Authorize]
|
|
||||||
public async Task<ActionResult<List<User>>> Find_nbadmin()
|
|
||||||
{
|
|
||||||
using (TestDbContext fd = new TestDbContext())
|
|
||||||
{
|
|
||||||
var usersWithNbadminRole = this.User.FindAll(ClaimTypes.Role)
|
|
||||||
.Where(a => a.Value == "nbadmin")
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return Ok(usersWithNbadminRole);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Identity;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace asg_form.Controllers
|
namespace asg_form.Controllers
|
||||||
{
|
{
|
||||||
@ -27,18 +28,19 @@ namespace asg_form.Controllers
|
|||||||
public async Task<ActionResult<string>> getschedle_c([FromBody]req_com_form req)
|
public async Task<ActionResult<string>> getschedle_c([FromBody]req_com_form req)
|
||||||
{
|
{
|
||||||
int id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value.ToInt32();
|
int id = this.User.FindFirst(ClaimTypes.NameIdentifier)!.Value.ToInt32();
|
||||||
// var user = await userManager.Users.FirstAsync(a=>a.Id==id);
|
// var user = await userManager.Users.FirstAsync(a=>a.Id==id);
|
||||||
|
var dateString = DateTime.Now;
|
||||||
TestDbContext testDb = new TestDbContext();
|
TestDbContext testDb = new TestDbContext();
|
||||||
var result = new com_form
|
var result = new com_form
|
||||||
{
|
{
|
||||||
Com_Email = req.Com_Email,
|
comSex = req.sex,
|
||||||
Com_Cocial_media = req.Com_Cocial_media,
|
Com_Cocial_media = req.Com_Cocial_media,
|
||||||
Com_qq = req.Com_qq,
|
Com_qq = req.Com_qq,
|
||||||
UserId=id,
|
UserId=id,
|
||||||
Status = 0,
|
Status = 0,
|
||||||
introduction = req.introduction,
|
introduction = req.introduction,
|
||||||
idv_id=req.idv_id
|
idv_id=req.idv_id,
|
||||||
|
createTime = dateString.ToString(),
|
||||||
};
|
};
|
||||||
|
|
||||||
testDb.com_Forms.Add(result);
|
testDb.com_Forms.Add(result);
|
||||||
@ -48,23 +50,32 @@ namespace asg_form.Controllers
|
|||||||
[Route("api/v1/admin/comform")]
|
[Route("api/v1/admin/comform")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public async Task<ActionResult<string>> getschedle_c(short page, short page_long = 10)
|
public async Task<ActionResult<string>> getschedle_c(short page, short limit)
|
||||||
{
|
{
|
||||||
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
|
||||||
{
|
{
|
||||||
int a = userManager.Users.Count();
|
using (TestDbContext sub = new TestDbContext())
|
||||||
int b = page_long * page;
|
|
||||||
if (page_long * page > a)
|
|
||||||
{
|
{
|
||||||
b = a;
|
var query = sub.com_Forms.AsQueryable();
|
||||||
|
|
||||||
|
var TotalRecords = await query.CountAsync();
|
||||||
|
|
||||||
|
var signData = await query
|
||||||
|
.OrderByDescending(a => a.Status)
|
||||||
|
.Skip((page - 1) * limit)
|
||||||
|
.Take(limit)
|
||||||
|
.ToListAsync();
|
||||||
|
|
||||||
|
var result = new
|
||||||
|
{
|
||||||
|
rows = signData,
|
||||||
|
total = TotalRecords,
|
||||||
|
};
|
||||||
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
TestDbContext testDb = new TestDbContext();
|
|
||||||
|
|
||||||
var comform = testDb.com_Forms.Skip(page_long * page - page_long).Take(page_long).Select(a => new {a.Id,a.idv_id,a.Status,a.introduction,a.Com_Cocial_media,a.Com_Email,a.Com_qq,a.UserId}).ToList();
|
|
||||||
return Newtonsoft.Json.JsonConvert.SerializeObject(comform);
|
|
||||||
}
|
}
|
||||||
return BadRequest(new error_mb { code = 400, message = "没有管理员,无法获取" });
|
return Ok(new error_mb { code = 400, message = "没有管理员,无法获取" });
|
||||||
}
|
}
|
||||||
[Route("api/v1/admin/user")]
|
[Route("api/v1/admin/user")]
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -183,7 +194,7 @@ namespace asg_form.Controllers
|
|||||||
public class req_com_form
|
public class req_com_form
|
||||||
{
|
{
|
||||||
|
|
||||||
public string Com_Email { get; set; }
|
public string sex { get; set; }
|
||||||
public string? Com_Cocial_media { get; set; }
|
public string? Com_Cocial_media { get; set; }
|
||||||
public string idv_id { get; set; }
|
public string idv_id { get; set; }
|
||||||
public string introduction { get; set; }
|
public string introduction { get; set; }
|
||||||
@ -194,13 +205,14 @@ namespace asg_form.Controllers
|
|||||||
{
|
{
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public string Com_Email { get; set; }
|
public string comSex { get; set; }
|
||||||
public string? Com_Cocial_media { get; set; }
|
public string? Com_Cocial_media { get; set; }
|
||||||
public string idv_id { get; set; }
|
public string idv_id { get; set; }
|
||||||
public string introduction { get; set; }
|
public string introduction { get; set; }
|
||||||
public string Com_qq { get; set; }
|
public string Com_qq { get; set; }
|
||||||
public int Status { get; set; }
|
public int Status { get; set; }
|
||||||
|
|
||||||
|
public string createTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user