1
This commit is contained in:
parent
b9a61ed9fc
commit
dd3e25c78a
@ -14,6 +14,11 @@ type HistorySeasons struct {
|
||||
WinTimes int `json:"win_times"`
|
||||
}
|
||||
|
||||
type HeadRsp struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
}
|
||||
|
||||
type LoginRsp struct {
|
||||
Errcode int `json:"errcode"`
|
||||
Errmsg string `json:"errmsg"`
|
||||
@ -79,6 +84,7 @@ type GuildMember interface {
|
||||
|
||||
type GuildMgr interface {
|
||||
GetGuildByAccountId(string) Guild
|
||||
GetGuildByGuildName(string) Guild
|
||||
GetRecommendGuilds(string) []Guild
|
||||
GetGuildRank() []Guild
|
||||
AsyncCreateGuild(string, int32, string, func(int32, string, int64))
|
||||
|
@ -4,6 +4,8 @@ import (
|
||||
"cs"
|
||||
"q5"
|
||||
"f5"
|
||||
"fmt"
|
||||
"mt"
|
||||
"github.com/golang/protobuf/proto"
|
||||
"main/common"
|
||||
"main/constant"
|
||||
@ -35,6 +37,10 @@ func (this *player) IsOnline() bool {
|
||||
return this.socket.IsValid()
|
||||
}
|
||||
|
||||
func (this *player) guildIsTooLong(guildName string) bool {
|
||||
return len(guildName) > 15
|
||||
}
|
||||
|
||||
func (this *player) SendMsg(rspMsg proto.Message) {
|
||||
GetWspListener().SendProxyMsg(this.socket.Conn, this.socket.SocketHandle, rspMsg)
|
||||
}
|
||||
@ -380,6 +386,38 @@ func (this *player) CMGetTopGuildsByTotalStars(hdr *f5.MsgHdr, msg *cs.CMGetTopG
|
||||
}
|
||||
|
||||
func (this *player) CMCreateGuild(hdr *f5.MsgHdr, msg *cs.CMCreateGuild) {
|
||||
rspMsg := new(cs.SMCreateGuild)
|
||||
if len(msg.GetName()) <= 0 {
|
||||
this.SendMsg(rspMsg.Err(1, "Name cantnot be empty"))
|
||||
return
|
||||
}
|
||||
if this.guildIsTooLong(msg.GetName()) {
|
||||
this.SendMsg(rspMsg.Err(2, "Name is to long"))
|
||||
return
|
||||
}
|
||||
if GetGuildMgr().GetGuildByAccountId(this.GetAccountId()) != nil {
|
||||
this.SendMsg(rspMsg.Err(3, "You already have a cube"))
|
||||
return
|
||||
}
|
||||
if GetGuildMgr().GetGuildByGuildName(msg.GetName()) != nil {
|
||||
this.SendMsg(rspMsg.Err(4, "Cube name already exists"))
|
||||
return
|
||||
}
|
||||
params := map[string]string{
|
||||
"c": "Bag",
|
||||
"a": "createGuildConsume",
|
||||
"account_id": this.GetAccountId(),
|
||||
"session_id": this.GetSessionId(),
|
||||
}
|
||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
|
||||
rspObj := new(common.HeadRsp)
|
||||
f5.GetHttpCliMgr().SendJsStyleJsonRspRequest(
|
||||
url,
|
||||
params,
|
||||
&rspObj,
|
||||
func(rsp f5.HttpCliResponse) {
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
func (this *player) CMApplyToGuild(hdr *f5.MsgHdr, msg *cs.CMApplyToGuild) {
|
||||
|
@ -126,7 +126,7 @@ func (this *playerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) {
|
||||
"target_id": msg.GetAccountId(),
|
||||
}
|
||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
|
||||
rspObj := &common.LoginRsp{}
|
||||
rspObj := new(common.LoginRsp)
|
||||
var evHandle **SocketCloseEventHandle = new(*SocketCloseEventHandle)
|
||||
handle := f5.GetHttpCliMgr().SendJsStyleJsonRspRequest(
|
||||
url,
|
||||
|
Loading…
x
Reference in New Issue
Block a user