diff --git a/server/.golangci.yml b/server/.golangci.yml index 99fa62e..417e4ea 100644 --- a/server/.golangci.yml +++ b/server/.golangci.yml @@ -13,14 +13,15 @@ run: # Include test files or not. # Default: true tests: false + go: "1.20" # Which dirs to skip: issues from them won't be reported. # Can use regexp here: `generated.*`, regexp is applied on full path. # Default value is empty list, # but default dirs are skipped independently of this option's value (see skip-dirs-use-default). # "/" will be replaced by current OS file path separator to properly work on Windows. - skip-dirs: - - internal/library/hggen/internal + # skip-dirs: + # - internal/library/hggen/internal # Which files to skip: they will be analyzed, but issues from them won't be reported. # Default value is empty list, @@ -28,7 +29,7 @@ run: # we confidently recognize autogenerated files. # If it's not please let us know. # "/" will be replaced by current OS file path separator to properly work on Windows. - skip-files: [] + # skip-files: [] # Main linters configurations. @@ -71,7 +72,10 @@ issues: - linters: - gocritic text: "unnecessaryDefer:" - + exclude-dirs: + - internal/library/hggen/internal + exclude-files: [] + # https://golangci-lint.run/usage/linters linters-settings: @@ -176,7 +180,7 @@ linters-settings: # Select the Go version to target. # Default: 1.13 # Deprecated: use the global `run.go` instead. - go: "1.15" + # go: "1.15" # Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks # Default: ["*"] checks: [ @@ -187,7 +191,7 @@ linters-settings: govet: # Report about shadowed variables. # Default: false - check-shadowing: true + # check-shadowing: true # Settings per analyzer. settings: # Analyzer name, run `go tool vet help` to see all analyzers. @@ -263,7 +267,7 @@ linters-settings: # Select the Go version to target. # Default: "1.13" # Deprecated: use the global `run.go` instead. - go: "1.15" + # go: "1.15" # SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks # Default: ["*"] checks: [ "all","-SA1019","-SA4015","-SA1029","-SA1016","-SA9003","-SA4006","-SA6003" ] diff --git a/server/addons/hgexample/logic/sys/tenant_order.go b/server/addons/hgexample/logic/sys/tenant_order.go index 22e27ef..ac8094d 100644 --- a/server/addons/hgexample/logic/sys/tenant_order.go +++ b/server/addons/hgexample/logic/sys/tenant_order.go @@ -133,7 +133,6 @@ func (s *sSysTenantOrder) Export(ctx context.Context, in *sysin.TenantOrderListI // Edit 修改/新增多租户功能演示 func (s *sSysTenantOrder) Edit(ctx context.Context, in *sysin.TenantOrderEditInp) (err error) { return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { - // 修改 if in.Id > 0 { if _, err = s.Model(ctx). @@ -158,7 +157,6 @@ func (s *sSysTenantOrder) Edit(ctx context.Context, in *sysin.TenantOrderEditInp // Delete 删除多租户功能演示 func (s *sSysTenantOrder) Delete(ctx context.Context, in *sysin.TenantOrderDeleteInp) (err error) { - if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil { err = gerror.Wrap(err, "删除多租户功能演示失败,请稍后重试!") return diff --git a/server/internal/global/httproutes.go b/server/internal/global/httproutes.go index 23952ea..8a4e535 100644 --- a/server/internal/global/httproutes.go +++ b/server/internal/global/httproutes.go @@ -6,12 +6,13 @@ package global import ( - "github.com/gogf/gf/v2/net/ghttp" - "github.com/gogf/gf/v2/util/gmeta" - "github.com/gogf/gf/v2/util/gtag" "reflect" "strings" "sync" + + "github.com/gogf/gf/v2/net/ghttp" + "github.com/gogf/gf/v2/util/gmeta" + "github.com/gogf/gf/v2/util/gtag" ) // HTTPRouter http路由 @@ -77,7 +78,6 @@ func LoadHTTPRoutes(r *ghttp.Request) map[string]*HTTPRouter { httpRoutes[key] = setRouterMeta(router) } } - } return httpRoutes } diff --git a/server/internal/library/casbin/adapter.go b/server/internal/library/casbin/adapter.go index b6cd69c..97fa28f 100644 --- a/server/internal/library/casbin/adapter.go +++ b/server/internal/library/casbin/adapter.go @@ -9,15 +9,18 @@ import ( "context" "errors" "fmt" + "hotgo/internal/dao" + "math" + "strings" + "github.com/casbin/casbin/v2/model" "github.com/casbin/casbin/v2/persist" "github.com/gogf/gf/v2/database/gdb" - "math" - "strings" ) +var defaultTableName = dao.AdminRoleCasbin.Table() + const ( - defaultTableName = "hg_admin_role_casbin" dropPolicyTableSql = `DROP TABLE IF EXISTS %s` createPolicyTableSql = ` CREATE TABLE IF NOT EXISTS %s ( diff --git a/server/internal/library/casbin/enforcer.go b/server/internal/library/casbin/enforcer.go index 797bf8a..276ce15 100644 --- a/server/internal/library/casbin/enforcer.go +++ b/server/internal/library/casbin/enforcer.go @@ -7,15 +7,18 @@ package casbin import ( "context" + "hotgo/internal/consts" + "hotgo/internal/dao" + "net/http" + "strings" + "github.com/casbin/casbin/v2" "github.com/casbin/casbin/v2/model" _ "github.com/gogf/gf/contrib/drivers/mysql/v2" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gres" - "hotgo/internal/consts" - "net/http" - "strings" + "github.com/gogf/gf/v2/text/gstr" ) const ( @@ -76,10 +79,9 @@ func loadPermissions(ctx context.Context) { polices []*Policy err error ) - - err = g.Model("hg_admin_role r"). - LeftJoin("hg_admin_role_menu rm", "r.id=rm.role_id"). - LeftJoin("hg_admin_menu m", "rm.menu_id=m.id"). + err = g.Model(gstr.Join([]string{dao.AdminRole.Table(), "r"}, " ")). + LeftJoin(gstr.Join([]string{dao.AdminRoleMenu.Table(), "rm"}, " "), "r.id=rm.role_id"). + LeftJoin(gstr.Join([]string{dao.AdminMenu.Table(), "m"}, " "), "rm.menu_id=m.id"). Fields("r.key,m.permissions"). Where("r.status", consts.StatusEnabled). Where("m.status", consts.StatusEnabled). diff --git a/server/internal/library/hggen/hggen.go b/server/internal/library/hggen/hggen.go index a42738e..fce4b60 100644 --- a/server/internal/library/hggen/hggen.go +++ b/server/internal/library/hggen/hggen.go @@ -6,15 +6,13 @@ package hggen import ( - "github.com/gogf/gf/v2/os/gfile" _ "hotgo/internal/library/hggen/internal/cmd/gendao" "hotgo/internal/library/hggen/internal/utility/utils" _ "unsafe" + "github.com/gogf/gf/v2/os/gfile" + "context" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/util/gconv" "hotgo/internal/consts" "hotgo/internal/library/addons" "hotgo/internal/library/hggen/internal/cmd" @@ -26,6 +24,10 @@ import ( "hotgo/internal/model/input/sysin" "hotgo/internal/service" "sort" + + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/util/gconv" ) //go:linkname doGenDaoForArray hotgo/internal/library/hggen/internal/cmd/gendao.doGenDaoForArray @@ -33,7 +35,6 @@ func doGenDaoForArray(ctx context.Context, index int, in gendao.CGenDaoInput) // Dao 生成数据库实体 func Dao(ctx context.Context) (err error) { - // 在执行gf gen dao时,先将生成文件放在临时路径,生成完成后再拷贝到项目 // 目的是希望减少触发gf热编译的几率,防止热编译运行时代码生成流程未结束被自动重启打断 // gf gen dao 的执行时长主要取决于需要生成数据库表的数量,表越多速度越慢 diff --git a/server/internal/library/hggen/views/curd.go b/server/internal/library/hggen/views/curd.go index 9acde1b..b84ad67 100644 --- a/server/internal/library/hggen/views/curd.go +++ b/server/internal/library/hggen/views/curd.go @@ -7,14 +7,6 @@ package views import ( "context" - "github.com/gogf/gf/v2/container/gvar" - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/os/gview" - "github.com/gogf/gf/v2/text/gstr" "hotgo/internal/consts" "hotgo/internal/dao" "hotgo/internal/library/hggen/internal/cmd/gendao" @@ -27,6 +19,15 @@ import ( "hotgo/utility/tree" "runtime" "strings" + + "github.com/gogf/gf/v2/container/gvar" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/os/gview" + "github.com/gogf/gf/v2/text/gstr" ) var Curd = gCurd{} @@ -118,7 +119,7 @@ type CurdOptions struct { type FuncDict struct { ValueColumn string // 选项值 - LabelColumn string //选项名称 + LabelColumn string // 选项名称 Value *sysin.GenCodesColumnListModel Label *sysin.GenCodesColumnListModel } diff --git a/server/internal/library/hggen/views/gohtml/formatter.go b/server/internal/library/hggen/views/gohtml/formatter.go index baed679..0f1e1f6 100644 --- a/server/internal/library/hggen/views/gohtml/formatter.go +++ b/server/internal/library/hggen/views/gohtml/formatter.go @@ -33,5 +33,4 @@ func AddLineNo(s string) string { bf.WriteString(strings.Repeat(" ", maxLineNoStrLen-len(lineNoStr)) + lineNoStr + " " + line) } return bf.String() - } diff --git a/server/internal/library/hggen/views/gohtml/parser.go b/server/internal/library/hggen/views/gohtml/parser.go index 3442ad5..2ca7444 100644 --- a/server/internal/library/hggen/views/gohtml/parser.go +++ b/server/internal/library/hggen/views/gohtml/parser.go @@ -1,10 +1,11 @@ package gohtml import ( - "golang.org/x/net/html" "io" "regexp" "strings" + + "golang.org/x/net/html" ) // parse parses a stirng and converts it into an html. @@ -106,9 +107,9 @@ func getTagName(tokenizer *html.Tokenizer) string { } // setEndTagRaw sets an endTagRaw to the parent. -func setEndTagRaw(tokenizer *html.Tokenizer, parent *tagElement, tagName string) string { +func setEndTagRaw(_ *html.Tokenizer, parent *tagElement, tagName string) string { if parent != nil && parent.tagName == tagName { - parent.endTagRaw = `` //string(tokenizer.Raw()) + parent.endTagRaw = `` // string(tokenizer.Raw()) return "" } return tagName diff --git a/server/internal/library/hggen/views/gohtml/tag_element.go b/server/internal/library/hggen/views/gohtml/tag_element.go index ec60d58..9e9ce1f 100644 --- a/server/internal/library/hggen/views/gohtml/tag_element.go +++ b/server/internal/library/hggen/views/gohtml/tag_element.go @@ -103,7 +103,7 @@ func (e *tagElement) write(bf *formattedBuffer, isPreviousNodeInline bool) bool } } - if e.isInline() || bytes.IndexAny(condensedBuffer.buffer.Bytes()[1:], "\n") == -1 { + if e.isInline() || bytes.ContainsAny(condensedBuffer.buffer.Bytes()[1:], "\n") { // If we're an inline tag, or there were no newlines were in the buffer, // replace the original with the condensed version condensedBuffer.buffer = bytes.NewBuffer(bytes.Join([][]byte{ diff --git a/server/internal/library/hggen/views/gohtml/utils.go b/server/internal/library/hggen/views/gohtml/utils.go index 6cf8200..25874c3 100644 --- a/server/internal/library/hggen/views/gohtml/utils.go +++ b/server/internal/library/hggen/views/gohtml/utils.go @@ -97,5 +97,5 @@ func (bf *formattedBuffer) writeToken(token string, kind formatterTokenType) { // unifyLineFeed unifies line feeds. func unifyLineFeed(s string) string { - return strings.Replace(strings.Replace(s, "\r\n", "\n", -1), "\r", "\n", -1) + return strings.ReplaceAll(strings.ReplaceAll(s, "\r\n", "\n"), "\r", "\n") } diff --git a/server/internal/library/hggen/views/utils.go b/server/internal/library/hggen/views/utils.go index f4872ff..588ea2a 100644 --- a/server/internal/library/hggen/views/utils.go +++ b/server/internal/library/hggen/views/utils.go @@ -8,14 +8,6 @@ package views import ( "context" "fmt" - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/text/gregex" - "github.com/gogf/gf/v2/text/gstr" - "github.com/gogf/gf/v2/util/gconv" - "golang.org/x/tools/imports" "hotgo/internal/consts" "hotgo/internal/library/hggen/views/gohtml" "hotgo/internal/model" @@ -27,6 +19,15 @@ import ( "regexp" "strings" "unicode" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/text/gregex" + "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" + "golang.org/x/tools/imports" ) // parseServFunName 解析业务服务名称 @@ -242,9 +243,10 @@ func CheckTreeTableFields(columns []*sysin.GenCodesColumnListModel) (err error) // CheckIllegalName 检查命名是否合理 func CheckIllegalName(errPrefix string, names ...string) (err error) { + reg, _ := regexp.Compile("^[a-z_][a-z0-9_]*$") for _, name := range names { name = strings.ToLower(name) - match, _ := regexp.MatchString("^[a-z_][a-z0-9_]*$", name) + match := reg.MatchString(name) if !match { err = gerror.Newf("%v存在格式不正确,必须全部小写且由字母、数字和下划线组成:%v", errPrefix, name) return diff --git a/server/internal/library/hgorm/dao_tenant.go b/server/internal/library/hgorm/dao_tenant.go index 940273c..b35afab 100644 --- a/server/internal/library/hgorm/dao_tenant.go +++ b/server/internal/library/hgorm/dao_tenant.go @@ -7,10 +7,13 @@ package hgorm import ( "context" + "hotgo/internal/consts" + "hotgo/internal/dao" + "hotgo/utility/tree" + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" - "hotgo/internal/consts" - "hotgo/utility/tree" + "github.com/gogf/gf/v2/text/gstr" ) // TenantRelation 租户关系 @@ -23,8 +26,9 @@ type TenantRelation struct { // GetTenantRelation 获取租户关系 func GetTenantRelation(ctx context.Context, memberId int64) (tr *TenantRelation, err error) { - data, err := g.Model("hg_admin_member u").Ctx(ctx). - LeftJoin("hg_admin_dept d", "u.dept_id=d.id"). + + data, err := g.Model(gstr.Join([]string{dao.AdminMember.Table(), "u"}, " ")).Ctx(ctx). + LeftJoin(gstr.Join([]string{dao.AdminDept.Table(), "d"}, " "), "u.dept_id=d.id"). Fields("u.tree,d.type"). Where("u.id", memberId).One() if err != nil { @@ -39,8 +43,8 @@ func GetTenantRelation(ctx context.Context, memberId int64) (tr *TenantRelation, ids := tree.GetIds(data["tree"].String()) getRelationId := func(deptType string) (int64, error) { - id, err := g.Model("hg_admin_member u").Ctx(ctx). - LeftJoin("hg_admin_dept d", "u.dept_id=d.id"). + id, err := g.Model(gstr.Join([]string{dao.AdminMember.Table(), "u"}, " ")).Ctx(ctx). + LeftJoin(gstr.Join([]string{dao.AdminDept.Table(), "d"}, " "), "u.dept_id=d.id"). Fields("u.id"). WhereIn("u.id", ids).Where("d.type", deptType). OrderAsc("u.level"). // 确保是第一关系 @@ -85,7 +89,7 @@ func GetTenantRelation(ctx context.Context, memberId int64) (tr *TenantRelation, } tr.UserId = memberId default: - err = gerror.Newf("未找到用户[%]的租户关系,部门类型[%v] 无效", memberId, tr.DeptType) + err = gerror.Newf("未找到用户[%v]的租户关系,部门类型[%v] 无效", memberId, tr.DeptType) return nil, err } return diff --git a/server/internal/library/location/location.go b/server/internal/library/location/location.go index 79839fa..f5bb91e 100644 --- a/server/internal/library/location/location.go +++ b/server/internal/library/location/location.go @@ -8,6 +8,13 @@ package location import ( "context" "fmt" + "hotgo/utility/validate" + "io" + "net" + "net/http" + "strings" + "time" + "github.com/gogf/gf/v2/encoding/gcharset" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" @@ -15,12 +22,6 @@ import ( "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" "github.com/kayon/iploc" - "hotgo/utility/validate" - "io" - "net" - "net/http" - "strings" - "time" ) const ( @@ -72,7 +73,7 @@ func WhoisLocation(ctx context.Context, ip string, retry ...int64) (*IpLocationD // 利用重试机制缓解高并发情况下限流的影响 // 毕竟这是一个免费的接口,如果你对IP归属地定位要求毕竟高,可以考虑换个付费接口 - if response.StatusCode != 200 { + if response.StatusCode != http.StatusOK { retryCount := defaultRetry if len(retry) > 0 { retryCount = retry[0] diff --git a/server/internal/library/queue/rocketmq.go b/server/internal/library/queue/rocketmq.go index ab77cce..6a23ef2 100644 --- a/server/internal/library/queue/rocketmq.go +++ b/server/internal/library/queue/rocketmq.go @@ -7,6 +7,12 @@ package queue import ( "context" + "hotgo/internal/consts" + "hotgo/utility/simple" + "hotgo/utility/validate" + "sync" + "time" + "github.com/apache/rocketmq-client-go/v2" "github.com/apache/rocketmq-client-go/v2/admin" "github.com/apache/rocketmq-client-go/v2/consumer" @@ -16,11 +22,6 @@ import ( "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/grpool" - "hotgo/internal/consts" - "hotgo/utility/simple" - "hotgo/utility/validate" - "sync" - "time" ) type RocketMq struct { @@ -191,7 +192,7 @@ func (r *RocketMq) ListenReceiveMsgDo(topic string, receiveDo func(mqMsg MqMsg)) err = r.consumerIns.Subscribe(topic, consumer.MessageSelector{}, func(ctx context.Context, msgs ...*primitive.MessageExt) (consumer.ConsumeResult, error) { for _, item := range msgs { - rocketManager.goPool.Add(ctx, func(ctx context.Context) { + _ = rocketManager.goPool.Add(ctx, func(ctx context.Context) { receiveDo(MqMsg{ RunType: ReceiveMsg, Topic: item.Topic, diff --git a/server/internal/logic/admin/site.go b/server/internal/logic/admin/site.go index d22948c..519ea76 100644 --- a/server/internal/logic/admin/site.go +++ b/server/internal/logic/admin/site.go @@ -7,12 +7,6 @@ package admin import ( "context" - "github.com/gogf/gf/v2/crypto/gmd5" - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/util/grand" "hotgo/internal/consts" "hotgo/internal/dao" "hotgo/internal/library/contexts" @@ -23,6 +17,13 @@ import ( "hotgo/internal/model/input/sysin" "hotgo/internal/service" "hotgo/utility/simple" + + "github.com/gogf/gf/v2/crypto/gmd5" + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/grand" ) type sAdminSite struct{} @@ -292,8 +293,8 @@ func (s *sAdminSite) getLoginRoleAndDept(ctx context.Context, roleId, deptId int // BindUserContext 绑定用户上下文 func (s *sAdminSite) BindUserContext(ctx context.Context, claims *model.Identity) (err error) { //// 如果不想每次访问都重新加载用户信息,可以放开注释。但在本次登录未失效前,用户信息不会刷新 - //contexts.SetUser(ctx, claims) - //return + // contexts.SetUser(ctx, claims) + // return var mb *entity.AdminMember if err = dao.AdminMember.Ctx(ctx).WherePri(claims.Id).Scan(&mb); err != nil { diff --git a/server/internal/logic/sys/config.go b/server/internal/logic/sys/config.go index 8d173b3..e2eb290 100644 --- a/server/internal/logic/sys/config.go +++ b/server/internal/logic/sys/config.go @@ -8,12 +8,6 @@ package sys import ( "context" "fmt" - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/database/gredis" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/util/gconv" "hotgo/internal/consts" "hotgo/internal/dao" "hotgo/internal/global" @@ -27,6 +21,13 @@ import ( "hotgo/internal/model/input/sysin" "hotgo/internal/service" "hotgo/utility/simple" + + "github.com/gogf/gf/v2/database/gdb" + "github.com/gogf/gf/v2/database/gredis" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/util/gconv" ) type sSysConfig struct{} @@ -292,26 +293,27 @@ func (s *sSysConfig) getConfigByKey(key string, models []*entity.SysConfig) *ent // syncUpdate 同步更新一些加载配置 func (s *sSysConfig) syncUpdate(ctx context.Context, in *sysin.UpdateConfigInp) (err error) { + var cfg any switch in.Group { case "wechat": - wx, err := s.GetWechat(ctx) + cfg, err = s.GetWechat(ctx) if err == nil { - wechat.SetConfig(wx) + wechat.SetConfig(cfg.(*model.WechatConfig)) } case "pay": - pay, err := s.GetPay(ctx) + cfg, err = s.GetPay(ctx) if err == nil { - payment.SetConfig(pay) + payment.SetConfig(cfg.(*model.PayConfig)) } case "upload": - upload, err := s.GetUpload(ctx) + cfg, err = s.GetUpload(ctx) if err == nil { - storager.SetConfig(upload) + storager.SetConfig(cfg.(*model.UploadConfig)) } case "sms": - sm, err := s.GetSms(ctx) + cfg, err = s.GetSms(ctx) if err == nil { - sms.SetConfig(sm) + sms.SetConfig(cfg.(*model.SmsConfig)) } } diff --git a/server/internal/logic/sys/curd_demo.go b/server/internal/logic/sys/curd_demo.go index 3f601b4..72c8828 100644 --- a/server/internal/logic/sys/curd_demo.go +++ b/server/internal/logic/sys/curd_demo.go @@ -145,7 +145,6 @@ func (s *sSysCurdDemo) Export(ctx context.Context, in *sysin.CurdDemoListInp) (e // Edit 修改/新增CURD列表 func (s *sSysCurdDemo) Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err error) { return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { - // 修改 if in.Id > 0 { in.UpdatedBy = contexts.GetUserId(ctx) @@ -170,7 +169,6 @@ func (s *sSysCurdDemo) Edit(ctx context.Context, in *sysin.CurdDemoEditInp) (err // Delete 删除CURD列表 func (s *sSysCurdDemo) Delete(ctx context.Context, in *sysin.CurdDemoDeleteInp) (err error) { - if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil { err = gerror.Wrap(err, "删除CURD列表失败,请稍后重试!") return diff --git a/server/internal/logic/sys/test_category.go b/server/internal/logic/sys/test_category.go index aedf8a4..31dbf68 100644 --- a/server/internal/logic/sys/test_category.go +++ b/server/internal/logic/sys/test_category.go @@ -84,7 +84,6 @@ func (s *sSysTestCategory) List(ctx context.Context, in *sysin.TestCategoryListI // Edit 修改/新增测试分类 func (s *sSysTestCategory) Edit(ctx context.Context, in *sysin.TestCategoryEditInp) (err error) { return g.DB().Transaction(ctx, func(ctx context.Context, tx gdb.TX) (err error) { - // 修改 if in.Id > 0 { if _, err = s.Model(ctx). @@ -107,7 +106,6 @@ func (s *sSysTestCategory) Edit(ctx context.Context, in *sysin.TestCategoryEditI // Delete 删除测试分类 func (s *sSysTestCategory) Delete(ctx context.Context, in *sysin.TestCategoryDeleteInp) (err error) { - if _, err = s.Model(ctx).WherePri(in.Id).Delete(); err != nil { err = gerror.Wrap(err, "删除测试分类失败,请稍后重试!") return diff --git a/server/storage/data/hotgo.sql b/server/storage/data/hotgo.sql index e74c9a3..1b936a9 100644 --- a/server/storage/data/hotgo.sql +++ b/server/storage/data/hotgo.sql @@ -303,7 +303,7 @@ CREATE TABLE IF NOT EXISTS `hg_admin_menu` ( `id` bigint(20) NOT NULL COMMENT '菜单ID', `pid` bigint(20) DEFAULT '0' COMMENT '父菜单ID', `level` int(11) NOT NULL DEFAULT '1' COMMENT '关系树等级', - `tree` varchar(255) NOT NULL COMMENT '关系树', + `tree` varchar(255) NOT NULL DEFAULT '' COMMENT '关系树', `title` varchar(64) NOT NULL COMMENT '菜单名称', `name` varchar(128) NOT NULL COMMENT '名称编码', `path` varchar(200) DEFAULT NULL COMMENT '路由地址', diff --git a/web/src/views/login/login/form.vue b/web/src/views/login/login/form.vue index eb09267..81ea181 100644 --- a/web/src/views/login/login/form.vue +++ b/web/src/views/login/login/form.vue @@ -9,7 +9,7 @@