Compare commits
11 Commits
f9b029bcc1
...
2107603a09
Author | SHA1 | Date | |
---|---|---|---|
2107603a09 | |||
![]() |
57d37a2096 | ||
![]() |
0bfcfe8638 | ||
![]() |
197114a4e0 | ||
![]() |
c9daf3fc54 | ||
![]() |
829dc3a4ec | ||
![]() |
a3de8eea4e | ||
![]() |
725f8d8825 | ||
![]() |
1d194e6e0d | ||
![]() |
1de9c1fa5c | ||
![]() |
45e658f07b |
2
Makefile
2
Makefile
@ -2,7 +2,7 @@ PROJECT:=ferry
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
CGO_ENABLED=0 go build -o ferry main.go
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o ferry main.go && upx -9 ferry
|
||||
build-sqlite:
|
||||
go build -tags sqlite3 -o ferry main.go
|
||||
#.PHONY: test
|
||||
|
10
README.md
10
README.md
@ -17,6 +17,10 @@
|
||||
|
||||
## 基于Gin + Vue + Element UI前后端分离的工单系统
|
||||
|
||||
新版工单演示地址(非开源):[http://fdevops.com:8000](http://fdevops.com:8000)
|
||||
|
||||
账号密码:lanyulei / lanyulei
|
||||
|
||||
**流程中心**
|
||||
|
||||
通过灵活的配置流程、模版等数据,非常快速方便的生成工单流程,通过对流程进行任务绑定,实现流程中的钩子操作,目前支持绑定邮件来通知处理,当然为兼容更多的通知方式,也可以自己写任务脚本来进行任务通知,可根据自己的需求定制。
|
||||
@ -45,8 +49,6 @@
|
||||
* ferry工单系统需要的软件准备 https://www.bilibili.com/video/BV1sA411s7jE
|
||||
* ferry源代码下载后第一次运行 https://www.bilibili.com/video/BV1oy4y1v7LR
|
||||
|
||||
官网:[http://ferry.fdevops.com](http://ferry.fdevops.com)
|
||||
|
||||
```
|
||||
需注意,因有人恶意删除演示数据,将可删除的数据全都删除了,因此演示的Demo上已经将删除操作的隐藏了。
|
||||
|
||||
@ -100,10 +102,10 @@ bash build.sh start
|
||||
群里只要不说骂人、侮辱人之类人身攻击的话,您就可以畅所欲言,有bug我及时修改,使用中有不懂的,我会及时回复,感谢。
|
||||
|
||||
<p>
|
||||
<img width="300" src="https://www.fdevops.com/wp-content/uploads/2022/10/1667027272-WechatIMG201.jpeg">
|
||||
<img width="300" src="https://www.fdevops.com/wp-content/uploads/2024/02/1708914069-WechatIMG84.jpg">
|
||||
</p>
|
||||
|
||||
QQ群 4:493389089
|
||||
QQ群 5:361011819
|
||||
|
||||
[兰玉磊的技术博客](https://www.fdevops.com/)
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -1,61 +1,61 @@
|
||||
script:
|
||||
path: ./static/scripts
|
||||
path: ./static/scripts
|
||||
settings:
|
||||
application:
|
||||
domain: localhost:8002
|
||||
host: 0.0.0.0
|
||||
ishttps: false
|
||||
mode: dev
|
||||
name: ferry-test
|
||||
port: "8002"
|
||||
readtimeout: 1
|
||||
writertimeout: 2
|
||||
database:
|
||||
dbtype: mysql
|
||||
host: 127.0.0.1
|
||||
name: ferry
|
||||
password: your password
|
||||
port: 3306
|
||||
username: ferry
|
||||
domain:
|
||||
gethost: 1
|
||||
url: localhost:9527
|
||||
email:
|
||||
alias: ferry
|
||||
host: smtp.163.com
|
||||
pass: your password
|
||||
port: 465
|
||||
user: fdevops@163.com
|
||||
gorm:
|
||||
logmode: 0
|
||||
maxidleconn: 0
|
||||
maxopenconn: 20000
|
||||
jwt:
|
||||
secret: ferry
|
||||
timeout: 86400
|
||||
ldap:
|
||||
anonymousquery: 0
|
||||
basedn: dc=fdevops,dc=com
|
||||
bindpwd: 123456
|
||||
binduserdn: cn=admin,dc=fdevops,dc=com
|
||||
host: localhost
|
||||
port: 389
|
||||
tls: 0
|
||||
userfield: uid
|
||||
log:
|
||||
compress: 1
|
||||
consolestdout: 1
|
||||
filestdout: 0
|
||||
level: debug
|
||||
localtime: 1
|
||||
maxage: 30
|
||||
maxbackups: 300
|
||||
maxsize: 10240
|
||||
path: ./logs/ferry.log
|
||||
public:
|
||||
islocation: 0
|
||||
redis:
|
||||
url: redis://127.0.0.1:6379
|
||||
ssl:
|
||||
key: keystring
|
||||
pem: temp/pem.pem
|
||||
application:
|
||||
domain: localhost:8002
|
||||
host: 0.0.0.0
|
||||
ishttps: false
|
||||
mode: dev
|
||||
name: ferry-test
|
||||
port: "8002"
|
||||
readtimeout: 1
|
||||
writertimeout: 2
|
||||
database:
|
||||
dbtype: mysql
|
||||
host: 127.0.0.1
|
||||
name: ferry
|
||||
password: root
|
||||
port: 3306
|
||||
username: root
|
||||
domain:
|
||||
gethost: 1
|
||||
url: localhost:9527
|
||||
email:
|
||||
alias: ferry
|
||||
host: smtp.163.com
|
||||
pass: your password
|
||||
port: 465
|
||||
user: fdevops@163.com
|
||||
gorm:
|
||||
logmode: 0
|
||||
maxidleconn: 0
|
||||
maxopenconn: 20000
|
||||
jwt:
|
||||
secret: ferry
|
||||
timeout: 86400
|
||||
ldap:
|
||||
anonymousquery: 0
|
||||
basedn: dc=fdevops,dc=com
|
||||
bindpwd: 123456
|
||||
binduserdn: cn=admin,dc=fdevops,dc=com
|
||||
host: localhost
|
||||
port: 389
|
||||
tls: 0
|
||||
userfield: uid
|
||||
log:
|
||||
compress: 1
|
||||
consolestdout: 1
|
||||
filestdout: 0
|
||||
level: debug
|
||||
localtime: 1
|
||||
maxage: 30
|
||||
maxbackups: 300
|
||||
maxsize: 10240
|
||||
path: ./logs/ferry.log
|
||||
public:
|
||||
islocation: 0
|
||||
redis:
|
||||
url: redis://:127.0.0.1:6379
|
||||
ssl:
|
||||
key: keystring
|
||||
pem: temp/pem.pem
|
||||
|
@ -12,9 +12,9 @@ settings:
|
||||
writertimeout: 2
|
||||
database:
|
||||
dbtype: mysql
|
||||
host: ferry_mysql
|
||||
host: 127.0.0.1
|
||||
name: ferry
|
||||
password: 123456
|
||||
password: root
|
||||
port: 3306
|
||||
username: root
|
||||
domain:
|
||||
@ -55,7 +55,7 @@ settings:
|
||||
public:
|
||||
islocation: 0
|
||||
redis:
|
||||
url: redis://ferry_redis:6379
|
||||
url: redis://:127.0.0.1:6379
|
||||
ssl:
|
||||
key: keystring
|
||||
pem: temp/pem.pem
|
||||
|
@ -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
|
||||
}
|
@ -1 +0,0 @@
|
||||
theme: jekyll-theme-cayman
|
3135
docs/docs.go
3135
docs/docs.go
File diff suppressed because it is too large
Load Diff
@ -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下分别进行交叉编译")
|
3070
docs/swagger.json
3070
docs/swagger.json
File diff suppressed because it is too large
Load Diff
1992
docs/swagger.yaml
1992
docs/swagger.yaml
File diff suppressed because it is too large
Load Diff
193
go.mod
193
go.mod
@ -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
|
||||
)
|
||||
|
@ -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",
|
||||
})
|
||||
}
|
@ -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,
|
||||
})
|
||||
}
|
@ -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
|
||||
|
@ -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())
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
@ -55,14 +55,19 @@ func (s *Statistics) DateRangeStatistics() (statisticsData map[string][]interfac
|
||||
|
||||
for i := 0; i < TimeDifference; i++ {
|
||||
if i == 0 {
|
||||
sqlDataValue += "SELECT curdate() AS click_date UNION ALL"
|
||||
sqlDataValue += fmt.Sprintf("SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL 0 DAY ) AS click_date UNION ALL", endTime)
|
||||
} else if i == TimeDifference-1 {
|
||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub( curdate(), INTERVAL %d DAY ) AS click_date`, i)
|
||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL %d DAY ) AS click_date UNION ALL`, endTime, i)
|
||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL %d DAY ) AS click_date`, endTime, i + 1)
|
||||
} else {
|
||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub( curdate(), INTERVAL %d DAY ) AS click_date UNION ALL`, i)
|
||||
sqlDataValue += fmt.Sprintf(` SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL %d DAY ) AS click_date UNION ALL`, endTime, i)
|
||||
}
|
||||
}
|
||||
|
||||
if TimeDifference == 1 {
|
||||
sqlDataValue += fmt.Sprintf(" SELECT date_sub(date_format( '%s', '%%Y%%m%%d'), INTERVAL 1 DAY ) AS click_date",endTime)
|
||||
}
|
||||
|
||||
sqlValue = fmt.Sprintf(`SELECT
|
||||
a.click_date,
|
||||
ifnull( b.total, 0 ) AS total,
|
||||
|
@ -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)
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"ferry/apis/monitor"
|
||||
"ferry/apis/public"
|
||||
"ferry/apis/system"
|
||||
_ "ferry/docs"
|
||||
"ferry/handler"
|
||||
"ferry/middleware"
|
||||
jwt "ferry/pkg/jwtauth"
|
||||
|
@ -1,15 +1,13 @@
|
||||
package captcha
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/mojocn/base64Captcha"
|
||||
)
|
||||
|
||||
var store = base64Captcha.DefaultMemStore
|
||||
|
||||
//configJsonBody json request body.
|
||||
// configJsonBody json request body.
|
||||
type configJsonBody struct {
|
||||
Id string
|
||||
CaptchaType string
|
||||
@ -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()
|
||||
}
|
||||
|
@ -5,9 +5,8 @@ type (
|
||||
)
|
||||
|
||||
const (
|
||||
ModeDev Mode = "dev" //开发模式
|
||||
ModeTest Mode = "test" //测试模式
|
||||
ModeProd Mode = "prod" //生产模式
|
||||
Mysql = "mysql" //mysql数据库标识
|
||||
Sqlite = "sqlite" //sqlite
|
||||
ModeDev Mode = "dev" //开发模式
|
||||
ModeTest Mode = "test" //测试模式
|
||||
ModeProd Mode = "prod" //生产模式
|
||||
Mysql = "mysql" //mysql数据库标识
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user