Commit ca1f3688 authored by 魏灿's avatar 魏灿

Merge remote-tracking branch 'origin/dev' into dev

parents 377d6b11 cd495bcc
......@@ -3,6 +3,7 @@ module gitlab.wodcloud.com/smart-operation/so-operation-api
go 1.19
require (
github.com/Luzifer/go-openssl/v4 v4.1.0
github.com/bytedance/go-tagexpr v2.7.4+incompatible
github.com/gin-gonic/gin v1.9.0
github.com/go-playground/locales v0.14.1
......@@ -13,13 +14,16 @@ require (
github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
github.com/lib/pq v1.10.9
github.com/minio/minio-go/v7 v7.0.58
github.com/mojocn/base64Captcha v1.3.5
github.com/pkg/errors v0.9.1
github.com/satori/go.uuid v1.2.0
github.com/spf13/cast v1.5.0
github.com/spf13/pflag v1.0.5
github.com/thoas/go-funk v0.9.3
github.com/valyala/fasthttp v1.47.0
go.uber.org/zap v1.24.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
k8s.io/apimachinery v0.27.3
xorm.io/xorm v1.3.2
)
......@@ -31,7 +35,8 @@ require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/golang/protobuf v1.5.0 // indirect
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/henrylee2cn/ameda v1.5.0 // indirect
github.com/henrylee2cn/goutil v0.0.0-20220704075712-42f2ec55fe8d // indirect
......@@ -57,11 +62,13 @@ require (
go.uber.org/multierr v1.6.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 // indirect
)
......@@ -5,6 +5,8 @@ gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0p
gitee.com/travelliu/dm v1.8.11192/go.mod h1:DHTzyhCrM843x9VdKVbZ+GKXGRbKM2sJ4LxihRxShkE=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
github.com/Luzifer/go-openssl/v4 v4.1.0 h1:8qi3Z6f8Aflwub/Cs4FVSmKUEg/lC8GlODbR2TyZ+nM=
github.com/Luzifer/go-openssl/v4 v4.1.0/go.mod h1:3i1T3Pe6eQK19d86WhuQzjLyMwBaNmGmt3ZceWpWVa4=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
......@@ -111,6 +113,8 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
......@@ -118,8 +122,9 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
......@@ -131,7 +136,7 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.7 h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
......@@ -306,6 +311,8 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mojocn/base64Captcha v1.3.5 h1:Qeilr7Ta6eDtG4S+tQuZ5+hO+QHbiGAJdi4PfoagaA0=
github.com/mojocn/base64Captcha v1.3.5/go.mod h1:/tTTXn4WTpX9CfrmipqRytCpJ27Uw3G6I7NcP2WwcmY=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
......@@ -322,8 +329,8 @@ github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:v
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E=
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
......@@ -379,6 +386,7 @@ github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThC
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
......@@ -474,6 +482,7 @@ golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
......@@ -481,6 +490,8 @@ golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75 h1:TbGuee8sSq15Iguxu4deQ7+Bqq/d2rsQejGcEtADAMQ=
golang.org/x/image v0.0.0-20190501045829-6d32002ffd75/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
......@@ -579,13 +590,12 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
golang.org/x/tools v0.0.0-20201124115921-2c860bdd6e78/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
......@@ -606,6 +616,7 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
......@@ -628,7 +639,6 @@ gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWD
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
......@@ -637,6 +647,8 @@ honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM=
k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E=
lukechampine.com/uint128 v1.1.1 h1:pnxCASz787iMf+02ssImqk6OLt+Z5QHMoZyUXR4z6JU=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
......@@ -747,6 +759,8 @@ modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.2.19/go.mod h1:+ZpP0pc4zz97eukOzW3xagV/lS82IpPN9NGG5pNF9vY=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo=
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=
sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978 h1:bvLlAPW1ZMTWA32LuZMBEGHAUOcATZjzHcotf3SWweM=
......
package entity
import "time"
//系统组织表
type SystemOrganization struct {
Id int64 `json:"id" xorm:"pk autoincr"` //id
OrganizationId string `json:"organization_id"` //组织id
Name string `json:"name"` //组织名称or目录名称
POrganizationId string `json:"p_organization_id"` //父级组织id
Description string `json:"description"` //组织介绍
OrganizationCode string `json:"organization_code"` //组织机构代码
Attachment string `json:"attachment"` //组织附件
Sort int64 `json:"sort"` //排序
DataType int64 `json:"data_type"` //数据类型(0目录 1组织)
CreatedTime time.Time `json:"created_time" xorm:"created"` //创建时间
UpdatedTime time.Time `json:"updated_time" xorm:"updated"` //更新时间
IsDeleted int64 `json:"is_deleted"` //是否删除0未删除 1已删除
CreatedBy string `json:"created_by"` //创建者
UpdatedBy string `json:"updated_by"` //更新者
Level int64 `json:"level"` //组织节点层级
}
package entity
import (
"time"
)
type SystemUser struct {
Id int `json:"id" xorm:"pk autoincr" ` // id
Name string `json:"name" ` // 名称
SystemAccount string `json:"system_account" ` // 账号
OrganizationId string `json:"organization_id" xorm:"organization_id"` // 所属组织
Password string `json:"password"` // 密码
State int `json:"state" xorm:"state"` // 状态0禁用1启用
Logo string `json:"logo" xorm:"logo"` // 头像logo
CreatedBy int `json:"created_by" ` // 创建者
CreatedTime time.Time `json:"created_time" xorm:"created" ` // 创建时间
UpdatedBy int `json:"updated_by" ` // 更新者
UpdatedTime time.Time `json:"updated_time" xorm:"updated" ` // 更新时间
IsDeleted int `json:"is_deleted" xorm:"is_deleted"` // 是否删除
}
type SystemUserInfo struct {
Id int `json:"id" xorm:"pk autoincr" ` // id
Name string `json:"name" ` // 名称
SystemAccount string `json:"system_account" ` // 账号
OrganizationId string `json:"organization_id" xorm:"organization_id"` // 所属组织
Password string `json:"password,omitempty"` // 密码
State int `json:"state" xorm:"state"` // 状态0禁用1启用
Logo string `json:"logo" xorm:"logo"` // 头像logo
IsDeleted int `json:"is_deleted" xorm:"is_deleted"` // 是否删除
}
package entity
type User struct {
Id string `json:"id" xorm:"id"` //uuid
UserId string `json:"user_id" xorm:"user_id"` //用户id
UserName string `json:"user_name" xorm:"user_name"` //用户名称
UserType int `json:"user_type" xorm:"user_type"` //用户类型
Phone string `json:"phone" xorm:"phone"` //联系电话
Email string `json:"email" xorm:"email"` //邮箱
UnitName string `json:"unit_name" xorm:"unit_name"` //迁移单位名称
CreatedBy string `json:"created_by" xorm:"created_by"` //创建人
CreatedAt string `json:"created_at" xorm:"created_at"` //创建时间
UpdatedBy string `json:"updated_by" xorm:"updated_by"` //更新人
UpdatedAt string `json:"updated_at" xorm:"updated_at"` //更新时间
Status int `json:"status" xorm:"status"` //状态 1 正常 2 禁用 3 删除
}
package request
import "time"
type UserReq struct {
SystemAccount string `json:"system_account" vd:"len($)>0;msg:'请填写系统账号'"`
Password string `json:"password" vd:"len($)>0;msg:'请填写密码'"`
}
type UserOrgInfo struct {
Id int32 `json:"id" xorm:"pk autoincr" ` //id
OrganizationId string `json:"organization_id" xorm:"organization_id"` //所属组织
OrganizationName string `json:"organization_name" xorm:"organization_name"` //所属组织id
BusinessCode string `json:"business_code" xorm:"business_code"` //业务系统编码
BusinessName string `json:"business_name" xorm:"business_name"` //业务系统名称
SystemAccount string `json:"system_account" xorm:"system_account"` //系统账号
SystemRoleId string `json:"system_role_id" xorm:"system_role_id"` //系统角色id
Password string `json:"password"` //密码
AccessAddress string `json:"access_address" xorm:"access_address"` //访问地址
DevelopId string `json:"develop_id" xorm:"develop_id"` //开发厂商uuid
BusinessDesc string `json:"business_desc" xorm:"business_desc"` //业务系统描述
State int `json:"state" xorm:"state"` //状态0禁用1启用
Logo string `json:"logo" xorm:"logo"` //头像logo
ContactName string `json:"contact_name" xorm:"contact_name"` //联系人姓名
ContactPhone string `json:"contact_phone" xorm:"contact_phone"` //联系人电话
ContactEmail string `json:"contact_email" xorm:"contact_email"` //联系人邮箱
Remark string `json:"remark" xorm:"remark"` //备注
CreatedBy string `json:"created_by" ` //创建者
CreatedTime time.Time `json:"created_time" xorm:"created" ` //创建时间
UpdatedBy string `json:"updated_by" ` //更新者
UpdatedTime time.Time `json:"updated_time" xorm:"updated" ` //更新时间
IsDeleted int `json:"is_deleted" xorm:"is_deleted"` //是否删除
SystemId string `json:"system_id" xorm:"system_id"` //系统账号id
IsAdmin int `json:"is_admin" xorm:"is_admin"` //用户类型
}
package request
//添加组织入参
type OrgInput struct {
POrganizationId string `json:"p_organization_id"` //父级组织id或者目录id
Name string `json:"name"` //组织名称or目录名称
OrganizationCode string `json:"organization_code"` //组织机构代码
Description string `json:"description"` //组织介绍
Attachment string `json:"attachment"` //组织附件
DataType int64 `json:"data_type"` //数据类型(0目录 1组织)
}
//组织排序参数
type OrgSortInput struct {
Id int64 `json:"id" xorm:"pk autoincr"` //id
Sort int64 `json:"sort"` //排序
}
//查询组织详情参数
type QueryOrgDetailInput struct {
OrganizationId string `form:"organization_id"` // 组织id
State string `form:"state" xorm:"state"` // 状态0禁用 1启用
KeyWord string `form:"key_word"` // 关键字(账号或者手机号)
Limit int `form:"limit"` // 页条
Page int `form:"page"` // 页码
DataType string `form:"data_type"` // 数据类型(0目录 1组织 2平台用户组织)
}
//查询业务系统信息
type GetBusinessMsgInput struct {
Limit int `form:"limit"` // 页条
Page int `form:"page"` // 页码
OrganizationId string `form:"organization_id"` // 所属组织
}
//新增用户
type OrgUserInput struct {
Logo string `json:"logo"` // 头像logo
SystemAccount string `json:"system_account" vd:"len($)>1;msg:'请输入账号'"` // 系统账号
ContactPhone string `json:"contact_phone" vd:"phone($)"` // 联系人电话
Password string `json:"password" vd:"len($)>1;msg:'请输入密码'"` // 密码
SelectRole []string `json:"select_role"` // 选择角色
State int `json:"state"` // 状态0禁用1启用
ContactName string `json:"contact_name"` // 联系人姓名
ContactEmail string `json:"contact_email"` // 联系人邮箱
Remark string `json:"remark"` // 备注
OrganizationId string `json:"organization_id" vd:"len($)>1;msg:'请选择所属组织'"` // 所属组织
DocumentType int64 `json:"document_type"` //证件类型 1 身份证
DocumentNumber string `json:"document_number"` //证件号
IsAdmin int `json:"is_admin"` // 用户类型(1.业务系统账号 2.组织管理员账号 3.平台用户账号)
}
//编辑用户
type UpdateOrgUserInput struct {
Logo string `json:"logo"` // 头像logo
SystemAccount string `json:"system_account" vd:"len($)>1;msg:'请输入账号'"` // 系统账号
ContactPhone string `json:"contact_phone" vd:"phone($)"` // 联系人电话
// SelectRole []string `json:"select_role"` // 选择角色
State int `json:"state"` // 状态0禁用1启用
ContactName string `json:"contact_name"` // 联系人姓名
ContactEmail string `json:"contact_email" vd:"email($)"` // 联系人邮箱
Remark string `json:"remark"` // 备注
DocumentType int64 `json:"document_type"` //证件类型 1 身份证
DocumentNumber string `json:"document_number"` //证件号
}
//删除用户
type DelOrgUser struct {
Ids []int `json:"ids" xorm:"pk autoincr"` //id
}
//去重校验
type CheckRepetition struct {
Id int `form:"id" json:"id"`
ContactPhone string `form:"contact_phone" json:"contact_phone"`
}
package request
type CreateSystemUserReq struct {
OrganizationId string `json:"organization_id" vd:"len($)>1;msg:'请选择所属组织'"` // 所属组织
BusinessName string `json:"business_name" vd:"len($)>1;msg:'请输入业务系统名称'"` // 业务系统名称
SystemAccount string `json:"system_account" vd:"len($)>1;msg:'请输入账号'"` // 系统账号
Password string `json:"password" vd:"len($)>1;msg:'请输入密码'"` // 密码
SystemRoleId string `json:"system_role_id"`
AccessAddress string `json:"access_address"` // 访问地址
DevelopId string `json:"develop_id"` // 开发厂商uuid
BusinessDesc string `json:"business_desc"` // 业务系统描述
State int `json:"state"` // 状态0禁用1启用
Logo string `json:"logo"` // 头像logo
ContactName string `json:"contact_name"` // 联系人姓名
ContactPhone string `json:"contact_phone"` // 联系人电话
ContactEmail string `json:"contact_email"` // 联系人邮箱
Remark string `json:"remark"` // 备注
CreatedBy string `json:"created_by"` // 用户创建人
UpdatedBy string `json:"updated_by"` // 用户更新人
IsAdmin int `json:"is_admin"` // 用户类型
}
type UpdateSystemUserReq struct {
Id int `json:"id" form:"id" vd:"$>0;msg:'请输入id'"` // id
BusinessName string `json:"business_name" vd:"len($)>1;msg:'请输入业务系统名称'"` // 业务系统名称
SystemAccount string `json:"system_account" vd:"len($)>1;msg:'请输入账号'"` // 系统账号
AccessAddress string `json:"access_address"` // 访问地址
DevelopId string `json:"develop_id"` // 开发厂商uuid
BusinessDesc string `json:"business_desc"` // 业务系统描述
State int `json:"state"` // 状态0禁用1启用
Logo string `json:"logo"` // 头像logo
ContactName string `json:"contact_name"` // 联系人姓名
ContactPhone string `json:"contact_phone"` // 联系人电话
ContactEmail string `json:"contact_email"` // 联系人邮箱
Remark string `json:"remark"` // 备注
UpdatedBy string `json:"updated_by"` // 用户更新人
}
type SystemUserListReq struct {
Pagination
OrganizationId int64 `json:"organization_id" form:"organization_id"` // 所属组织
}
type SystemUserDetailReq struct {
Id string `json:"id" form:"id" vd:"len($)>0;msg:'请输入id'"` // id
}
type SystemUserStateReq struct {
Id string `json:"id" form:"id" vd:"len($)>0;msg:'请输入id'"` // id
State string `json:"state" vd:"len($)>0;msg:'请填写状态'"` // Id
}
type SystemUserEditPasswordReq struct {
Id int `json:"id" form:"id" vd:"$>0;msg:'请输入id'"` // id
Password string `json:"password"` // 密码
}
type DeleteSystemUserReq struct {
Ids []int `json:"ids" form:"ids" vd:"len($)>0;msg:'请输入id'"` // ids
}
type ResetSystemUserPasswordReq struct {
Ids []int `json:"ids" form:"ids" vd:"len($)>0;msg:'请输入id'"` // ids
}
type ResetSecretReq struct {
Id int `json:"id" form:"id" vd:"$>0;msg:'请输入id'"` // ids
}
type CheckBusinessNameReq struct {
Id int `json:"id" form:"id" ` // id
OrganizationId string `json:"organization_id" vd:"len($)>1;msg:'请选择所属组织'"` // 所属组织
BusinessName string `json:"business_name" vd:"len($)>1;msg:'请输入业务系统名称'"` // 业务系统名称
}
type CheckAccountReq struct {
Id int `json:"id" form:"id" ` // id
SystemAccount string `json:"system_account" vd:"len($)>1;msg:'请输入账号'"` // 系统账号
}
package request
type UserAddReq struct {
UserType int `json:"user_type" form:"user_type" binding:"required,oneof=2 3 4"` //用户类型
UserId string `json:"user_id" form:"user_id" binding:"required"` //账号
UserName string `json:"user_name" form:"user_name" binding:"required"` //负责人
Email string `json:"email" form:"email" binding:"email"` //邮箱
Password string `json:"password" form:"password" binding:"required,gte=6"` //密码
PassWordRepeat string `json:"password_repeat" form:"password_repeat" binding:"required,gte=6,eqfield=password"` //重复密码
//普通用户、租户 独有字段
UnitName string `json:"unit_name" form:"unit_name" binding:"omitempty"` //单位名称
Phone string `json:"phone" form:"phone" binding:"omitempty"` //联系方式
Id string `json:"id" form:"id" binding:"omitempty"` //用户唯一标识
}
type UserListReq struct {
Keyword string `json:"keyword" form:"keyword" binding:"omitempty"` //搜索关键词
UserType int `json:"user_type" form:"user_type" binding:"omitempty,oneof=1 2 3 4"` //用户类型
UserId string `json:"user_id" form:"user_id" binding:"omitempty"` //账号
Id string `json:"id" form:"id" binding:"omitempty"` //用户唯一标识
OrderBy string `json:"order_by" form:"order_by" binding:"omitempty"` //排序
Pagination
}
type UserDelReq struct {
UserIds []string `json:"user_ids" form:"user_ids[]" binding:"required"` //用户账号集合
}
type UserUpdateReq struct {
OptType string `json:"opt_type" form:"opt_type" binding:"required,oneof=change_pass reset_pass change_info"`
UserId string `json:"user_id" form:"user_id" binding:"required"` //账号
//基础信息
UserName string `json:"user_name" form:"user_name" binding:"omitempty,required_if=opt_type change_info"` //负责人
Email string `json:"email" form:"email" binding:"omitempty,required_if=opt_type change_info,email"` //邮箱
//迁移人员 独有字段
UnitName string `json:"unit_name" form:"unit_name" binding:"omitempty,required_if=opt_type change_info"` //迁移单位名称
Phone string `json:"phone" form:"phone" binding:"omitempty,required_if=opt_type change_info"` //联系方式
//修改密码、重置密码
OriginalPassword string `json:"original_password" form:"original_password" binding:"required_if=opt_type change_pass,omitempty,gte=6"` //原始密码
Password string `json:"password" form:"password" binding:"required_if=opt_type change_pass,required_if=opt_type reset_pass,omitempty,gte=6"` //新密码
PassWordRepeat string `json:"password_repeat" form:"password_repeat" binding:"required_if=opt_type change_pass,required_if=opt_type reset_pass,omitempty,gte=6,eqfield=password"` //重复密码
}
package response
type Captcha struct {
Id string `json:"id"`
Captcha string `json:"captcha"`
}
package response
import (
"time"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
)
// 系统组织表
type SystemOrganizationTree struct {
Id int64 `json:"id" xorm:"pk autoincr"` //id
OrganizationId string `json:"organization_id"` //组织id
Name string `json:"name"` //组织名称or目录名称
POrganizationId string `json:"p_organization_id"` //父级组织id
Description string `json:"description"` //组织介绍
OrganizationCode string `json:"organization_code"` //组织机构代码
Attachment string `json:"attachment"` //组织附件
Sort int64 `json:"sort"` //排序
DataType int64 `json:"data_type"` //数据类型(0目录 1组织)
CreatedTime time.Time `json:"created_time" xorm:"created"` //创建时间
UpdatedTime time.Time `json:"updated_time" xorm:"updated"` //更新时间
CreatedBy string `json:"created_by"` //创建者
UpdatedBy string `json:"updated_by"` //更新者
Level int64 `json:"level"` //组织节点层级
Child []SystemOrganizationTree `xorm:"-"`
}
// 组织管理员列表
type OrgAdminUser struct {
Id int32 `json:"id" xorm:"pk autoincr" ` // id
SystemAccount string `json:"system_account" xorm:"system_account"` // 系统账号
ContactPhone string `json:"contact_phone" xorm:"contact_phone"` // 联系人电话
SystemRole []string `json:"system_role" xorm:"-"` // 系统角色
CreatedTime jsontime.Time `json:"created_time" xorm:"created" ` // 创建时间
State int `json:"state" xorm:"state"` // 状态0禁用1启用
SystemId string `json:"system_id" xorm:"system_id"` // 系统账号id
}
// 账号详情
type OrgUserDetail struct {
Id int32 `json:"id" xorm:"pk autoincr" ` // id
ContactPhone string `json:"contact_phone" xorm:"contact_phone"` // 联系人电话
SystemAccount string `json:"system_account" xorm:"system_account"` // 系统账号
SystemRole []string `json:"system_role" xorm:"-"` // 系统角色id
Organization string `json:"organization" xorm:"organization"` // 所属组织
OrganizationId string `json:"organization_id"` // 所属组织
CreatedBy string `json:"created_by"` // 创建者
CreatedByAccount string `json:"created_by_account"` // 创建账号
UpdatedTime jsontime.Time `json:"updated_time" xorm:"updated" ` // 更新时间
CreatedTime jsontime.Time `json:"created_time" xorm:"created" ` // 创建时间
ContactName string `json:"contact_name" xorm:"contact_name"` // 联系人姓名
ContactEmail string `json:"contact_email" xorm:"contact_email"` // 联系人邮箱
DocumentType int64 `json:"document_type"` // 证件类型
DocumentNumber string `json:"document_number"` // 证件号
Remark string `json:"remark" xorm:"remark"` // 备注
Logo string `json:"logo"` // 头像logo
State int `json:"state"` // 状态0禁用1启用
SystemId string `json:"-" xorm:"system_id"` // 系统账号id
IsAdmin int `json:"is_admin"` // 用户类型(1.业务系统账号 2.组织管理员账号 3.平台用户账号)
}
// 编辑组织账号
type UpdateOrgUser struct {
ContactPhone string `json:"contact_phone" xorm:"contact_phone"` // 联系人电话
SystemAccount string `json:"system_account" xorm:"system_account"` // 系统账号
ContactName string `json:"contact_name" xorm:"contact_name"` // 联系人姓名
ContactEmail string `json:"contact_email" xorm:"contact_email"` // 联系人邮箱
DocumentType int64 `json:"document_type"` // 证件类型
DocumentNumber string `json:"document_number"` // 证件号
Remark string `json:"remark" xorm:"remark"` // 备注
Logo string `json:"logo"` // 头像logo
State int `json:"state"` // 状态0禁用1启用
}
// 机构详情
type OrgDetail struct {
OrganizationType string `json:"organization_type"` //机构类型
OrganizationCode string `json:"organization_code"` //组织机构代码
Name string `json:"name"` //机构名称
CreatedTime jsontime.Time `json:"created_time" xorm:"created"` //创建时间
OrgAdminNumber int64 `json:"org_admin_number"` //组织管理员数
BusinessSystemNumber int64 `json:"business_system_number"` //业务系统数
Attachment string `json:"attachment"` //组织附件
Description string `json:"description"` //组织介绍
PlatformUsersNumber int64 `json:"platform_users_number"` //平台用户数
}
type BusinessSystem struct {
BusinessName string `json:"business_name" xorm:"business_name"` // 业务系统名称
SystemAccount string `json:"system_account" xorm:"system_account"` // 系统账号
State int `json:"state"` // 状态0禁用1启用
}
package response
import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
"time"
)
type SystemUserList struct {
Id int32 `json:"id" ` // id
OrganizationId string `json:"organization_id" xorm:"organization_id"` // 所属组织
OrganizationName string `json:"organization_name" xorm:"name"` // 所属组织
BusinessCode string `json:"business_code" xorm:"business_code"` // 业务系统编码
BusinessName string `json:"business_name" xorm:"business_name"` // 业务系统名称
SystemAccount string `json:"system_account" xorm:"system_account"` // 系统账号
State int `json:"state" xorm:"state"` // 状态0禁用1启用
CreatedTime time.Time `json:"created_time" xorm:"created" ` // 创建时间
SystemId string `json:"system_id" xorm:"system_id"` // 系统账号id
}
type SystemUserDetailRes struct {
BusinessCode string `json:"business_code"` // 业务系统编码
BusinessName string `json:"business_name"` // 业务系统名称
OrganizationId string `json:"organization_id"` // 所属组织
OrganizationName string `json:"organization_name"` // 所属组织名称
SystemAccount string `json:"system_account"` // 系统账号
AppId string `json:"app_id"` // appId
AppSecret string `json:"app_secret"` // appSecret
CreatedBy string `json:"created_by"` // 创建者
CreatedTime jsontime.Time `json:"created_time"` // 创建时间
State int `json:"state"` // 状态0禁用1启用
DevelopId string `json:"develop_id"` // 开发厂商uuid
DevelopName string `json:"develop_name"` // 开发厂商名称
AccessAddress string `json:"access_address"` // 访问地址
BusinessDesc string `json:"business_desc"` // 业务系统描述
Logo string `json:"logo"` // 头像logo
ContactName string `json:"contact_name"` // 联系人姓名
ContactPhone string `json:"contact_phone"` // 联系人电话
ContactEmail string `json:"contact_email"` // 联系人邮箱
Remark string `json:"remark"` // 备注
SystemId string `json:"system_id"` // 系统账号id
IsAdmin int `json:"is_admin"` // 用户类型
CreatedUserRole []string `json:"created_user_role"` // 系统角色
}
type SystemUserListRes struct {
Id int32 `json:"id" ` // id
OrganizationId string `json:"organization_id"` // 所属组织
OrganizationName string `json:"organization_name"` // 所属组织
BusinessCode string `json:"business_code"` // 业务系统编码
BusinessName string `json:"business_name"` // 业务系统名称
SystemAccount string `json:"system_account"` // 系统账号
State int `json:"state"` // 状态0禁用1启用
CreatedTime jsontime.Time `json:"created_time" ` // 创建时间
SystemId string `json:"system_id"` // 系统账号id
}
package response
import (
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/jsontime"
)
type UserListItem struct {
entity.User
CreatedAt jsontime.Time `column:"created_at" json:"created_at"` //创建时间
UpdatedAt jsontime.Time `column:"updated_at" json:"updated_at"` //更新时间
}
type UserList struct {
TotalCount int `json:"total_count"`
List []UserListItem `json:"list"`
}
type UserMigListItem struct {
Id string `json:"id"` //用户唯一标识
UnitName string `json:"unit_name"` //迁移单位名称
Phone string `json:"phone"` //联系电话
UserName string `json:"username"` //用户名称
}
......@@ -82,3 +82,18 @@ func (r Redis) Del(key string) error {
bmd := r.Conn.Del(strings.ToUpper(key))
return bmd.Err()
}
func (r Redis) Ttl(key string) (time.Duration, error) {
key = fmt.Sprintf("%s-%s", strings.ToUpper(r.Prefix), strings.ToUpper(key))
return r.Conn.TTL(strings.ToUpper(key)).Result()
}
func (r Redis) Incr(key string) (int64, error) {
key = fmt.Sprintf("%s-%s", strings.ToUpper(r.Prefix), strings.ToUpper(key))
return r.Conn.Incr(strings.ToUpper(key)).Result()
}
func (r Redis) Expire(key string, expiration time.Duration) (bool, error) {
key = fmt.Sprintf("%s-%s", strings.ToUpper(r.Prefix), strings.ToUpper(key))
return r.Conn.Expire(strings.ToUpper(key), expiration).Result()
}
......@@ -2,6 +2,7 @@ package conf
import (
"go.uber.org/zap"
"time"
)
var (
......@@ -30,3 +31,13 @@ type Config struct {
MinioSecretKey string
MinioBucket string
}
const (
LockDuration = 1 * time.Hour //锁定时间 默认 1小时
LockErrorNumber = 3 //错误次数 3次
WIDTH = 240
HEIGHT = 60
CookieName = "bgToken"
CookieNameLastLogin string = "lastLogin"
LocalDateTimeFormat string = "2006-01-02 15:04:05"
)
package tools
import (
"math/rand"
"strings"
)
var CHARS = []string{"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0"}
/*RandAllString 生成随机字符串([a~zA~Z0~9])
lenNum 长度
*/
func RandAllString(lenNum int) string {
str := strings.Builder{}
length := len(CHARS)
for i := 0; i < lenNum; i++ {
l := CHARS[rand.Intn(length)]
str.WriteString(l)
}
return str.String()
}
/*RandNumString 生成随机数字字符串([0~9])
lenNum 长度
*/
func RandNumString(lenNum int) string {
str := strings.Builder{}
length := 10
for i := 0; i < lenNum; i++ {
str.WriteString(CHARS[52+rand.Intn(length)])
}
return str.String()
}
/*RandString 生成随机字符串(a~zA~Z])
lenNum 长度
*/
func RandString(lenNum int) string {
str := strings.Builder{}
length := 52
for i := 0; i < lenNum; i++ {
str.WriteString(CHARS[rand.Intn(length)])
}
return str.String()
}
package tools
import (
"github.com/mojocn/base64Captcha"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"log"
"time"
)
type ConfigJsonBody struct {
Id string `json:"id"`
CaptchaType string `json:"captcha_type"`
VerifyValue string `json:"verify_value"`
DriverAudio *base64Captcha.DriverAudio `json:"driver_audio"`
DriverString *base64Captcha.DriverString `json:"driver_string"`
DriverChinese *base64Captcha.DriverChinese `json:"driver_chinese"`
DriverMath *base64Captcha.DriverMath `json:"driver_math"`
DriverDigit *base64Captcha.DriverDigit `json:"driver_digit"`
}
type RedisStore struct {
}
var store = RedisStore{}
func GenerateCaptcha(param ConfigJsonBody) (id, b64s string, err error) {
var driver base64Captcha.Driver
switch param.CaptchaType {
case "audio":
driver = param.DriverAudio
case "string":
driver = param.DriverString.ConvertFonts()
case "math":
driver = param.DriverMath.ConvertFonts()
case "chinese":
driver = param.DriverChinese.ConvertFonts()
default:
driver = param.DriverDigit
}
c := base64Captcha.NewCaptcha(driver, store)
id, b64s, err = c.Generate()
//fmt.Println(id, b64s,err)
//fmt.Println("base64编码1", b64s)
//aaaa := b64s[strings.IndexByte(b64s, ',')+1:]
//fmt.Println("base64编码2", aaaa)
//ddd, err1 := base64.StdEncoding.DecodeString(aaaa) //成图片文件并把文件写入到buffer
//fmt.Println("二进制", ddd)
//fmt.Println("错误", err1)
//err2 := ioutil.WriteFile("./output.png", ddd, 0666) //buffer输出到jpg文件中(不做处理,直接写到文件)
//fmt.Println(err2)
return
}
func Verify(body ConfigJsonBody) bool {
return store.Verify(body.Id, body.VerifyValue, true)
}
func (body RedisStore) Set(id string, value string) error {
redis, err := client.GetRedisClient()
if err != nil {
log.Println(err)
}
return redis.Set(id, value, time.Hour*5)
}
func (body RedisStore) Get(id string, clear bool) string {
redis, err := client.GetRedisClient()
if err != nil {
log.Println(err)
}
value, _ := redis.Get(id)
return value
}
func (body RedisStore) Verify(id, answer string, clear bool) bool {
redis, err := client.GetRedisClient()
if err != nil {
log.Println(err)
}
value, _ := redis.Get(id)
right := false
if answer == value {
right = true
} else {
right = false
return right
}
if clear {
redis.Del(id)
}
return right
}
package controller
import (
vd "github.com/bytedance/go-tagexpr/validator"
"github.com/gin-gonic/gin"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/request"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/service"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/util"
"go.uber.org/zap"
"strconv"
)
func UserLogin(c *gin.Context) {
userReq := request.UserReq{}
err := c.BindJSON(&userReq)
if err != nil {
SendJsonResponse(c, resp.InvalidParam.WithError(err), nil)
return
}
//参数检测
if err := vd.Validate(userReq); err != nil {
SendJsonResponse(c, resp.InvalidParam.WithError(err), "")
return
}
// 验证 userName 是否含有危险字符
if util.IfDangerCharacter(userReq.SystemAccount) {
SendJsonResponse(c, resp.InvalidParam.WithMsg("账号存在危险字符"), "")
return
}
//TODO 解密password
pwd, err := util.DecryptPwd(userReq.Password)
if err != nil {
SendJsonResponse(c, resp.FAIL.WithError(err), "")
return
}
userReq.Password = pwd
loginInf := service.UserSvc{SystemAccount: userReq.SystemAccount, PassWord: userReq.Password}
msg, uuidStr, lastLogin, err := loginInf.Login()
if err != nil {
SendJsonResponse(c, err, "")
return
}
c.SetCookie(conf.CookieName, uuidStr, 1*60*60*24, "/", "", false, false)
c.SetCookie(conf.CookieNameLastLogin, lastLogin, 1*60*60*24, "/", "", false, false)
SendJsonResponse(c, resp.OK, msg)
}
func GetUserInfo(c *gin.Context) {
token, _ := c.Cookie(conf.CookieName)
conf.Logger.Info("当前token信息为", zap.String("bgToken", token))
header := c.GetHeader(conf.CookieName)
conf.Logger.Info("当前header信息为", zap.String("header", header))
if token == "" {
SendJsonResponse(c, resp.FAIL.WithMsg("登录超时"), "")
return
}
loginInf := service.UserSvc{}
result, err := loginInf.GetCurUser(token)
if err != nil {
SendJsonResponse(c, err, "")
return
}
SendJsonResponse(c, resp.OK, result)
}
func GetCaptcha(c *gin.Context) {
widthS := c.Query("width")
heightS := c.Query("height")
var width, height int
if widthS == "" {
width = conf.WIDTH
} else {
width, _ = strconv.Atoi(widthS)
}
if heightS == "" {
height = conf.HEIGHT
} else {
height, _ = strconv.Atoi(heightS)
}
loginInf := service.UserSvc{}
m, err := loginInf.GetCaptcha(width, height)
if err != nil {
SendJsonResponse(c, err, "")
return
}
SendJsonResponse(c, resp.OK, m)
}
func VerifyCaptcha(c *gin.Context) {
id := c.Query("id")
value := c.Query("value")
if id == "" || value == "" {
SendJsonResponse(c, resp.FAIL.WithMsg("id and value are required"), "")
return
}
loginInf := service.UserSvc{}
err := loginInf.VerifyCaptcha(id, value)
if err != nil {
SendJsonResponse(c, err, "")
return
}
SendJsonResponse(c, resp.OK, "验证码正确")
}
func UserLogout(c *gin.Context) {
cookie, _ := c.Cookie(conf.CookieName)
c.SetCookie(conf.CookieName, "0", -1, "/", "", false, true)
c.SetCookie(conf.CookieNameLastLogin, "0", -1, "/", "", false, true)
loginInf := service.UserSvc{}
msg, err := loginInf.UserLogout(cookie)
if err != nil {
SendJsonResponse(c, err, "")
return
}
SendJsonResponse(c, resp.OK, msg)
}
package router
import (
"fmt"
"github.com/gin-gonic/gin"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/controller"
)
// InitSystemLoginRouter 初始化登录相关路由
func InitSystemLoginRouter(e *gin.Engine) {
base := e.Group(fmt.Sprintf("%s/user", conf.Options.Prefix))
{
base.POST("/login", controller.UserLogin) // 登录
base.POST("/logout", controller.UserLogout) // 登出
base.GET("/getUserInfo", controller.GetUserInfo) // 获取用户信息
base.GET("/getCaptcha", controller.GetCaptcha) // 获取验证码
base.GET("/verifyCaptcha", controller.VerifyCaptcha) // 校验验证码
}
}
......@@ -41,4 +41,6 @@ func Load(r *gin.Engine, middleware ...gin.HandlerFunc) {
// 初始化自动化运维路由
InitAutomatedMaintenRouter(r)
// 初始化登录路由
InitSystemLoginRouter(r)
}
......@@ -9,7 +9,7 @@ import (
type Example struct {
}
func (e Example) List() (result response.UserList, err error) {
func (e Example) List() (result response.SystemUserListRes, err error) {
db, err := client.GetDbClient()
if err != nil {
err = resp.FAIL.WithError(err)
......
......@@ -11,7 +11,7 @@ import (
)
type HostManageSvc struct {
User *entity.User
User *entity.SystemUser
}
// AddHostManage 新增主机
......
package service
import (
"crypto/md5"
"encoding/hex"
"errors"
"fmt"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/vo/response"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/client"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/conf"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/common/tools"
"gitlab.wodcloud.com/smart-operation/so-operation-api/src/pkg/beagle/resp"
"image/color"
"strings"
"time"
"github.com/go-redis/redis"
"github.com/mojocn/base64Captcha"
uuid "github.com/satori/go.uuid"
"github.com/spf13/cast"
"go.uber.org/zap"
"k8s.io/apimachinery/pkg/util/json"
)
type UserSvc struct {
SystemAccount string
PassWord string
}
func (u *UserSvc) Login() (msg string, uuidStr string, last_login string, err error) {
db, err := client.GetDbClient()
if err != nil {
return "", "", "", resp.DbConnectError.WithError(err)
}
// 查询用户
var userInfo entity.SystemUserInfo
_, err = db.Table("system_user").
Select("system_user.*").
Where("system_account = ?", u.SystemAccount).Get(&userInfo)
if err != nil {
return
}
if userInfo.Id == 0 {
conf.Logger.Error("用户名或密码错误", zap.Error(err))
return "", "", "", resp.FAIL.WithMsg("用户名或密码错误")
}
if userInfo.State == 0 {
conf.Logger.Error("账号未启用", zap.Error(err))
return "", "", "", resp.FAIL.WithMsg("账号未启用")
}
redisCli, err := client.GetRedisClient()
if err != nil {
return "", "", "", resp.RedisConnectError.WithError(err)
}
lockKey := fmt.Sprintf("so-operation-user-lock-%s", userInfo.Id)
haslock, err := redisCli.Get(lockKey)
if err != nil && err != redis.Nil {
conf.Logger.Error("获取密码插入次数失败", zap.Error(err))
return "", "", "", resp.DbSelectError.WithError(err)
} else if haslock == "" {
if err := redisCli.Set(lockKey, 0, conf.LockDuration); err != nil {
conf.Logger.Error("密码插入次数插入redis失败", zap.Error(err))
return "", "", "", resp.DbInsertError.WithError(err)
}
} else if cast.ToInt(haslock) >= conf.LockErrorNumber {
if ttl, err := redisCli.Ttl(lockKey); err != nil {
msg = "错误次数达到上限,请稍后重试"
} else {
if ttl.Seconds() <= 0 {
if err := redisCli.Del(lockKey); err != nil {
msg = "删除错误次数错误,请稍后重试"
}
ttl = time.Second
}
ttl := int(ttl.Seconds())
if ttl >= 3600 {
msg = fmt.Sprintf("错误次数达到上限,请%d小时后重试", ttl/3600)
} else if ttl >= 60 && ttl < 3600 {
msg = fmt.Sprintf("错误次数达到上限,请%d分钟后重试", ttl/60)
} else {
msg = fmt.Sprintf("错误次数达到上限,请%d秒后重试", ttl)
}
}
err = errors.New(msg)
if err != nil {
conf.Logger.Error(msg, zap.Error(err))
return "", "", "", resp.RedisExecError.WithError(err)
}
}
h := md5.New()
_, err = h.Write([]byte(strings.ToUpper(fmt.Sprintf("%d-%s", userInfo.Id, u.PassWord))))
if err != nil {
conf.Logger.Error("加密错误", zap.Error(err))
return "", "", "", resp.FAIL.WithError(err)
}
uppperMd5Pass := strings.ToUpper(hex.EncodeToString(h.Sum(nil)))
if uppperMd5Pass != userInfo.Password {
incr, err := redisCli.Incr(lockKey)
if err != nil {
conf.Logger.Error("写入错误次数失败", zap.Error(err))
return "", "", "", resp.RedisExecError.WithError(err)
}
conf.Logger.Info("当前错误次数为", zap.Int64("incr", incr))
//再次错误执行续期
expire, err := redisCli.Expire(lockKey, conf.LockDuration)
if err != nil {
conf.Logger.Error("错误次数续期错误", zap.Error(err))
return "", "", "", resp.RedisExecError.WithError(err)
}
conf.Logger.Info("续期结果为", zap.Bool("expire", expire))
return "", "", "", resp.FAIL.WithMsg("用户名或密码错误")
}
//密码正确 删除 锁定文件
if err := redisCli.Del(lockKey); err != nil {
conf.Logger.Error("删除锁定文件错误", zap.Error(err))
return "", "", "", resp.RedisExecError.WithError(err)
}
uu := uuid.NewV4()
uuidStr = uu.String()
// 存入redis
b, err := json.Marshal(userInfo)
if err != nil {
return "", "", "", resp.FAIL.WithError(err)
}
err = redisCli.Set(uuidStr, string(b), time.Minute*60*24)
if err != nil {
conf.Logger.Error("登录失败", zap.Error(err))
return "", "", "", resp.FAIL.WithError(err)
}
msg = "登录成功"
conf.Logger.Info("登录成功", zap.String("msg", msg))
//登录时间计录在map
loginMap := make(map[string]string, 0)
cont, _ := redisCli.Get("LOGIN-TIME")
//if err != nil {
// conf.Logger.Error("获取登录时间失败", zap.Error(err))
// return "", "", "", res.DataFailError.ErrorDetail(err)
//}
if cont != "" {
err = json.Unmarshal([]byte(cont), &loginMap)
if err != nil {
return "", "", "", resp.FAIL.WithError(err)
}
}
now := time.Now().Format(conf.LocalDateTimeFormat)
if _, ok := loginMap[u.SystemAccount]; ok {
last_login = loginMap[u.SystemAccount]
} else {
last_login = now
}
loginMap[u.SystemAccount] = now
a, err := json.Marshal(loginMap)
if err != nil {
return "", "", "", resp.FAIL.WithError(err)
}
err = redisCli.Set("LOGIN-TIME", string(a), -1)
if err != nil {
conf.Logger.Error("登录失败", zap.Error(err))
return "", "", "", resp.FAIL.WithError(err)
}
return
}
func (u *UserSvc) GetCurUser(token string) (m entity.SystemUserInfo, err error) {
rcon, err := client.GetRedisClient()
if err != nil {
return m, resp.RedisConnectError.WithError(err)
}
result, err := rcon.Get(token)
if err != nil {
if err.Error() == "redis: nil" {
err = errors.New("登录超时")
return m, resp.FAIL.WithError(err)
} else {
conf.Logger.Error("获取token失败", zap.Error(err))
return m, resp.FAIL.WithError(err)
}
}
if result == "" {
err = errors.New("登录超时")
return m, resp.FAIL.WithError(err)
}
err = json.Unmarshal([]byte(result), &m)
if err != nil {
return m, resp.FAIL.WithError(err)
}
m.Password = ""
return
}
func (u *UserSvc) UserLogout(cookie string) (msg string, err error) {
// 清理redis
redisCli, err := client.GetRedisClient()
if err != nil {
return "", resp.FAIL.WithError(err)
}
err = redisCli.Del(cookie)
if err != nil {
msg = "登出失败"
return msg, resp.FAIL.WithError(err)
}
return "登出成功", nil
}
func (u *UserSvc) GetCaptcha(width, height int) (captcha response.Captcha, err error) {
param := tools.ConfigJsonBody{
CaptchaType: "string",
DriverString: &base64Captcha.DriverString{
Height: height,
Width: width,
NoiseCount: 0,
ShowLineOptions: 2,
Length: 4,
Source: "124567890",
BgColor: &color.RGBA{255, 255, 255, 1},
//Fonts: []string{"3Dumb.ttf", "ApothecaryFont.ttf", "Comismsh.ttf", "DENNEthree-dee.ttf", "DeborahFancyDress.ttf",
// "Flim-Flam.ttf", "RitaSmith.ttf", "actionj.ttf", "chromohv.ttf"},
Fonts: []string{"DENNEthree-dee.ttf"},
},
}
captcha.Id, captcha.Captcha, err = tools.GenerateCaptcha(param)
return
}
func (u *UserSvc) VerifyCaptcha(id, value string) (err error) {
param := tools.ConfigJsonBody{}
param.Id = id
param.VerifyValue = strings.ToLower(value)
right := tools.Verify(param)
if !right {
err = errors.New("验证码不正确")
conf.Logger.Error("验证码不正确", zap.Error(err))
}
return
}
......@@ -13,7 +13,7 @@ import (
)
type TaskManageSvc struct {
User *entity.User
User *entity.SystemUser
}
// AddTaskManage 新增任务
......
/*
* @Descripttion:
* @Author: Zhang YaSong
* @version:
* @Date: 2022-10-21 18:21:35
* @LastEditors: Zhang YaSong
* @LastEditTime: 2022-10-21 18:36:04
*/
package util
import (
"net/http"
"regexp"
"github.com/Luzifer/go-openssl/v4"
"github.com/google/uuid"
)
var OpenSslManager *openssl.OpenSSL = openssl.New()
func IfDangerCharacter(toMatch string) bool {
// 正则过滤sql注入的方法
// 参数 : 要匹配的语句
//过滤 ‘
//ORACLE 注解 -- /**/
//关键字过滤 update ,delete
str := `(?:')|(?:--)|(/\\*(?:.|[\\n\\r])*?\\*/)|(\b(select|update|and|or|delete|insert|trancate|char|chr|into|substr|ascii|declare|exec|count|master|into|drop|execute)\b)`
re, err := regexp.Compile(str)
if err != nil {
return false
}
return re.MatchString(toMatch)
}
func DecryptPwd(pwd string) (str string, err error) {
passphrase := "swuE9cmCZQwrkYRV"
dec, err := OpenSslManager.DecryptBytes(passphrase, []byte(pwd), openssl.BytesToKeyMD5)
return string(dec), err
}
func EncryptPwd(password string) (pwd string, err error) {
passphrase := "swuE9cmCZQwrkYRV"
ecs, err := OpenSslManager.EncryptBytes(passphrase, []byte(password), openssl.BytesToKeyMD5)
return string(ecs), err
}
// GetCookieStr , 获取cookie字符串
func GetCookieStr(req *http.Request) (str string, err error) {
cookies := req.Cookies()
for _, v := range cookies {
str += v.Name + "=" + v.Value + ";"
}
return str, nil
}
func GetUUID() string {
// Creating UUID Version 4
return uuid.New().String()
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment