fix 修复获取option items不正确的问题
All checks were successful
Build image / build (push) Successful in 1m25s

This commit is contained in:
timerzz 2024-05-21 13:44:46 +08:00
parent 5561757e17
commit 56f3155d99
3 changed files with 3 additions and 5 deletions

View File

@ -3,7 +3,6 @@ package service
import ( import (
"context" "context"
config "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config" config "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config"
push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push"
"testing" "testing"
) )

View File

@ -26,13 +26,13 @@ func (s *GetPusherOptionsService) Run() (resp *push.GetPusherOptionsResponse, er
} }
func toFormItems(in any) []*config.FormItem { func toFormItems(in any) []*config.FormItem {
valueOfIn := reflect.ValueOf(in) valueOfIn := reflect.TypeOf(in)
numOfFields := valueOfIn.NumField() numOfFields := valueOfIn.NumField()
items := make([]*config.FormItem, 0, numOfFields) items := make([]*config.FormItem, 0, numOfFields)
for i := 0; i < numOfFields; i++ { for i := 0; i < numOfFields; i++ {
items = append(items, &config.FormItem{ items = append(items, &config.FormItem{
Param: valueOfIn.Field(i).String(), Param: valueOfIn.Field(i).Tag.Get("json"),
Type: valueOfIn.Field(i).Type().String(), Type: valueOfIn.Field(i).Type.Kind().String(),
Require: true, Require: true,
}) })
} }

View File

@ -2,7 +2,6 @@ package service
import ( import (
"context" "context"
push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push"
"testing" "testing"
) )