Compare commits
2 Commits
905a40f1cb
...
efab828c47
Author | SHA1 | Date | |
---|---|---|---|
efab828c47 | |||
dd41d45335 |
@ -144,7 +144,6 @@ func (c *ConnServiceImpl) ReceiveMsg() (errdata *pb.ErrorData, msg *pb.UserMessa
|
||||
msg = &pb.UserMessage{}
|
||||
_, data, err := c.ws.ReadMessage()
|
||||
if err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
logrus.Errorf("readMessage err:%v", err)
|
||||
return
|
||||
}
|
||||
@ -165,10 +164,14 @@ func (c *ConnServiceImpl) handleNotify(msg *pb.UserMessage) (errdata *pb.ErrorDa
|
||||
if msg.MainType == "notify" && msg.SubType == "errornotify" {
|
||||
rsp := &pb.NotifyErrorNotifyPush{}
|
||||
if !comm.ProtoUnmarshal(msg, rsp) {
|
||||
code = pb.ErrorCode_PbError
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_PbError,
|
||||
}
|
||||
return
|
||||
}
|
||||
code = rsp.Code
|
||||
errdata = &pb.ErrorData{
|
||||
Code: rsp.Code,
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
|
@ -78,7 +78,9 @@ func (p *PttServiceImpl) Login(sid, account string) (errdata *pb.ErrorData) {
|
||||
Sid: sid,
|
||||
}
|
||||
if err := p.connService.SendMsg(head, req); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
}
|
||||
logrus.WithField("err", err).Error("Login")
|
||||
return
|
||||
}
|
||||
@ -112,7 +114,9 @@ func (p *PttServiceImpl) CreateRole(nickName string, gender, figure int32) (errd
|
||||
Figure: figure,
|
||||
Gender: gender,
|
||||
}); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
errdata = &pb.ErrorData{
|
||||
Code: pb.ErrorCode_SystemError,
|
||||
}
|
||||
logrus.WithField("err", err).Error("CreateRole")
|
||||
return
|
||||
}
|
||||
|
@ -297,8 +297,8 @@ func (ui *MainWindowImpl) createLoginWin(sid, sname string) {
|
||||
ui.tb.toolbar.Hide()
|
||||
// call after ui.createWindowContainer
|
||||
ui.connService.ListenerPush()
|
||||
if code := ui.pttService.Login(sid, account.Text); errdata != nil {
|
||||
err := fmt.Errorf("login err: %v[%d]", code, int32(code))
|
||||
if errdata := ui.pttService.Login(sid, account.Text); errdata != nil {
|
||||
err := fmt.Errorf("login err: %v[%d]", errdata, int32(errdata.Code))
|
||||
dialog.ShowError(err, ui.w)
|
||||
} else {
|
||||
ui.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
|
||||
@ -417,8 +417,8 @@ func (ui *MainWindowImpl) createRoleWindowPopUp() {
|
||||
d := dialog.NewForm(common.FORM_TITLE_CREATEROLE, common.BUTTON_OK, common.BUTTON_CANCEL, items, func(b bool) {
|
||||
if nickname.Text != "" {
|
||||
logrus.WithField("nickname", nickname.Text).Debug("submit crete role")
|
||||
if code := ui.pttService.CreateRole(nickname.Text, gender, cast.ToInt32(figure.Text)); errdata != nil {
|
||||
err := fmt.Errorf("login err: %v[%d]", code, int32(code))
|
||||
if errdata := ui.pttService.CreateRole(nickname.Text, gender, cast.ToInt32(figure.Text)); errdata != nil {
|
||||
err := fmt.Errorf("login err: %v[%d]", errdata, int32(errdata.Code))
|
||||
dialog.ShowError(err, ui.w)
|
||||
} else {
|
||||
user := ui.pttService.GetUser()
|
||||
|
Loading…
Reference in New Issue
Block a user