修复跨服用户搜索
This commit is contained in:
parent
835f88650b
commit
5bbaada9e2
@ -4,5 +4,5 @@ Website = "http://legu.cc"
|
|||||||
Icon = "app.png"
|
Icon = "app.png"
|
||||||
Name = "RobotGUI"
|
Name = "RobotGUI"
|
||||||
ID = "cc.legu.app"
|
ID = "cc.legu.app"
|
||||||
Version = "1.0.15"
|
Version = "1.0.16"
|
||||||
Build = 18
|
Build = 19
|
||||||
|
@ -174,7 +174,7 @@ var (
|
|||||||
ff(comm.ModuleFriend, friend.FriendSubTypeBlacklist),
|
ff(comm.ModuleFriend, friend.FriendSubTypeBlacklist),
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeAddBlack),
|
ff(comm.ModuleFriend, friend.FriendSubTypeAddBlack),
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeDelBlack),
|
ff(comm.ModuleFriend, friend.FriendSubTypeDelBlack),
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeSearch),
|
// ff(comm.ModuleFriend, friend.FriendSubTypeSearch),
|
||||||
// ff(comm.ModuleFriend, friend.FriendSubTypeZanList),
|
// ff(comm.ModuleFriend, friend.FriendSubTypeZanList),
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeRandList),
|
ff(comm.ModuleFriend, friend.FriendSubTypeRandList),
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeGetreward),
|
ff(comm.ModuleFriend, friend.FriendSubTypeGetreward),
|
||||||
@ -586,15 +586,15 @@ var (
|
|||||||
Rsp: &pb.FriendAgreeResp{},
|
Rsp: &pb.FriendAgreeResp{},
|
||||||
Enabled: true,
|
Enabled: true,
|
||||||
},
|
},
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeSearch): {
|
// ff(comm.ModuleFriend, friend.FriendSubTypeSearch): {
|
||||||
NavLabel: "好友搜索",
|
// NavLabel: "好友搜索",
|
||||||
Desc: "搜索好友",
|
// Desc: "搜索好友",
|
||||||
MainType: string(comm.ModuleFriend),
|
// MainType: string(comm.ModuleFriend),
|
||||||
SubType: friend.FriendSubTypeSearch,
|
// SubType: friend.FriendSubTypeSearch,
|
||||||
Req: &pb.FriendSearchReq{},
|
// Req: &pb.FriendSearchReq{},
|
||||||
Rsp: &pb.FriendSearchResp{},
|
// Rsp: &pb.FriendSearchResp{},
|
||||||
Enabled: true,
|
// Enabled: true,
|
||||||
},
|
// },
|
||||||
ff(comm.ModuleFriend, friend.FriendSubTypeAssistHero): {
|
ff(comm.ModuleFriend, friend.FriendSubTypeAssistHero): {
|
||||||
NavLabel: "助战英雄",
|
NavLabel: "助战英雄",
|
||||||
Desc: "助战英雄",
|
Desc: "助战英雄",
|
||||||
|
@ -11,14 +11,16 @@ import (
|
|||||||
|
|
||||||
type FriendAssistListView struct {
|
type FriendAssistListView struct {
|
||||||
BaseformView
|
BaseformView
|
||||||
|
friendAssistList func()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *FriendAssistListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
func (this *FriendAssistListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
this.form.OnSubmit = func() {
|
this.friendAssistList = func() {
|
||||||
if err := service.GetPttService().SendToClient(t.MainType, t.SubType,
|
if err := service.GetPttService().SendToClient(t.MainType, t.SubType,
|
||||||
&pb.FriendAssistlistReq{}); err != nil {
|
&pb.FriendAssistlistReq{}); err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
defer this.friendAssistList()
|
||||||
return this.form
|
return this.form
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,25 @@ func (this *FriendRandListView) CreateView(t *model.TestCase) fyne.CanvasObject
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
btnBar := container.NewHBox(refreshBtn, friendApplyBtn)
|
nicknameEntry := widget.NewEntry()
|
||||||
|
nicknameEntry.PlaceHolder = "搜索昵称"
|
||||||
|
searchBtn := widget.NewButtonWithIcon("", theme.SearchIcon(), func() {
|
||||||
|
if nicknameEntry.Text == "" {
|
||||||
|
common.ShowTip("请输入昵称")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.itemList.Reset()
|
||||||
|
if err := service.GetPttService().SendToClient(
|
||||||
|
t.MainType,
|
||||||
|
friend.FriendSubTypeSearch,
|
||||||
|
&pb.FriendSearchReq{NickName: nicknameEntry.Text},
|
||||||
|
); err != nil {
|
||||||
|
logrus.Error(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
btnBar := container.NewBorder(nil, nil, container.NewHBox(refreshBtn, friendApplyBtn), searchBtn, nicknameEntry)
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
c := container.NewBorder(btnBar, nil, nil, nil, this.itemList.ItemList)
|
c := container.NewBorder(btnBar, nil, nil, nil, this.itemList.ItemList)
|
||||||
@ -72,23 +90,33 @@ func (this *FriendRandListView) dataListener() {
|
|||||||
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
|
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
|
||||||
OnNotify: func(d interface{}, args ...interface{}) {
|
OnNotify: func(d interface{}, args ...interface{}) {
|
||||||
data := d.(*pb.UserMessage)
|
data := d.(*pb.UserMessage)
|
||||||
if !(data.MainType == string(comm.ModuleFriend) &&
|
|
||||||
data.SubType == friend.FriendSubTypeRandList) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
rsp := &pb.FriendRandlistResp{}
|
|
||||||
|
|
||||||
if !comm.ProtoUnmarshal(data, rsp) {
|
if data.MainType == string(comm.ModuleFriend) && data.SubType == friend.FriendSubTypeRandList {
|
||||||
logrus.Error("unmarshal err")
|
rsp := &pb.FriendRandlistResp{}
|
||||||
return
|
if !comm.ProtoUnmarshal(data, rsp) {
|
||||||
}
|
logrus.Error("unmarshal err")
|
||||||
|
return
|
||||||
for _, v := range rsp.List {
|
}
|
||||||
item := common.Item{
|
for i, v := range rsp.List {
|
||||||
Id: v.UserId,
|
item := common.Item{
|
||||||
Text: fmt.Sprintf("%s 服务:%s", v.NickName, v.ServerId),
|
Id: v.UserId,
|
||||||
|
Text: fmt.Sprintf("%d 昵称:%s 服务:%s", i+1, v.NickName, v.ServerId),
|
||||||
|
}
|
||||||
|
this.itemList.AddItem(item)
|
||||||
|
}
|
||||||
|
} else if data.MainType == string(comm.ModuleFriend) && data.SubType == friend.FriendSubTypeSearch {
|
||||||
|
rsp := &pb.FriendSearchResp{}
|
||||||
|
if !comm.ProtoUnmarshal(data, rsp) {
|
||||||
|
logrus.Error("unmarshal err")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
for i, v := range rsp.Friends {
|
||||||
|
item := common.Item{
|
||||||
|
Id: v.UserId,
|
||||||
|
Text: fmt.Sprintf("%d 昵称:%s 服务:%s", i+1, v.NickName, v.ServerId),
|
||||||
|
}
|
||||||
|
this.itemList.AddItem(item)
|
||||||
}
|
}
|
||||||
this.itemList.AddItem(item)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
@ -30,6 +30,10 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, u := range users {
|
for _, u := range users {
|
||||||
|
// 排除自己
|
||||||
|
if u.Uid == session.GetUserId() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
resp.Friends = append(resp.Friends, &pb.FriendBase{
|
resp.Friends = append(resp.Friends, &pb.FriendBase{
|
||||||
UserId: u.Uid,
|
UserId: u.Uid,
|
||||||
NickName: u.Name,
|
NickName: u.Name,
|
||||||
|
Loading…
Reference in New Issue
Block a user