This commit is contained in:
liwei1dao 2023-01-29 18:12:09 +08:00
commit 689f6368cf
3 changed files with 51 additions and 12 deletions

View File

@ -4,8 +4,10 @@ import (
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/pb"
"strings"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
)
@ -14,8 +16,16 @@ type SysFuncListView struct {
}
func (this *SysFuncListView) CreateView(t *model.TestCase) fyne.CanvasObject {
keyEntry := widget.NewEntry()
this.form.AppendItem(widget.NewFormItem("Key", keyEntry))
this.form.OnSubmit = func() {
s := strings.SplitN(keyEntry.Text, ",", 2)
req := &pb.SysFuncListReq{}
if s[0] == "" {
req.Keys = []string{}
} else {
req.Keys = s
}
if err := service.GetPttService().SendToClient(
t.MainType,
t.SubType,

View File

@ -22,14 +22,33 @@ func (this *apiComp) Funclist(session comm.IUserSession, req *pb.SysFuncListReq)
}
var funcList []string
confList := this.moduleSys.configure.getOpencondList()
for _, v := range confList {
// 返回未开启的功能列表
for _, conf := range v.Main {
if conf.Key == "platlv" && user.Lv < conf.Param {
funcList = append(funcList, v.Id)
if len(req.Keys) == 0 {
confList := this.moduleSys.configure.getOpencondList()
for _, v := range confList {
// 返回未开启的功能列表
for _, conf := range v.Main {
// 校验玩家等级
if conf.Key == "platlv" && user.Lv >= conf.Param {
funcList = append(funcList, v.Id)
continue
}
}
}
} else {
for _, key := range req.Keys {
opencfg, err := this.moduleSys.configure.getOpencondCfg()
if err != nil {
continue
}
if conf, ok := opencfg.GetDataMap()[key]; ok {
for _, main := range conf.Main {
// 校验玩家等级
if main.Key == "platlv" && user.Lv >= main.Param {
funcList = append(funcList, key)
continue
}
}
}
}
}
rsp.FuncIds = funcList

View File

@ -24,6 +24,8 @@ type SysFuncListReq struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Keys []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys"` //功能ID
}
func (x *SysFuncListReq) Reset() {
@ -58,6 +60,13 @@ func (*SysFuncListReq) Descriptor() ([]byte, []int) {
return file_sys_sys_msg_proto_rawDescGZIP(), []int{0}
}
func (x *SysFuncListReq) GetKeys() []string {
if x != nil {
return x.Keys
}
return nil
}
type SysFuncListResp struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -109,12 +118,13 @@ var File_sys_sys_msg_proto protoreflect.FileDescriptor
var file_sys_sys_msg_proto_rawDesc = []byte{
0x0a, 0x11, 0x73, 0x79, 0x73, 0x2f, 0x73, 0x79, 0x73, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x10, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x71, 0x22, 0x2b, 0x0a, 0x0f, 0x53, 0x79, 0x73, 0x46, 0x75, 0x6e, 0x63,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x75, 0x6e, 0x63,
0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x66, 0x75, 0x6e, 0x63, 0x49,
0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
0x6f, 0x74, 0x6f, 0x22, 0x24, 0x0a, 0x0e, 0x53, 0x79, 0x73, 0x46, 0x75, 0x6e, 0x63, 0x4c, 0x69,
0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20,
0x03, 0x28, 0x09, 0x52, 0x04, 0x6b, 0x65, 0x79, 0x73, 0x22, 0x2b, 0x0a, 0x0f, 0x53, 0x79, 0x73,
0x46, 0x75, 0x6e, 0x63, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07,
0x66, 0x75, 0x6e, 0x63, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x66,
0x75, 0x6e, 0x63, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (