Merge branch 'master' of https://dev.azure.com/luolan/ASG%E7%B3%BB%E7%BB%9F/_git/asg_backend
This commit is contained in:
		
						commit
						4f637defde
					
				@ -14,6 +14,12 @@ using System.Net.NetworkInformation;
 | 
				
			|||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
 | 
					using Microsoft.EntityFrameworkCore.Storage.ValueConversion.Internal;
 | 
				
			||||||
using NPOI.SS.Formula.Functions;
 | 
					using NPOI.SS.Formula.Functions;
 | 
				
			||||||
using Microsoft.EntityFrameworkCore;
 | 
					using Microsoft.EntityFrameworkCore;
 | 
				
			||||||
 | 
					using Flandre.Core.Models;
 | 
				
			||||||
 | 
					using Mirai.Net.Sessions.Http.Managers;
 | 
				
			||||||
 | 
					using Mirai.Net.Utils.Scaffolds;
 | 
				
			||||||
 | 
					using Flandre.Core.Messaging.Segments;
 | 
				
			||||||
 | 
					using Flandre.Core.Messaging;
 | 
				
			||||||
 | 
					using Flandre.Core.Common;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace asg_form.Controllers
 | 
					namespace asg_form.Controllers
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@ -44,6 +50,7 @@ namespace asg_form.Controllers
 | 
				
			|||||||
        public string TaskName { get; set; }
 | 
					        public string TaskName { get; set; }
 | 
				
			||||||
        public string TaskDescription { get; set; }
 | 
					        public string TaskDescription { get; set; }
 | 
				
			||||||
        public long Money { get; set; }
 | 
					        public long Money { get; set; }
 | 
				
			||||||
 | 
					        public string? atuserqq { get; set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    public class AssignmentController : ControllerBase
 | 
					    public class AssignmentController : ControllerBase
 | 
				
			||||||
@ -69,6 +76,9 @@ namespace asg_form.Controllers
 | 
				
			|||||||
            var dateString = DateTime.Now;
 | 
					            var dateString = DateTime.Now;
 | 
				
			||||||
            using (TestDbContext sub = new TestDbContext())
 | 
					            using (TestDbContext sub = new TestDbContext())
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
 | 
					                int wp = -2;
 | 
				
			||||||
 | 
					                try
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
                var task = new TaskDB
 | 
					                var task = new TaskDB
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    chinaname = taskinfo.Chinaname,
 | 
					                    chinaname = taskinfo.Chinaname,
 | 
				
			||||||
@ -85,7 +95,20 @@ namespace asg_form.Controllers
 | 
				
			|||||||
                };
 | 
					                };
 | 
				
			||||||
                sub.T_Task.Add(task);
 | 
					                sub.T_Task.Add(task);
 | 
				
			||||||
                await sub.SaveChangesAsync();
 | 
					                await sub.SaveChangesAsync();
 | 
				
			||||||
                return Ok(new error_mb { code = 200, message = "新建任务成功" });
 | 
					                wp = -1;
 | 
				
			||||||
 | 
					                string msg = $"<ASG机器人通知> 尊敬的 {taskinfo.Chinaname},{taskinfo.CreatePerson}为您下了一个任务,请及时上后台查看!";
 | 
				
			||||||
 | 
					                string qqgroup = "925510646";
 | 
				
			||||||
 | 
					                    wp = 0;
 | 
				
			||||||
 | 
					                    var message = new MessageBuilder().Add(new AtSegment(taskinfo.atuserqq)).Text(msg).Build();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    await runbot.runbotr.SendMessageAsync(MessageEnvironment.Channel, qqgroup, null, message, qqgroup);
 | 
				
			||||||
 | 
					                    return Ok(new error_mb { code = 200, message = "新建任务成功" });
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                catch (Exception ex)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    return Ok(new { code = 500, message = "服务器错误", details = ex ,wp});
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user