From 56f3155d99fdd7310c7f073f8ac4513033b05032 Mon Sep 17 00:00:00 2001 From: timerzz Date: Tue, 21 May 2024 13:44:46 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E8=8E=B7=E5=8F=96optio?= =?UTF-8?q?n=20items=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- biz/service/add_test.go | 1 - biz/service/get_pusher_options.go | 6 +++--- biz/service/get_pusher_options_test.go | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/biz/service/add_test.go b/biz/service/add_test.go index 2bc0c8f..18cc06b 100644 --- a/biz/service/add_test.go +++ b/biz/service/add_test.go @@ -3,7 +3,6 @@ package service import ( "context" config "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/config" - push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push" "testing" ) diff --git a/biz/service/get_pusher_options.go b/biz/service/get_pusher_options.go index 5e6f715..650d65c 100644 --- a/biz/service/get_pusher_options.go +++ b/biz/service/get_pusher_options.go @@ -26,13 +26,13 @@ func (s *GetPusherOptionsService) Run() (resp *push.GetPusherOptionsResponse, er } func toFormItems(in any) []*config.FormItem { - valueOfIn := reflect.ValueOf(in) + valueOfIn := reflect.TypeOf(in) numOfFields := valueOfIn.NumField() items := make([]*config.FormItem, 0, numOfFields) for i := 0; i < numOfFields; i++ { items = append(items, &config.FormItem{ - Param: valueOfIn.Field(i).String(), - Type: valueOfIn.Field(i).Type().String(), + Param: valueOfIn.Field(i).Tag.Get("json"), + Type: valueOfIn.Field(i).Type.Kind().String(), Require: true, }) } diff --git a/biz/service/get_pusher_options_test.go b/biz/service/get_pusher_options_test.go index e83d411..669d634 100644 --- a/biz/service/get_pusher_options_test.go +++ b/biz/service/get_pusher_options_test.go @@ -2,7 +2,6 @@ package service import ( "context" - push "gitea.timerzz.com/kedaya_haitao/pusher/kitex_gen/push" "testing" )