style: 格式整理

This commit is contained in:
mh-swift 2024-07-09 17:21:32 +08:00
parent e501a33163
commit 5c3bcaf6cc
9 changed files with 33 additions and 36 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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 的执行时长主要取决于需要生成数据库表的数量,表越多速度越慢

View File

@ -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
}

View File

@ -33,5 +33,4 @@ func AddLineNo(s string) string {
bf.WriteString(strings.Repeat(" ", maxLineNoStrLen-len(lineNoStr)) + lineNoStr + " " + line)
}
return bf.String()
}

View File

@ -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 = `</` + fMustCompile(parent.startTagRaw) + `>` //string(tokenizer.Raw())
parent.endTagRaw = `</` + fMustCompile(parent.startTagRaw) + `>` // string(tokenizer.Raw())
return ""
}
return tagName

View File

@ -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 {

View File

@ -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

View File

@ -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