From bfc8b081656536f6c8bd226281c711530d39cf9a Mon Sep 17 00:00:00 2001 From: HenryYee Date: Thu, 15 Sep 2022 13:50:23 +0800 Subject: [PATCH] update dep --- go.mod | 11 ++++++----- migration/migrate_test.go | 12 +----------- src/router/router.go | 16 ++++------------ 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index ac480620..478ca956 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v0.3.1 github.com/Jeffail/gabs/v2 v2.6.1 github.com/cookieY/sqlx v1.3.0 - github.com/cookieY/yee v0.3.4 + github.com/cookieY/yee v0.3.6 github.com/deckarep/golang-set/v2 v2.1.0 github.com/go-sql-driver/mysql v1.6.0 github.com/golang-jwt/jwt v3.2.2+incompatible @@ -17,7 +17,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/vmihailenco/msgpack/v5 v5.3.5 golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 - golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 + golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e google.golang.org/grpc v1.25.1 gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df gopkg.in/ldap.v3 v3.0.3 @@ -35,11 +35,12 @@ require ( github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.4 // indirect github.com/json-iterator/go v1.1.10 // indirect - github.com/lucas-clemente/quic-go v0.27.2 // indirect + github.com/lucas-clemente/quic-go v0.28.1 // indirect github.com/marten-seemann/qpack v0.2.1 // indirect github.com/marten-seemann/qtls-go1-16 v0.1.5 // indirect github.com/marten-seemann/qtls-go1-17 v0.1.2 // indirect github.com/marten-seemann/qtls-go1-18 v0.1.2 // indirect + github.com/marten-seemann/qtls-go1-19 v0.1.0-beta.1 // indirect github.com/mattn/go-colorable v0.1.6 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect @@ -56,8 +57,8 @@ require ( github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect go.uber.org/atomic v1.9.0 // indirect golang.org/x/mod v0.4.2 // indirect - golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect - golang.org/x/text v0.3.6 // indirect + golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect + golang.org/x/text v0.3.7 // indirect golang.org/x/tools v0.1.1 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c // indirect diff --git a/migration/migrate_test.go b/migration/migrate_test.go index bdd1f1d0..f3801d02 100644 --- a/migration/migrate_test.go +++ b/migration/migrate_test.go @@ -1,7 +1,6 @@ package main import ( - "Yearning-go/src/lib" "Yearning-go/src/model" "fmt" "strings" @@ -9,13 +8,9 @@ import ( ) func init() { - model.DbInit("../conf.toml") + model.DBNew("../conf.toml") } -//func TestMigrate(t *testing.T) { -// migrateTools() -//} - func TestHighLight(t *testing.T) { var high = `alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|acequire|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat|by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric|ucase|lcase|mid|len|round|rank|now|format|coalesce|ifnull|isnull|nvl` for _, i := range strings.Split(high, "|") { @@ -23,8 +18,3 @@ func TestHighLight(t *testing.T) { } } - -func TestDecrypt(t *testing.T) { - s := `9RjINyhgDYYwuwuaeco5ZWKscQGNmW9K3hRPGejI5s4=` - fmt.Println(lib.Decrypt(s)) -} diff --git a/src/router/router.go b/src/router/router.go index 189d5a0b..5d6d2248 100644 --- a/src/router/router.go +++ b/src/router/router.go @@ -43,7 +43,8 @@ func SuperManageGroup() yee.HandlerFunc { if role.Username == "admin" || focalPoint(c) { return } - return c.ServerError(http.StatusForbidden, "非法越权操作!") + c.Abort() + return c.JSON(http.StatusForbidden, "非法越权操作!") } } @@ -53,7 +54,8 @@ func SuperRecorderGroup() yee.HandlerFunc { if role.IsRecord { return } - return c.ServerError(http.StatusForbidden, "非法越权操作!") + c.Abort() + return c.JSON(http.StatusForbidden, "非法越权操作!") } } @@ -69,16 +71,6 @@ func focalPoint(c yee.Context) bool { return false } -//func AuditGroup() yee.HandlerFunc { -// return func(c yee.Context) (err error) { -// role := new(lib.Token).JwtParse(c) -// if role.Role != "guest" { -// return -// } -// return c.ServerError(http.StatusForbidden, "非法越权操作!") -// } -//} - func AddRouter(e *yee.Core) { e.POST("/login", login.UserGeneralLogin) e.POST("/register", login.UserRegister)