isRuleChange
This commit is contained in:
		
							parent
							
								
									3a94e926c7
								
							
						
					
					
						commit
						c2908c982b
					
				@ -74,7 +74,7 @@ namespace asg_form.Controllers
 | 
				
			|||||||
        [Authorize]
 | 
					        [Authorize]
 | 
				
			||||||
        [Route("api/v1/admin/Events")]
 | 
					        [Route("api/v1/admin/Events")]
 | 
				
			||||||
        [HttpPut]
 | 
					        [HttpPut]
 | 
				
			||||||
        public async Task<ActionResult<List<T_events>>> putevent(int eventId, [FromBody] T_events_debug events)
 | 
					        public async Task<ActionResult<List<T_events>>> putevent(int eventId, string isRuleChange="0", [FromBody] T_events_debug events)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
 | 
					            if (this.User.FindAll(ClaimTypes.Role).Any(a => a.Value == "admin"))
 | 
				
			||||||
@ -90,6 +90,8 @@ namespace asg_form.Controllers
 | 
				
			|||||||
                eve.status = events.status;
 | 
					                eve.status = events.status;
 | 
				
			||||||
                eve.config = events.config;
 | 
					                eve.config = events.config;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                if (isRuleChange == "1")
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
                    if (!string.IsNullOrEmpty(events.rule_markdown))
 | 
					                    if (!string.IsNullOrEmpty(events.rule_markdown))
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "doc", "rule", $"{eve.name}.md");
 | 
					                        var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "doc", "rule", $"{eve.name}.md");
 | 
				
			||||||
@ -120,6 +122,7 @@ namespace asg_form.Controllers
 | 
				
			|||||||
                    await testDb.SaveChangesAsync();
 | 
					                    await testDb.SaveChangesAsync();
 | 
				
			||||||
                    return Ok(eve);
 | 
					                    return Ok(eve);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            return Ok(new error_mb { code = 401, message = "无权访问" });
 | 
					            return Ok(new error_mb { code = 401, message = "无权访问" });
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user