36 lines
750 B
Go
36 lines
750 B
Go
package formview
|
|
|
|
import (
|
|
"go_dreamfactory/cmd/v2/model"
|
|
"go_dreamfactory/cmd/v2/service"
|
|
"go_dreamfactory/comm"
|
|
"go_dreamfactory/pb"
|
|
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/widget"
|
|
"github.com/sirupsen/logrus"
|
|
"github.com/spf13/cast"
|
|
)
|
|
|
|
type GourmentGetRandView struct {
|
|
BaseformView
|
|
}
|
|
|
|
func (this *GourmentGetRandView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|
peopleEntry := widget.NewEntry()
|
|
|
|
this.form.AppendItem(widget.NewFormItem("People", peopleEntry))
|
|
this.form.OnSubmit = func() {
|
|
if err := service.GetPttService().SendToClient(
|
|
string(comm.ModuleGourmet),
|
|
"getranduser",
|
|
&pb.GourmetGetRandUserReq{
|
|
People: cast.ToInt32(peopleEntry.Text),
|
|
}); err != nil {
|
|
logrus.Error(err)
|
|
}
|
|
}
|
|
|
|
return this.form
|
|
}
|