mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 16:30:25 +08:00 
			
		
		
		
	
		
			
	
	
		
			31 lines
		
	
	
		
			700 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			31 lines
		
	
	
		
			700 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package router
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								import (
							 | 
						||
| 
								 | 
							
									"mayfly-go/internal/sys/api"
							 | 
						||
| 
								 | 
							
									"mayfly-go/internal/sys/application"
							 | 
						||
| 
								 | 
							
									"mayfly-go/pkg/ctx"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									"github.com/gin-gonic/gin"
							 | 
						||
| 
								 | 
							
								)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func InitSysConfigRouter(router *gin.RouterGroup) {
							 | 
						||
| 
								 | 
							
									r := &api.Config{ConfigApp: application.ConfigApp}
							 | 
						||
| 
								 | 
							
									db := router.Group("sys/configs")
							 | 
						||
| 
								 | 
							
									{
							 | 
						||
| 
								 | 
							
										db.GET("", func(c *gin.Context) {
							 | 
						||
| 
								 | 
							
											ctx.NewReqCtxWithGin(c).Handle(r.Configs)
							 | 
						||
| 
								 | 
							
										})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										db.GET("/value", func(c *gin.Context) {
							 | 
						||
| 
								 | 
							
											ctx.NewReqCtxWithGin(c).WithNeedToken(false).Handle(r.GetConfigValueByKey)
							 | 
						||
| 
								 | 
							
										})
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
										saveConfig := ctx.NewLogInfo("保存系统配置信息").WithSave(true)
							 | 
						||
| 
								 | 
							
										db.POST("", func(c *gin.Context) {
							 | 
						||
| 
								 | 
							
											ctx.NewReqCtxWithGin(c).
							 | 
						||
| 
								 | 
							
												WithLog(saveConfig).
							 | 
						||
| 
								 | 
							
												Handle(r.SaveConfig)
							 | 
						||
| 
								 | 
							
										})
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |