From 96667d9071e9478d68f92c3b534b22dbc6e6591d Mon Sep 17 00:00:00 2001 From: weihao Date: Thu, 27 Feb 2025 10:41:55 +0800 Subject: [PATCH] fix some spell errors in controllers --- controllers/login.go | 8 ++++---- controllers/tag.go | 15 +++++---------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/controllers/login.go b/controllers/login.go index f454dc9..01da10c 100644 --- a/controllers/login.go +++ b/controllers/login.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * ha-api licensed under the Mulan Permissive Software License, Version 2. + * ha-api licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: yangzhao_kl * Date: Fri Jan 8 20:56:40 2021 +0800 @@ -24,8 +24,8 @@ func init() { } const ( - apiPreffix = "/api" - versionPreffix = "/v1" + apiPrefix = "/api" + versionPrefix = "/v1" ) var loginFilter = func(ctx *context.Context) { @@ -33,7 +33,7 @@ var loginFilter = func(ctx *context.Context) { username := ctx.Input.Session("username") if username == nil { if !strings.Contains(ctx.Request.RequestURI, "/login") && !strings.Contains(ctx.Request.RequestURI, "/remote") { - if strings.HasPrefix(ctx.Request.RequestURI, apiPreffix) { + if strings.HasPrefix(ctx.Request.RequestURI, apiPrefix) { ctx.Redirect(403, "session timeout") } } diff --git a/controllers/tag.go b/controllers/tag.go index 6ff981c..1d93c36 100644 --- a/controllers/tag.go +++ b/controllers/tag.go @@ -1,6 +1,6 @@ /* * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. - * ha-api licensed under the Mulan Permissive Software License, Version 2. + * ha-api licensed under the Mulan Permissive Software License, Version 2. * See LICENSE file for more details. * Author: bixiaoyan * Date: Fri Mar 22 17:26:24 2024 +0800 @@ -8,9 +8,9 @@ package controllers import ( - "github.com/beego/beego/v2/server/web" "gitee.com/openeuler/ha-api/models" "github.com/beego/beego/v2/core/logs" + "github.com/beego/beego/v2/server/web" ) type TagController struct { @@ -19,7 +19,7 @@ type TagController struct { func (tc *TagController) Get() { tc.Data["json"] = models.GetTag() - tc.ServeJSON() + tc.ServeJSON() } func (tc *TagController) Post() { @@ -47,12 +47,7 @@ type TagActionController struct { func (tuc *TagActionController) Put() { tagName := tuc.Ctx.Input.Param(":tag_name") - atcion := tuc.Ctx.Input.Param(":action") - tuc.Data["json"] = models.TagAction(tagName,atcion) + action := tuc.Ctx.Input.Param(":action") + tuc.Data["json"] = models.TagAction(tagName, action) tuc.ServeJSON() } - - - - - \ No newline at end of file -- Gitee