houyaf 3 vuotta sitten
vanhempi
commit
b6d87bd2d2

+ 3 - 3
web/controllers/app_cat_controller.go

@@ -12,8 +12,8 @@ type AppCatController struct {
 }
 
 func (c *AppCatController) BeforeActivation(b mvc.BeforeActivation) {
-    b.Handle("GET",     "/",                    "GetList" )
-    b.Handle("GET",     "/page",                "GetPage" )
+    b.Handle("GET",     "/",                    "GetList"   )
+    b.Handle("GET",     "/page",                "GetPage"   )
     b.Handle("GET",     "/{appCatId:int64}",    "GetById"   )
     b.Handle("POST",    "/add",                 "Create"    )
     b.Handle("PUT",     "/update",              "Update"    )
@@ -85,7 +85,7 @@ func (c *AppCatController) Update() *JsonResult {
 func (c *AppCatController) DeleteByID(appCatId int64) *JsonResult {
     ocId   := c.GetCurOcId()
     userId := c.GetCurUserId()
-    m  := make(map[string]interface{})
+    m := make(map[string]interface{})
     m["ocId"]      = ocId
     m["appCatId"]= appCatId
     m["deletedBy"] = userId

+ 11 - 13
web/controllers/app_controller.go

@@ -12,16 +12,16 @@ type AppController struct {
 }
 
 func (c *AppController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",     "/",                "GetList")
-	b.Handle("GET",     "/page",            "GetPage")
-	b.Handle("GET",     "/{appId:int64}",   "GetById")
-	b.Handle("POST",    "/add",             "Create")
-	b.Handle("PUT",     "/update",          "Update")
-	b.Handle("DELETE",  "/{appId:int64}",   "DeleteByID")
+	b.Handle("GET",         "/",                "GetList"   )
+	b.Handle("GET",         "/page",            "GetPage"   )
+	b.Handle("GET",         "/{appId:int64}",   "GetById"   )
+	b.Handle("POST",        "/add",             "Create"    )
+	b.Handle("PUT",         "/update",          "Update"    )
+	b.Handle("DELETE",      "/{appId:int64}",   "DeleteByID")
 }
 
 func (c *AppController) GetList() *JsonResult {
-	params := c.buildParams()
+	params    := c.buildParams()
 	data, err := c.Service.GetList(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -30,7 +30,7 @@ func (c *AppController) GetList() *JsonResult {
 }
 
 func (c *AppController) GetPage() *JsonResult {
-	params := c.buildParams()
+	params    := c.buildParams()
 	data, err := c.Service.GetPage(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -50,8 +50,7 @@ func (c *AppController) GetById(appId int64) *JsonResult {
 
 func (c *AppController) Create() *JsonResult {
 	userId := c.GetCurUserId()
-
-	app := datamodels.App{}
+	app    := datamodels.App{}
 	app.CreatedBy = userId
 	err := c.Ctx.ReadJSON(&app)
 	if err != nil {
@@ -68,8 +67,7 @@ func (c *AppController) Create() *JsonResult {
 
 func (c *AppController) Update() *JsonResult {
 	userId := c.GetCurUserId()
-
-	app := datamodels.App{}
+	app    := datamodels.App{}
 	if err := c.Ctx.ReadJSON(&app); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
@@ -87,7 +85,7 @@ func (c *AppController) DeleteByID(appId int64) *JsonResult {
 	ocId   := c.GetCurOcId()
 	userId := c.GetCurUserId()
 
-	var m = make(map[string]interface{})
+	m := make(map[string]interface{})
 	m["ocId"] = ocId
 	m["appId"] = appId
 	m["deletedBy"] = userId

+ 2 - 2
web/controllers/app_permit_controller.go

@@ -12,7 +12,7 @@ type AppPermitController struct {
 }
 
 func (c *AppPermitController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",     "/{appId:int64}/{roleId:int64}",                    "GetList" )
+	b.Handle("GET",     "/{appId:int64}/{roleId:int64}",                    "GetList"   )
 	b.Handle("GET",     "/{appId:int64}/{roleId:int64}/{permitId:int64}",   "GetById"   )
 	b.Handle("POST",    "/add",                                             "Create"    )
 	b.Handle("PUT",     "/update",                                          "Update"    )
@@ -76,7 +76,7 @@ func (c *AppPermitController) Update() *JsonResult {
 
 func (c *AppPermitController) DeleteByID(appId, roleId, permitId int64) *JsonResult {
 	userId := c.GetCurUserId()
-	m  := make(map[string]interface{})
+	m := make(map[string]interface{})
 	m["appId"]     = appId
 	m["roleId"]    = roleId
 	m["permitId"]  = permitId

+ 0 - 4
web/controllers/base_controller.go

@@ -103,10 +103,6 @@ type JsonResult struct {
 	Data interface{} `json:"data"`
 }
 
-type ClientToken struct {
-	token string `json:"token"`
-}
-
 func ResultOk(msg string, objects interface{}) (r *JsonResult) {
 	r = &JsonResult{Code: RetOk, Msg: msg, Data: objects}
 	return

+ 10 - 13
web/controllers/ent_cat_controller.go

@@ -12,16 +12,16 @@ type EntCatController struct {
 }
 
 func (c *EntCatController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET", "/", "GetList")
-	b.Handle("GET", "/page", "GetPage")
-	b.Handle("GET", "/{entCatId:int64}", "GetById")
-	b.Handle("POST", "/add", "Create")
-	b.Handle("PUT", "/update", "Update")
-	b.Handle("DELETE", "/{entCatId:int64}", "DeleteByID")
+	b.Handle("GET",         "/",                    "GetList"   )
+	b.Handle("GET",         "/page",                "GetPage"   )
+	b.Handle("GET",         "/{entCatId:int64}",    "GetById"   )
+	b.Handle("POST",        "/add",                 "Create"    )
+	b.Handle("PUT",         "/update",              "Update"    )
+	b.Handle("DELETE",      "/{entCatId:int64}",    "DeleteByID")
 }
 
 func (c *EntCatController) GetList() *JsonResult {
-	params := c.buildParams()
+	params    := c.buildParams()
 	data, err := c.Service.GetList(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -31,7 +31,7 @@ func (c *EntCatController) GetList() *JsonResult {
 }
 
 func (c *EntCatController) GetPage() *JsonResult {
-	params := c.buildParams()
+	params    := c.buildParams()
 	data, err := c.Service.GetPage(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -51,7 +51,6 @@ func (c *EntCatController) GetById(entCatId int64) *JsonResult {
 
 func (c *EntCatController) Create() *JsonResult {
 	userId := c.GetCurUserId()
-
 	entCat := datamodels.EntCat{}
 	entCat.CreatedBy = userId
 	err := c.Ctx.ReadJSON(&entCat)
@@ -69,7 +68,6 @@ func (c *EntCatController) Create() *JsonResult {
 
 func (c *EntCatController) Update() *JsonResult {
 	userId := c.GetCurUserId()
-
 	entCat := datamodels.EntCat{}
 	if err := c.Ctx.ReadJSON(&entCat); err != nil {
 		return ResultErr("读取数据失败", nil)
@@ -86,9 +84,8 @@ func (c *EntCatController) Update() *JsonResult {
 
 func (c *EntCatController) DeleteByID(entCatId int64) *JsonResult {
 	userId := c.GetCurUserId()
-
-	var m = make(map[string]interface{})
-	m["entCatId"] = entCatId
+	m := make(map[string]interface{})
+	m["entCatId"]  = entCatId
 	m["deletedBy"] = userId
 	err := c.Service.Delete(m)
 	if err != nil {

+ 12 - 13
web/controllers/group_cat_controller.go

@@ -12,25 +12,26 @@ type GroupCatController struct {
 }
 
 func (c *GroupCatController) BeforeActivation(b mvc.BeforeActivation) {
-    b.Handle("GET",     "/",                    "GetList")
-    b.Handle("GET",     "/page",                "GetPage")
-    b.Handle("GET",     "/{groupCatId:int64}",  "GetById")
-    b.Handle("POST",    "/add",                 "Create")
-    b.Handle("PUT",     "/update",              "Update")
-    b.Handle("DELETE",  "/{groupCatId:int64}",  "DeleteByID")
+    b.Handle("GET",         "/",                        "GetList"   )
+    b.Handle("GET",         "/page",                    "GetPage"   )
+    b.Handle("GET",         "/{groupCatId:int64}",      "GetById"   )
+    b.Handle("POST",        "/add",                     "Create"    )
+    b.Handle("PUT",         "/update",                  "Update"    )
+    b.Handle("DELETE",      "/{groupCatId:int64}",      "DeleteByID")
 }
 
 func (c *GroupCatController) GetList() *JsonResult {
-    params := c.buildParams()
+    params    := c.buildParams()
     data, err := c.Service.GetList(params)
     if err != nil {
         return ResultErr(err.Error(), nil)
+    } else {
+        return ResultOk("获取成功", data)
     }
-    return ResultOk("获取成功", data)
 }
 
 func (c *GroupCatController) GetPage() *JsonResult {
-    params := c.buildParams()
+    params    := c.buildParams()
     data, err := c.Service.GetPage(params)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -40,7 +41,7 @@ func (c *GroupCatController) GetPage() *JsonResult {
 }
 
 func (c *GroupCatController) GetById(groupCatId int64) *JsonResult {
-    ocId := c.GetCurOcId()
+    ocId      := c.GetCurOcId()
     data, err := c.Service.GetById(ocId, groupCatId)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -52,7 +53,6 @@ func (c *GroupCatController) GetById(groupCatId int64) *JsonResult {
 func (c *GroupCatController) Create() *JsonResult {
     ocId     := c.GetCurOcId()
     userId   := c.GetCurUserId()
-    
     groupCat := datamodels.GroupCat{}
     err := c.Ctx.ReadJSON(&groupCat)
     if err != nil {
@@ -72,7 +72,6 @@ func (c *GroupCatController) Create() *JsonResult {
 func (c *GroupCatController) Update() *JsonResult {
     ocId     := c.GetCurOcId()
     userId   := c.GetCurUserId()
-    
     groupCat := datamodels.GroupCat{}
     if err := c.Ctx.ReadJSON(&groupCat); err != nil {
         return ResultErr("读取数据失败", nil)
@@ -92,7 +91,7 @@ func (c *GroupCatController) DeleteByID(groupCatId int64) *JsonResult {
     ocId   := c.GetCurOcId()
     userId := c.GetCurUserId()
     
-    var m  = make(map[string]interface{})
+    m := make(map[string]interface{})
     m["ocId"]      = ocId
     m["groupCatId"]= groupCatId
     m["deletedBy"] = userId

+ 5 - 5
web/controllers/group_controller.go

@@ -12,7 +12,7 @@ type GroupController struct {
 }
 
 func (c *GroupController) BeforeActivation(b mvc.BeforeActivation) {
-    b.Handle("GET"      ,"/"                                ,"GetList"   )
+    b.Handle("GET"      ,"/"                                ,"GetList"     )
     b.Handle("GET"      ,"/groupId:int64}"                  ,"GetById"     )
     b.Handle("POST"     ,"/add"                             ,"Create"      )
     b.Handle("PUT"      ,"/update"                          ,"Update"      )
@@ -31,7 +31,7 @@ func (c *GroupController)  GetList() *JsonResult {
 }
 
 func (c *GroupController) GetById(groupId int64) *JsonResult {
-    ocId := c.GetCurOcId()
+    ocId      := c.GetCurOcId()
     data, err := c.Service.GetById(ocId, groupId)
     if err != nil {
         return ResultErr(err.Error(), nil)
@@ -60,14 +60,14 @@ func (c *GroupController) Create() *JsonResult {
 }
 
 func (c *GroupController) Update(groupId int64) *JsonResult {
-    ocId     := c.GetCurOcId()
-    userId   := c.GetCurUserId()
+    ocId   := c.GetCurOcId()
+    userId := c.GetCurUserId()
     group  := datamodels.Group{}
     if err := c.Ctx.ReadJSON(&group); err != nil {
         return ResultErr("读取数据失败", nil)
     }
     
-    group.OcId = ocId
+    group.OcId      = ocId
     group.UpdatedBy = userId
     err := c.Service.Update(&group)
     if err != nil {

+ 4 - 4
web/controllers/login_controller.go

@@ -11,10 +11,10 @@ type LoginController struct {
 }
 
 func (c *LoginController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("POST",    "/login",   "Login")
-	b.Handle("GET",     "/logout",  "Logout")
-	b.Handle("GET",     "/test",    "GetTest")
-	b.Handle("GET",     "/hello",   "GetHello")
+	b.Handle("POST",    "/login",       "Login"     )
+	b.Handle("GET",     "/logout",      "Logout"    )
+	b.Handle("GET",     "/test",        "GetTest"   )
+	b.Handle("GET",     "/hello",       "GetHello"  )
 }
 
 func (c *LoginController) Login() *JsonResult {

+ 2 - 2
web/controllers/model_controller.go

@@ -12,8 +12,8 @@ type ModelController struct {
 }
 
 func (c *ModelController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",         "/",                "GetList" )
-	b.Handle("GET",         "/page",            "GetPage" )
+	b.Handle("GET",         "/",                "GetList"   )
+	b.Handle("GET",         "/page",            "GetPage"   )
 	b.Handle("GET",         "/{modelId:int64}", "GetById"   )
 	b.Handle("POST",        "/add",             "Create"    )
 	b.Handle("PUT",         "/update",          "Update"    )

+ 2 - 2
web/controllers/object_controller.go

@@ -96,8 +96,8 @@ func (c *ObjectController) Update() *JsonResult {
 func (c *ObjectController) DeleteByID(modelId, objectId int64) *JsonResult {
 	userId := c.GetCurUserId()
 	m := make(map[string]interface{})
-	m["modelId"] = modelId
-	m["objectId"] = objectId
+	m["modelId"]   = modelId
+	m["objectId"]  = objectId
 	m["deletedBy"] = userId
 	err := c.Service.Delete(m)
 	if err != nil {

+ 2 - 2
web/controllers/partner_cat_controller.go

@@ -12,8 +12,8 @@ type PartnerCatController struct {
 }
 
 func (c *PartnerCatController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",         "/",                        "GetList" )
-	b.Handle("GET",         "/page",                    "GetPage" )
+	b.Handle("GET",         "/",                        "GetList"   )
+	b.Handle("GET",         "/page",                    "GetPage"   )
 	b.Handle("GET",         "/{partnerCatId:int64}",    "GetById"   )
 	b.Handle("POST",        "/add",                     "Create"    )
 	b.Handle("PUT",         "/update",                  "Update"    )

+ 7 - 7
web/controllers/position_controller.go

@@ -12,12 +12,12 @@ type PositionController struct {
 }
 
 func (c *PositionController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",     "/",                    "GetList")
-	b.Handle("GET",     "/page",                "GetPage")
-	b.Handle("GET",     "/{positionId:int64}",  "GetById")
-	b.Handle("POST",    "/add",                 "Create")
-	b.Handle("PUT",     "/update",              "Update")
-	b.Handle("DELETE",  "/{positionId:int64}",  "DeleteByID")
+	b.Handle("GET",         "/",                    "GetList"       )
+	b.Handle("GET",         "/page",                "GetPage"       )
+	b.Handle("GET",         "/{positionId:int64}",  "GetById"       )
+	b.Handle("POST",        "/add",                 "Create"        )
+	b.Handle("PUT",         "/update",              "Update"        )
+	b.Handle("DELETE",      "/{positionId:int64}",  "DeleteByID"    )
 }
 
 func (c *PositionController) GetList() *JsonResult {
@@ -90,7 +90,7 @@ func (c *PositionController) Update() *JsonResult {
 func (c *PositionController) DeleteByID(positionId int64) *JsonResult {
 	ocId   := c.GetCurOcId()
 	userId := c.GetCurUserId()
-	m  := make(map[string]interface{})
+	m := make(map[string]interface{})
 	m["ocId"]      = ocId
 	m["positionId"]= positionId
 	m["deletedBy"] = userId

+ 9 - 10
web/controllers/role_controller.go

@@ -12,16 +12,16 @@ type RoleController struct {
 }
 
 func (c *RoleController) BeforeActivation(b mvc.BeforeActivation) {
-	b.Handle("GET",         "/",                "GetList" )
-	b.Handle("GET",         "/page",            "GetPage" )
-	b.Handle("GET",         "/{roleId:int64}",  "GetById"   )
-	b.Handle("POST",        "/add",             "Create"    )
-	b.Handle("PUT",         "/update",          "Update"    )
-	b.Handle("DELETE",      "/{roleId:int64}",  "DeleteById")
+	b.Handle("GET",         "/",                "GetList"       )
+	b.Handle("GET",         "/page",            "GetPage"       )
+	b.Handle("GET",         "/{roleId:int64}",  "GetById"       )
+	b.Handle("POST",        "/add",             "Create"        )
+	b.Handle("PUT",         "/update",          "Update"        )
+	b.Handle("DELETE",      "/{roleId:int64}",  "DeleteById"    )
 }
 
 func (c *RoleController) GetList() *JsonResult {
-	params := c.buildParams()
+	params    := c.buildParams()
 	data, err := c.Service.GetList(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -31,7 +31,7 @@ func (c *RoleController) GetList() *JsonResult {
 }
 
 func (c *RoleController) GetPage() *JsonResult {
-	params := c.buildParams()
+	params    := c.buildParams()
 	data, err := c.Service.GetPage(params)
 	if err != nil {
 		return ResultErr(err.Error(), nil)
@@ -65,7 +65,7 @@ func (c *RoleController) Create() *JsonResult {
 }
 
 func (c *RoleController) Update() *JsonResult {
-	role := &datamodels.Role{}
+	role   := &datamodels.Role{}
 	if err := c.Ctx.ReadJSON(role); err != nil {
 		return ResultErr("读取数据失败", nil)
 	}
@@ -80,7 +80,6 @@ func (c *RoleController) Update() *JsonResult {
 
 func (c *RoleController) DeleteById(roleId int64) *JsonResult {
 	userId := c.GetCurUserId()
-	
 	m := make(map[string]interface{})
 	m["roleId"]    = roleId
 	m["deletedBy"] = userId

+ 3 - 3
web/controllers/task_cat_controller.go

@@ -58,7 +58,7 @@ func (c *TaskCatController) Create() *JsonResult {
 		return ResultErr("读取数据失败", nil)
 	}
 
-	taskCat.OcId = ocId
+	taskCat.OcId      = ocId
 	taskCat.CreatedBy = userId
 	err = c.Service.Create(&taskCat)
 	if err != nil {
@@ -76,7 +76,7 @@ func (c *TaskCatController) Update() *JsonResult {
 		return ResultErr("读取数据失败", nil)
 	}
 
-	taskCat.OcId = ocId
+	taskCat.OcId      = ocId
 	taskCat.UpdatedBy = userId
 	err := c.Service.Update(&taskCat)
 	if err != nil {
@@ -91,7 +91,7 @@ func (c *TaskCatController) DeleteByID(taskCatId int64) *JsonResult {
 	userId := c.GetCurUserId()
 	
 	m := make(map[string]interface{})
-	m["ocId"] = ocId
+	m["ocId"]      = ocId
 	m["taskCatId"] = taskCatId
 	m["deletedBy"] = userId
 	err := c.Service.Delete(m)

+ 4 - 4
web/controllers/user_controller.go

@@ -12,10 +12,10 @@ type UserController struct {
 }
 
 func (c *UserController) BeforeActivation(b mvc.BeforeActivation) {
-    b.Handle("GET",         "/page",                                "GetPage")
-    b.Handle("GET",         "/{groupId:int64}/{accountId:int64}",   "GetById")
-    b.Handle("POST",        "/add",                                 "Create")
-    b.Handle("PUT",         "/update",                              "Update")
+    b.Handle("GET",         "/page",                                "GetPage"   )
+    b.Handle("GET",         "/{groupId:int64}/{accountId:int64}",   "GetById"   )
+    b.Handle("POST",        "/add",                                 "Create"    )
+    b.Handle("PUT",         "/update",                              "Update"    )
     b.Handle("DELETE",      "/{accountId:int64}",                   "DeleteById")
 }