Merge branch 'master' of github.com:lanyulei/ferry

This commit is contained in:
lanyulei 2024-02-26 10:23:19 +08:00
commit 57d37a2096
20 changed files with 544 additions and 8915 deletions

View File

@ -11,7 +11,7 @@ import (
"strings"
"github.com/gin-gonic/gin"
uuid "github.com/satori/go.uuid"
uuid "github.com/google/uuid"
"github.com/spf13/viper"
)
@ -116,7 +116,7 @@ func CreateTask(c *gin.Context) {
return
}
uuidValue := uuid.Must(uuid.NewV4(), err)
uuidValue := uuid.Must(uuid.New(), err)
fileName := fmt.Sprintf("%v/%v-%v-%v",
viper.GetString("script.path"),
taskValue.Name,

View File

@ -103,10 +103,10 @@ func run() error {
tools.GetCurrntTimeStr(),
config2.ApplicationConfig.Host,
config2.ApplicationConfig.Port)
fmt.Printf("%s Swagger URL http://%s:%s/swagger/index.html \r\n",
tools.GetCurrntTimeStr(),
config2.ApplicationConfig.Host,
config2.ApplicationConfig.Port)
//fmt.Printf("%s Swagger URL http://%s:%s/swagger/index.html \r\n",
// tools.GetCurrntTimeStr(),
// config2.ApplicationConfig.Host,
// config2.ApplicationConfig.Port)
fmt.Printf("%s Enter Control + C Shutdown Server \r\n", tools.GetCurrntTimeStr())
// 等待中断信号以优雅地关闭服务器(设置 5 秒的超时时间)
quit := make(chan os.Signal)

View File

@ -14,9 +14,9 @@ settings:
dbtype: mysql
host: 127.0.0.1
name: ferry
password: your password
password: 123456
port: 3306
username: ferry
username: root
domain:
gethost: 1
url: localhost:9527
@ -55,7 +55,7 @@ settings:
public:
islocation: 0
redis:
url: redis://127.0.0.1:6379
url: redis://:123456@127.0.0.1:6379
ssl:
key: keystring
pem: temp/pem.pem

View File

@ -1,15 +0,0 @@
// +build sqlite3
package database
import (
_ "github.com/jinzhu/gorm/dialects/sqlite"
)
type SqlLite struct {
}
func (*SqlLite) Open(dbType string, conn string) (db *gorm.DB, err error) {
eloquent, err := gorm.Open(dbType, conn)
return eloquent, err
}

View File

@ -1 +0,0 @@
theme: jekyll-theme-cayman

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
# 目录
* [介绍](https://lanyulei.github.io/ferry/document/introduction "介绍")
* [安装](https://lanyulei.github.io/ferry/document/install "安装")
* [IDE 开发](https://lanyulei.github.io/ferry/document/ide_development "IDE 开发")
* [系统管理](https://lanyulei.github.io/ferry/document/system_manager "系统管理")
* 工单系统
* * [创建一个新流程](https://lanyulei.github.io/ferry/document/new_process "创建一个新流程")
* * [催办](https://lanyulei.github.io/ferry/document/urge "催办")
* * [转交](https://lanyulei.github.io/ferry/document/forward "转交")
* * [结单](https://lanyulei.github.io/ferry/document/end_process "结单")
* * [排他网关](https://lanyulei.github.io/ferry/document/exclusive_gateway "排他网关")
* * [并行网关](https://lanyulei.github.io/ferry/document/parallel_gateway "并行网关")
* * [会签](https://lanyulei.github.io/ferry/document/countersign "会签")
* [Mac、Linux、Windows下分别进行交叉编译](https://lanyulei.github.io/ferry/document/cross_compile "Mac、Linux、Windows下分别进行交叉编译")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

193
go.mod
View File

@ -1,122 +1,125 @@
module ferry
go 1.18
go 1.20
require (
github.com/RichardKnop/machinery v1.8.8
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/casbin/casbin/v2 v2.2.1
github.com/casbin/gorm-adapter/v2 v2.0.3
github.com/gin-gonic/gin v1.7.0
github.com/go-kit/kit v0.8.0
github.com/go-ldap/ldap/v3 v3.2.3
github.com/go-sql-driver/mysql v1.5.0
github.com/RichardKnop/machinery v1.10.6
github.com/casbin/casbin/v2 v2.79.0
github.com/casbin/gorm-adapter/v2 v2.1.0
github.com/gin-gonic/gin v1.9.1
github.com/go-kit/kit v0.13.0
github.com/go-ldap/ldap/v3 v3.4.6
github.com/go-sql-driver/mysql v1.7.1
github.com/golang-jwt/jwt v3.2.2+incompatible
github.com/google/uuid v1.1.1
github.com/jinzhu/gorm v1.9.10
github.com/mojocn/base64Captcha v1.3.1
github.com/mssola/user_agent v0.5.1
github.com/google/uuid v1.4.0
github.com/jinzhu/gorm v1.9.16
github.com/mojocn/base64Captcha v1.3.5
github.com/mssola/user_agent v0.6.0
github.com/pkg/errors v0.9.1
github.com/robfig/cron/v3 v3.0.1
github.com/satori/go.uuid v1.2.0
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.6.2
github.com/swaggo/gin-swagger v1.2.0
github.com/swaggo/swag v1.6.5
github.com/unrolled/secure v1.0.8
go.uber.org/zap v1.10.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/text v0.3.5
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.17.0
github.com/unrolled/secure v1.13.0
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.16.0
golang.org/x/text v0.14.0
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)
require (
cloud.google.com/go v0.60.0 // indirect
cloud.google.com/go/pubsub v1.4.0 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible // indirect
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
cloud.google.com/go v0.110.7 // indirect
cloud.google.com/go/compute v1.23.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
cloud.google.com/go/pubsub v1.33.0 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect
github.com/RichardKnop/redsync v1.2.0 // indirect
github.com/aws/aws-sdk-go v1.34.28 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/bytedance/sonic v1.9.1 // indirect
github.com/casbin/govaluate v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.2 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.1 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-openapi/jsonpointer v0.19.3 // indirect
github.com/go-openapi/jsonreference v0.19.3 // indirect
github.com/go-openapi/spec v0.19.7 // indirect
github.com/go-openapi/swag v0.19.8 // indirect
github.com/go-playground/locales v0.13.0 // indirect
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/go-redis/redis v6.15.8+incompatible // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.14.0 // indirect
github.com/go-redis/redis/v8 v8.6.0 // indirect
github.com/go-redsync/redsync/v4 v4.0.4 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.4.2 // indirect
github.com/golang/snappy v0.0.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/go-cmp v0.5.2 // indirect
github.com/googleapis/gax-go/v2 v2.0.5 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.1 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/jstemmer/go-junit-report v0.9.1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/klauspost/compress v1.10.10 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/lib/pq v1.1.1 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mailru/easyjson v0.7.1 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-sqlite3 v1.10.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pelletier/go-toml v1.7.0 // indirect
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.3.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/streadway/amqp v1.0.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.mongodb.org/mongo-driver v1.5.1 // indirect
go.opencensus.io v0.22.4 // indirect
go.uber.org/atomic v1.4.0 // indirect
go.uber.org/multierr v1.1.0 // indirect
golang.org/x/image v0.0.0-20190802002840-cff245a6509b // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/mod v0.3.0 // indirect
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d // indirect
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 // indirect
golang.org/x/sys v0.0.0-20220422013727-9388b58f7150 // indirect
golang.org/x/tools v0.0.0-20200630154851-b2d8b0336632 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
google.golang.org/api v0.28.0 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200626011028-ee7919e894b5 // indirect
google.golang.org/grpc v1.30.0 // indirect
google.golang.org/protobuf v1.25.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c // indirect
github.com/xdg/stringprep v1.0.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
go.mongodb.org/mongo-driver v1.4.6 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v0.17.0 // indirect
go.opentelemetry.io/otel/metric v0.17.0 // indirect
go.opentelemetry.io/otel/trace v0.17.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/image v0.1.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/oauth2 v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.15.0 // indirect
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/grpc v1.58.2 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.51.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

769
go.sum

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +0,0 @@
package handler
import (
jwt "ferry/pkg/jwtauth"
"ferry/pkg/logger"
"net/http"
"github.com/gin-gonic/gin"
)
func NoFound(c *gin.Context) {
claims := jwt.ExtractClaims(c)
logger.Infof("NoRoute claims: %#v\n", claims)
c.JSON(http.StatusOK, gin.H{
"code": "404",
"message": "not found",
})
}

View File

@ -1,165 +0,0 @@
package sd
import (
"ferry/tools/app"
"fmt"
"net/http"
"runtime"
"time"
"github.com/gin-gonic/gin"
"github.com/shirou/gopsutil/cpu"
"github.com/shirou/gopsutil/disk"
"github.com/shirou/gopsutil/load"
"github.com/shirou/gopsutil/mem"
)
const (
B = 1
KB = 1024 * B
MB = 1024 * KB
GB = 1024 * MB
)
// 健康状况
// @Summary 健康状况 HealthCheck shows OK as the ping-pong result.
// @Description 健康状况
// @Accept text/html
// @Produce text/html
// @Success 200 {string} string "OK"
// @Router /sd/health [get]
// @BasePath
func HealthCheck(c *gin.Context) {
app.OK(c, "", "OK")
}
// @Summary 服务器硬盘使用量
// @Description 服务器硬盘使用量 DiskCheck checks the disk usage.
// @Accept text/html
// @Produce text/html
// @Success 200 {string} string "OK - Free space: 16321MB (15GB) / 51200MB (50GB) | Used: 31%"
// @Failure 500 {string} string "CRITICAL"
// @Failure 429 {string} string "WARNING"
// @Router /sd/disk [get]
// @BasePath
func DiskCheck(c *gin.Context) {
u, _ := disk.Usage("/")
usedMB := int(u.Used) / MB
usedGB := int(u.Used) / GB
totalMB := int(u.Total) / MB
totalGB := int(u.Total) / GB
usedPercent := int(u.UsedPercent)
status := http.StatusOK
text := "OK"
if usedPercent >= 95 {
status = http.StatusOK
text = "CRITICAL"
} else if usedPercent >= 90 {
status = http.StatusTooManyRequests
text = "WARNING"
}
message := fmt.Sprintf("%s - Free space: %dMB (%dGB) / %dMB (%dGB) | Used: %d%%", text, usedMB, usedGB, totalMB, totalGB, usedPercent)
c.String(status, "\n"+message)
}
// @Summary OS
// @Description Os
// @Accept text/html
// @Produce text/html
// @Success 200 {string} string ""
// @Router /sd/os [get]
// @BasePath
func OSCheck(c *gin.Context) {
status := http.StatusOK
app.Custum(c, gin.H{
"code": 200,
"status": status,
"goOs": runtime.GOOS,
"compiler": runtime.Compiler,
"numCpu": runtime.NumCPU(),
"version": runtime.Version(),
"numGoroutine": runtime.NumGoroutine(),
})
}
// @Summary CPU 使用量
// @Description CPU 使用量 DiskCheck checks the disk usage.
// @Accept text/html
// @Produce text/html
// @Success 200 {string} string ""
// @Router /sd/cpu [get]
// @BasePath
func CPUCheck(c *gin.Context) {
cores, _ := cpu.Counts(false)
cpus, err := cpu.Percent(time.Duration(200)*time.Millisecond, true)
if err == nil {
for i, c := range cpus {
fmt.Printf("cpu%d : %f%%\n", i, c)
}
}
a, _ := load.Avg()
l1 := a.Load1
l5 := a.Load5
l15 := a.Load15
status := http.StatusOK
text := "OK"
if l5 >= float64(cores-1) {
status = http.StatusInternalServerError
text = "CRITICAL"
} else if l5 >= float64(cores-2) {
status = http.StatusTooManyRequests
text = "WARNING"
}
app.Custum(c, gin.H{
"code": 200,
"msg": text,
"status": status,
"cores": cores,
"load1": l1,
"load5": l5,
"load15": l15,
})
}
// @Summary 内存使用量
// @Description 内存使用量 RAMCheck checks the disk usage.
// @Accept text/html
// @Produce text/html
// @Success 200 {string} string ""
// @Router /sd/ram [get]
// @BasePath
func RAMCheck(c *gin.Context) {
u, _ := mem.VirtualMemory()
usedMB := int(u.Used) / MB
totalMB := int(u.Total) / MB
usedPercent := int(u.UsedPercent)
status := http.StatusOK
text := "OK"
if usedPercent >= 95 {
status = http.StatusInternalServerError
text = "CRITICAL"
} else if usedPercent >= 90 {
status = http.StatusTooManyRequests
text = "WARNING"
}
app.Custum(c, gin.H{
"code": 200,
"msg": text,
"status": status,
"used": usedMB,
"total": totalMB,
"usedPercent": usedPercent,
})
}

View File

@ -2,7 +2,7 @@ package middleware
import (
"github.com/gin-gonic/gin"
"github.com/satori/go.uuid"
"github.com/google/uuid"
)
func RequestId() gin.HandlerFunc {
@ -12,8 +12,7 @@ func RequestId() gin.HandlerFunc {
// Create request id with UUID4
if requestId == "" {
u4 := uuid.NewV4()
requestId = u4.String()
requestId = uuid.NewString()
}
// Expose it for use in the application

View File

@ -2,7 +2,6 @@ package system
import (
"ferry/global/orm"
config2 "ferry/tools/config"
"fmt"
"io/ioutil"
"strings"
@ -14,10 +13,6 @@ import (
func InitDb() error {
filePath := "config/db.sql"
if config2.DatabaseConfig.Dbtype == "sqlite3" {
fmt.Println("sqlite3数据库无需初始化")
return nil
}
sql, err := Ioutil(filePath)
if err != nil {
fmt.Println("数据库基础数据初始化脚本读取失败!原因:", err.Error())

View File

@ -1,20 +0,0 @@
package cronjob
import (
"ferry/pkg/logger"
"github.com/robfig/cron/v3"
)
func TestJob(c *cron.Cron) {
id, err := c.AddFunc("1 * * * *", func() {
logger.Info("Every hour on the one hour")
})
if err != nil {
logger.Info(err)
logger.Info("start error")
} else {
logger.Infof("Start Success; ID: %v \r\n", id)
}
}

View File

@ -7,9 +7,6 @@ import (
"ferry/router/process"
systemRouter "ferry/router/system"
ginSwagger "github.com/swaggo/gin-swagger"
"github.com/swaggo/gin-swagger/swaggerFiles"
"github.com/gin-gonic/gin"
_ "github.com/gin-gonic/gin"
)
@ -23,7 +20,7 @@ func InitSysRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddleware) *gin
sysStaticFileRouter(g, r)
// swagger注意生产环境可以注释掉
sysSwaggerRouter(g)
//sysSwaggerRouter(g)
// 无需认证
systemRouter.SysNoCheckRoleRouter(g)
@ -39,9 +36,9 @@ func sysStaticFileRouter(r *gin.RouterGroup, g *gin.Engine) {
g.LoadHTMLGlob("template/web/index.html")
}
func sysSwaggerRouter(r *gin.RouterGroup) {
r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
}
//func sysSwaggerRouter(r *gin.RouterGroup) {
// r.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
//}
func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwtauth.GinJWTMiddleware) {
r.POST("/login", authMiddleware.LoginHandler)

View File

@ -5,7 +5,6 @@ import (
"ferry/apis/monitor"
"ferry/apis/public"
"ferry/apis/system"
_ "ferry/docs"
"ferry/handler"
"ferry/middleware"
jwt "ferry/pkg/jwtauth"

View File

@ -1,8 +1,6 @@
package captcha
import (
"image/color"
"github.com/google/uuid"
"github.com/mojocn/base64Captcha"
)
@ -21,20 +19,11 @@ type configJsonBody struct {
DriverDigit *base64Captcha.DriverDigit
}
func DriverStringFunc() (id, b64s string, err error) {
e := configJsonBody{}
e.Id = uuid.New().String()
e.DriverString = base64Captcha.NewDriverString(46, 140, 2, 2, 4, "234567890abcdefghjkmnpqrstuvwxyz", &color.RGBA{240, 240, 246, 246}, []string{"wqy-microhei.ttc"})
driver := e.DriverString.ConvertFonts()
cap := base64Captcha.NewCaptcha(driver, store)
return cap.Generate()
}
func DriverDigitFunc() (id, b64s string, err error) {
e := configJsonBody{}
e.Id = uuid.New().String()
e.DriverDigit = base64Captcha.NewDriverDigit(80, 240, 4, 0.7, 80)
driver := e.DriverDigit
cap := base64Captcha.NewCaptcha(driver, store)
return cap.Generate()
captcha := base64Captcha.NewCaptcha(driver, store)
return captcha.Generate()
}

View File

@ -9,5 +9,4 @@ const (
ModeTest Mode = "test" //测试模式
ModeProd Mode = "prod" //生产模式
Mysql = "mysql" //mysql数据库标识
Sqlite = "sqlite" //sqlite
)