feat: 完成数据库改密及权限编辑操作

This commit is contained in:
ssongliu
2022-10-24 18:46:19 +08:00
committed by ssongliu
parent 7159e941aa
commit 53d8aede66
9 changed files with 323 additions and 68 deletions

View File

@@ -25,6 +25,23 @@ func (b *BaseApi) CreateMysql(c *gin.Context) {
helper.SuccessWithData(c, nil)
}
func (b *BaseApi) UpdateMysql(c *gin.Context) {
var req dto.ChangeDBInfo
if err := c.ShouldBindJSON(&req); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
return
}
if err := global.VALID.Struct(req); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
return
}
if err := mysqlService.ChangeInfo(req); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return
}
helper.SuccessWithData(c, nil)
}
func (b *BaseApi) SearchMysql(c *gin.Context) {
var req dto.SearchWithPage
if err := c.ShouldBindJSON(&req); err != nil {
@@ -73,7 +90,7 @@ func (b *BaseApi) LoadStatus(c *gin.Context) {
}
func (b *BaseApi) LoadConf(c *gin.Context) {
data, err := mysqlService.LoadConf("")
data, err := mysqlService.LoadVariables("")
if err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
return