Merge pull request #122 from swift-fs/v2.0-fix

golangci/hotgo.sql fix
This commit is contained in:
孟帅 2024-07-19 18:37:05 +08:00 committed by GitHub
commit b33591e8bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 123 additions and 104 deletions

View File

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

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

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

View File

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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

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

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

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

View File

@ -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 '路由地址',

View File

@ -9,7 +9,7 @@
<template v-if="mode === 'account'">
<n-form-item path="username">
<n-input
@keyup.enter="handleSubmit"
@keyup.enter="debounceHandleSubmit"
v-model:value="formInline.username"
placeholder="请输入用户名"
>
@ -22,7 +22,7 @@
</n-form-item>
<n-form-item path="pass">
<n-input
@keyup.enter="handleSubmit"
@keyup.enter="debounceHandleSubmit"
v-model:value="formInline.pass"
type="password"
show-password-on="click"
@ -41,7 +41,7 @@
<n-input
:style="{ width: '100%' }"
placeholder="验证码"
@keyup.enter="handleSubmit"
@keyup.enter="debounceHandleSubmit"
v-model:value="formInline.code"
>
<template #prefix>
@ -137,6 +137,7 @@
import { useSendCode } from '@/hooks/common';
import { SendSms } from '@/api/system/user';
import { validate } from '@/utils/validateUtil';
import { useDebounceFn } from '@vueuse/core';
interface Props {
mode: string;
@ -172,7 +173,9 @@
const { sendLabel, isCounting, loading: sendLoading, activateSend } = useSendCode();
const emit = defineEmits(['updateActiveModule']);
const LOGIN_NAME = PageEnum.BASE_LOGIN_NAME;
const debounceHandleSubmit = useDebounceFn((e) => {
handleSubmit(e);
}, 500);
const formInline = ref<FormState>({
username: '',
pass: '',
@ -274,7 +277,7 @@
function handleLogin(e) {
if (props.mode === 'account') {
handleSubmit(e);
debounceHandleSubmit(e);
return;
}