Skip to content

Commit 52d9ceb

Browse files
committed
Merge branch 'main' into feat-proxy-key
2 parents 1bc4123 + 44f268b commit 52d9ceb

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

internal/models/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type Group struct {
6666
// APIKey 对应 api_keys 表
6767
type APIKey struct {
6868
ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
69-
KeyValue string `gorm:"type:varchar(512);not null;uniqueIndex:idx_group_key" json:"key_value"`
69+
KeyValue string `gorm:"type:varchar(1024);not null;uniqueIndex:idx_group_key" json:"key_value"`
7070
GroupID uint `gorm:"not null;uniqueIndex:idx_group_key" json:"group_id"`
7171
Status string `gorm:"type:varchar(50);not null;default:'active'" json:"status"`
7272
RequestCount int64 `gorm:"not null;default:0" json:"request_count"`
@@ -82,9 +82,9 @@ type RequestLog struct {
8282
Timestamp time.Time `gorm:"not null;index" json:"timestamp"`
8383
GroupID uint `gorm:"not null;index" json:"group_id"`
8484
GroupName string `gorm:"type:varchar(255);index" json:"group_name"`
85-
KeyValue string `gorm:"type:varchar(512)" json:"key_value"`
85+
KeyValue string `gorm:"type:varchar(1024)" json:"key_value"`
8686
IsSuccess bool `gorm:"not null" json:"is_success"`
87-
SourceIP string `gorm:"type:varchar(45)" json:"source_ip"`
87+
SourceIP string `gorm:"type:varchar(64)" json:"source_ip"`
8888
StatusCode int `gorm:"not null" json:"status_code"`
8989
RequestPath string `gorm:"type:varchar(500)" json:"request_path"`
9090
Duration int64 `gorm:"not null" json:"duration_ms"`

web/src/components/keys/GroupList.vue

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,12 @@ function openCreateGroupModal() {
6262
showGroupModal.value = true;
6363
}
6464
65-
function handleGroupCreated(_group: Group) {
65+
function handleGroupCreated(group: Group) {
6666
showGroupModal.value = false;
67-
emit("refresh");
68-
}
69-
70-
function handleSwitchToGroup(groupId: number) {
71-
// 创建成功后,通知父组件刷新并切换到新创建的分组
72-
emit("refresh-and-select", groupId);
67+
if (group && group.id) {
68+
// 创建成功后,通知父组件刷新并切换到新创建的分组
69+
emit("refresh-and-select", group.id);
70+
}
7371
}
7472
</script>
7573

@@ -132,7 +130,6 @@ function handleSwitchToGroup(groupId: number) {
132130
<group-form-modal
133131
v-model:show="showGroupModal"
134132
@success="handleGroupCreated"
135-
@switch-to-group="handleSwitchToGroup"
136133
/>
137134
</div>
138135
</template>

0 commit comments

Comments
 (0)