mirror of
				https://gitee.com/dromara/mayfly-go
				synced 2025-11-04 00:10:25 +08:00 
			
		
		
		
	feat: redis支持flushdb、菜单资源支持拖拽排序、禁用等
This commit is contained in:
		@@ -2,6 +2,7 @@ package api
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"mayfly-go/internal/sys/api/form"
 | 
			
		||||
	"mayfly-go/internal/sys/api/vo"
 | 
			
		||||
	"mayfly-go/internal/sys/application"
 | 
			
		||||
@@ -46,8 +47,20 @@ func (r *Resource) DelResource(rc *req.Ctx) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Resource) ChangeStatus(rc *req.Ctx) {
 | 
			
		||||
	re := &entity.Resource{}
 | 
			
		||||
	re.Id = uint64(ginx.PathParamInt(rc.GinCtx, "id"))
 | 
			
		||||
	re.Status = int8(ginx.PathParamInt(rc.GinCtx, "status"))
 | 
			
		||||
	r.ResourceApp.Save(re)
 | 
			
		||||
	rid := uint64(ginx.PathParamInt(rc.GinCtx, "id"))
 | 
			
		||||
	status := int8(ginx.PathParamInt(rc.GinCtx, "status"))
 | 
			
		||||
	rc.ReqParam = fmt.Sprintf("id = %d, status = %d", rid, status)
 | 
			
		||||
	r.ResourceApp.ChangeStatus(rid, status)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (r *Resource) Sort(rc *req.Ctx) {
 | 
			
		||||
	var rs []form.ResourceForm
 | 
			
		||||
	rc.GinCtx.ShouldBindJSON(&rs)
 | 
			
		||||
	rc.ReqParam = rs
 | 
			
		||||
 | 
			
		||||
	for _, v := range rs {
 | 
			
		||||
		sortE := &entity.Resource{Pid: v.Pid, Weight: v.Weight}
 | 
			
		||||
		sortE.Id = uint64(v.Id)
 | 
			
		||||
		r.ResourceApp.Sort(sortE)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,6 +53,7 @@ type ResourceManageVO struct {
 | 
			
		||||
	Name       string     `json:"name"`
 | 
			
		||||
	Type       int        `json:"type"`
 | 
			
		||||
	Status     int        `json:"status"`
 | 
			
		||||
	Weight     int        `json:"weight"`
 | 
			
		||||
	Creator    string     `json:"creator"`
 | 
			
		||||
	CreateTime *time.Time `json:"createTime"`
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user