clear:formatting code

This commit is contained in:
zhangwenjian
2020-07-23 12:03:17 +08:00
parent 426cec1b62
commit 8c554d7ee7
52 changed files with 486 additions and 502 deletions
-1
View File
@@ -47,7 +47,6 @@ func ServerInfo(c *gin.Context) {
cpuDic := make(map[string]interface{}, 0)
cpuDic["cpuNum"], _ = cpu.Counts(false)
app.Custum(c, gin.H{
"code": 200,
"os": osDic,
+3 -5
View File
@@ -86,7 +86,7 @@ func GetConfigByConfigKey(c *gin.Context) {
result, err := Config.Get()
tools.HasError(err, "抱歉未找到相关信息", -1)
app.OK(c, result,result.ConfigValue)
app.OK(c, result, result.ConfigValue)
}
// @Summary 添加配置
@@ -107,7 +107,7 @@ func InsertConfig(c *gin.Context) {
result, err := data.Create()
tools.HasError(err, "", -1)
app.OK(c, result,"")
app.OK(c, result, "")
}
// @Summary 修改配置
@@ -127,7 +127,7 @@ func UpdateConfig(c *gin.Context) {
data.UpdateBy = tools.GetUserIdStr(c)
result, err := data.Update(data.ConfigId)
tools.HasError(err, "", -1)
app.OK(c, result,"")
app.OK(c, result, "")
}
// @Summary 删除配置
@@ -145,5 +145,3 @@ func DeleteConfig(c *gin.Context) {
tools.HasError(err, "修改失败", 500)
app.OK(c, result, msg.DeletedSuccess)
}
+8 -8
View File
@@ -26,17 +26,17 @@ func GetDeptList(c *gin.Context) {
Dept.DataScope = tools.GetUserIdStr(c)
result, err := Dept.SetDept(true)
tools.HasError(err, "抱歉未找到相关信息", -1)
app.OK(c,result,"")
app.OK(c, result, "")
}
func GetDeptTree(c *gin.Context) {
var Dept models.SysDept
Dept.DeptName = c.Request.FormValue("deptName")
Dept.Status= c.Request.FormValue("status")
Dept.Status = c.Request.FormValue("status")
Dept.DeptId, _ = tools.StringToInt(c.Request.FormValue("deptId"))
result, err := Dept.SetDept(false)
tools.HasError(err, "抱歉未找到相关信息", -1)
app.OK(c,result,"")
app.OK(c, result, "")
}
// @Summary 部门列表数据
@@ -53,7 +53,7 @@ func GetDept(c *gin.Context) {
Dept.DataScope = tools.GetUserIdStr(c)
result, err := Dept.Get()
tools.HasError(err, msg.NotFound, 404)
app.OK(c,result, msg.GetSuccess)
app.OK(c, result, msg.GetSuccess)
}
// @Summary 添加部门
@@ -73,7 +73,7 @@ func InsertDept(c *gin.Context) {
data.CreateBy = tools.GetUserIdStr(c)
result, err := data.Create()
tools.HasError(err, "", -1)
app.OK(c,result, msg.CreatedSuccess)
app.OK(c, result, msg.CreatedSuccess)
}
// @Summary 修改部门
@@ -94,7 +94,7 @@ func UpdateDept(c *gin.Context) {
data.UpdateBy = tools.GetUserIdStr(c)
result, err := data.Update(data.DeptId)
tools.HasError(err, "", -1)
app.OK(c,result, msg.UpdatedSuccess)
app.OK(c, result, msg.UpdatedSuccess)
}
// @Summary 删除部门
@@ -109,7 +109,7 @@ func DeleteDept(c *gin.Context) {
id, err := tools.StringToInt(c.Param("id"))
_, err = data.Delete(id)
tools.HasError(err, "删除失败", 500)
app.OK(c,"", msg.DeletedSuccess)
app.OK(c, "", msg.DeletedSuccess)
}
func GetDeptTreeRoleselect(c *gin.Context) {
@@ -124,7 +124,7 @@ func GetDeptTreeRoleselect(c *gin.Context) {
menuIds, err = SysRole.GetRoleDeptId()
tools.HasError(err, "抱歉未找到相关信息", -1)
}
app.Custum(c,gin.H{
app.Custum(c, gin.H{
"code": 200,
"depts": result,
"checkedKeys": menuIds,
+1 -1
View File
@@ -148,5 +148,5 @@ func DeleteDictData(c *gin.Context) {
IDS := tools.IdsStrToIdsIntGroup("dictCode", c)
result, err := data.BatchDelete(IDS)
tools.HasError(err, "修改失败", 500)
app.OK(c,result,"删除成功")
app.OK(c, result, "删除成功")
}
+3 -4
View File
@@ -1,6 +1,6 @@
package system
import(
import (
"github.com/gin-gonic/gin"
)
@@ -33,8 +33,7 @@ $(function(){
</html>
`
func HelloWorld(c *gin.Context){
func HelloWorld(c *gin.Context) {
c.Header("Content-Type", "text/html; charset=utf-8")
c.String(200, INDEX)
c.String(200, INDEX)
}
+4 -4
View File
@@ -54,7 +54,7 @@ func GetPost(c *gin.Context) {
Post.PostId, _ = tools.StringToInt(c.Param("postId"))
result, err := Post.Get()
tools.HasError(err, "抱歉未找到相关信息", -1)
app.OK(c,result,"")
app.OK(c, result, "")
}
// @Summary 添加岗位
@@ -74,7 +74,7 @@ func InsertPost(c *gin.Context) {
tools.HasError(err, "", 500)
result, err := data.Create()
tools.HasError(err, "", -1)
app.OK(c,result,"")
app.OK(c, result, "")
}
// @Summary 修改岗位
@@ -95,7 +95,7 @@ func UpdatePost(c *gin.Context) {
tools.HasError(err, "", -1)
result, err := data.Update(data.PostId)
tools.HasError(err, "", -1)
app.OK(c,result,"修改成功")
app.OK(c, result, "修改成功")
}
// @Summary 删除岗位
@@ -111,5 +111,5 @@ func DeletePost(c *gin.Context) {
IDS := tools.IdsStrToIdsIntGroup("postId", c)
result, err := data.BatchDelete(IDS)
tools.HasError(err, "删除失败", 500)
app.OK(c,result,"删除成功")
app.OK(c, result, "删除成功")
}
+1 -1
View File
@@ -31,7 +31,7 @@ func GetDBColumnList(c *gin.Context) {
}
data.TableName = c.Request.FormValue("tableName")
tools2.Assert(data.TableName=="","table name cannot be empty",500)
tools2.Assert(data.TableName == "", "table name cannot be empty", 500)
result, count, err := data.GetPage(pageSize, pageIndex)
tools2.HasError(err, "", -1)
+7 -7
View File
@@ -73,8 +73,8 @@ func GenCode(c *gin.Context) {
_ = tools2.PathCreate("./apis/" + tab.ModuleName + "/")
_ = tools2.PathCreate("./models/")
_ = tools2.PathCreate("./router/")
_ = tools2.PathCreate(config.GenConfig.FrontPath+"/api/")
_ = tools2.PathCreate(config.GenConfig.FrontPath+"/views/"+tab.PackageName)
_ = tools2.PathCreate(config.GenConfig.FrontPath + "/api/")
_ = tools2.PathCreate(config.GenConfig.FrontPath + "/views/" + tab.PackageName)
var b1 bytes.Buffer
err = t1.Execute(&b1, tab)
@@ -92,15 +92,15 @@ func GenCode(c *gin.Context) {
tools2.FileCreate(b4, config.GenConfig.FrontPath+"/api/"+tab.PackageName+".js")
tools2.FileCreate(b5, config.GenConfig.FrontPath+"/views/"+tab.PackageName+"/index.vue")
oldTest:="// {{认证路由自动补充在此处请勿删除}}"
newText:="// {{认证路由自动补充在此处请勿删除}} \r\n register"+tab.ClassName+"Router(v1,authMiddleware)"
oldTest := "// {{认证路由自动补充在此处请勿删除}}"
newText := "// {{认证路由自动补充在此处请勿删除}} \r\n register" + tab.ClassName + "Router(v1,authMiddleware)"
helper := tools2.ReplaceHelper{
Root: "./router/router.go",
OldText:oldTest,
Root: "./router/router.go",
OldText: oldTest,
NewText: newText,
}
if helper.OldText == helper.NewText{
if helper.OldText == helper.NewText {
log.Println("error !! the NewText isEqual the OldText")
return
}