This commit is contained in:
2025-06-17 15:56:05 +08:00
parent 417d0671de
commit b171122a32
8 changed files with 40 additions and 41 deletions

View File

@@ -36,13 +36,13 @@ func (a *app) list(w http.ResponseWriter, r *http.Request) {
a.render.Render(ctx, w, role.List(ctx))
case http.MethodPost:
var q dto.SearchDto
q.SearchTimeBegin, q.SearchTimeEnd = convertor.DefaultStartTimeAndEndTime(r.PostFormValue("timeBegin"), r.PostFormValue("timeEnd"))
q.SearchStatus = convertor.ConvertInt(r.PostFormValue("status"), 9999)
q.SearchParentID = convertor.ConvertInt(r.PostFormValue("parentId"), 0)
q.SearchTimeBegin, q.SearchTimeEnd = convertor.DefaultTime(r.PostFormValue("timeBegin"), r.PostFormValue("timeEnd"))
q.SearchStatus = convertor.Int(r.PostFormValue("status"), 9999)
q.SearchParentID = convertor.Int(r.PostFormValue("parentId"), 0)
q.SearchName = r.PostFormValue("name")
q.SearchID = convertor.ConvertInt[int64](r.PostFormValue("id"), 0)
q.Page = convertor.ConvertInt(r.PostFormValue("page"), 1)
q.Rows = convertor.ConvertInt(r.PostFormValue("rows"), 10)
q.SearchID = convertor.Int[int64](r.PostFormValue("id"), 0)
q.Page = convertor.Int(r.PostFormValue("page"), 1)
q.Rows = convertor.Int(r.PostFormValue("rows"), 10)
res, count, err := a.roleService.List(r.Context(), q)
if err != nil {
a.render.JSONErr(w, err.Error())
@@ -149,7 +149,7 @@ func (a *app) refreshRoleMenus(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
// 获取需要刷新的角色ID
roleID := convertor.ConvertInt[int32](r.PostFormValue("roleID"), 0)
roleID := convertor.Int[int32](r.PostFormValue("roleID"), 0)
roleModel, err := a.roleService.Get(ctx, roleID)
if err != nil {
a.render.JSONErr(w, err.Error())
@@ -204,7 +204,7 @@ func (a *app) setMenu(w http.ResponseWriter, r *http.Request) {
a.render.Render(ctx, w, role.SetMenu(ctx, vm))
case http.MethodPost:
ctx := r.Context()
id := convertor.ConvertInt[int32](r.PostFormValue("ID"), 0)
id := convertor.Int[int32](r.PostFormValue("ID"), 0)
if id == 0 {
a.render.JSONErr(w, "角色异常, 请刷新重试")
return
@@ -228,7 +228,7 @@ func (a *app) setMenu(w http.ResponseWriter, r *http.Request) {
var rms []*system.RoleMenu
for _, v := range menuArr {
menuID := convertor.ConvertInt(v, 0)
menuID := convertor.Int(v, 0)
if menuID > 0 {
menu, err := a.menuService.Get(ctx, int32(menuID))
if err != nil {