Skip to content

Commit e210002

Browse files
authored
Merge pull request #2003 from huiyifyj/ctx-nil-and-others
fix: check for nil and return explicit type for `UseWithCtx` method
2 parents c0f6538 + 8bec943 commit e210002

File tree

4 files changed

+21
-17
lines changed

4 files changed

+21
-17
lines changed

server/service/system/auto_code_package_test.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package system
22

33
import (
44
"context"
5-
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
6-
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
75
"reflect"
86
"testing"
7+
8+
model "github.com/flipped-aurora/gin-vue-admin/server/model/system"
9+
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
910
)
1011

1112
func Test_autoCodePackage_Create(t *testing.T) {
@@ -53,9 +54,10 @@ func Test_autoCodePackage_Create(t *testing.T) {
5354

5455
func Test_autoCodePackage_templates(t *testing.T) {
5556
type args struct {
56-
ctx context.Context
57-
entity model.SysAutoCodePackage
58-
info request.AutoCode
57+
ctx context.Context
58+
entity model.SysAutoCodePackage
59+
info request.AutoCode
60+
isPackage bool
5961
}
6062
tests := []struct {
6163
name string
@@ -78,14 +80,15 @@ func Test_autoCodePackage_templates(t *testing.T) {
7880
Abbreviation: "user",
7981
HumpPackageName: "user",
8082
},
83+
isPackage: false,
8184
},
8285
wantErr: false,
8386
},
8487
}
8588
for _, tt := range tests {
8689
t.Run(tt.name, func(t *testing.T) {
8790
s := &autoCodePackage{}
88-
gotCode, gotEnter, gotCreates, err := s.templates(tt.args.ctx, tt.args.entity, tt.args.info)
91+
gotCode, gotEnter, gotCreates, err := s.templates(tt.args.ctx, tt.args.entity, tt.args.info, tt.args.isPackage)
8992
if (err != nil) != tt.wantErr {
9093
t.Errorf("templates() error = %v, wantErr %v", err, tt.wantErr)
9194
return

server/utils/captcha/redis.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"time"
66

77
"github.com/flipped-aurora/gin-vue-admin/server/global"
8-
"github.com/mojocn/base64Captcha"
98
"go.uber.org/zap"
109
)
1110

@@ -23,8 +22,10 @@ type RedisStore struct {
2322
Context context.Context
2423
}
2524

26-
func (rs *RedisStore) UseWithCtx(ctx context.Context) base64Captcha.Store {
27-
rs.Context = ctx
25+
func (rs *RedisStore) UseWithCtx(ctx context.Context) *RedisStore {
26+
if ctx == nil {
27+
rs.Context = ctx
28+
}
2829
return rs
2930
}
3031

web/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@
5151
},
5252
"devDependencies": {
5353
"@babel/eslint-parser": "^7.25.1",
54-
"@eslint/js": "^9.14.0",
55-
"@vitejs/plugin-legacy": "^5.4.2",
56-
"@vitejs/plugin-vue": "^5.1.4",
54+
"@eslint/js": "^8.56.0",
55+
"@vitejs/plugin-legacy": "^6.0.0",
56+
"@vitejs/plugin-vue": "^5.0.3",
5757
"@vue/cli-plugin-babel": "~5.0.8",
5858
"@vue/cli-plugin-eslint": "~5.0.8",
5959
"@vue/cli-plugin-router": "~5.0.8",
@@ -63,13 +63,13 @@
6363
"babel-plugin-import": "^1.13.8",
6464
"chalk": "^5.3.0",
6565
"dotenv": "^16.4.5",
66-
"eslint": "^9.14.0",
67-
"eslint-plugin-vue": "^9.30.0",
66+
"eslint": "^8.57.0",
67+
"eslint-plugin-vue": "^9.19.2",
6868
"sass": "^1.78.0",
6969
"terser": "^5.31.6",
70-
"vite": "^5.4.3",
70+
"vite": "^6.2.3",
7171
"vite-plugin-banner": "^0.8.0",
7272
"vite-plugin-importer": "^0.2.5",
73-
"vite-plugin-vue-devtools": "^7.4.4"
73+
"vite-plugin-vue-devtools": "^7.0.16"
7474
}
7575
}

web/src/view/superAdmin/authority/components/menus.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
color:
3232
row.defaultRouter === data.name ? '#E6A23C' : '#85ce61'
3333
}"
34-
@click="() => setDefault(data)"
34+
@click.stop="() => setDefault(data)"
3535
>
3636
{{ row.defaultRouter === data.name ? '首页' : '设为首页' }}
3737
</el-button>

0 commit comments

Comments
 (0)