3.10公会预创建
This commit is contained in:
parent
cb6410730c
commit
0eeb1799be
@ -634,7 +634,7 @@
|
||||
406
|
||||
],
|
||||
"completetask": 0,
|
||||
"auto_accept": 1,
|
||||
"auto_accept": 0,
|
||||
"overtips": 1,
|
||||
"reword": [],
|
||||
"module": []
|
||||
@ -747,7 +747,7 @@
|
||||
},
|
||||
"npc": [
|
||||
"bossfight_pt_02",
|
||||
"新手引导-波比-右屏圣树1",
|
||||
"3新手引导-波比-正常待机-中轴城",
|
||||
"901"
|
||||
],
|
||||
"receivenpc": [
|
||||
@ -787,7 +787,7 @@
|
||||
},
|
||||
"npc": [
|
||||
"bossfight_pt_02",
|
||||
"新手引导-波比-右屏圣树2",
|
||||
"3新手引导-波比-正常待机-中轴城",
|
||||
"901"
|
||||
],
|
||||
"receivenpc": [
|
||||
@ -993,7 +993,7 @@
|
||||
},
|
||||
"npc": [
|
||||
"bossfight_pt_02",
|
||||
"新手引导-波比-右屏圣树3",
|
||||
"3新手引导-波比-正常待机-中轴城",
|
||||
"901"
|
||||
],
|
||||
"receivenpc": [
|
||||
@ -1033,7 +1033,7 @@
|
||||
},
|
||||
"npc": [
|
||||
"bossfight_pt_02",
|
||||
"新手引导-波比-右屏圣树3",
|
||||
"3新手引导-波比-正常待机-中轴城",
|
||||
"901"
|
||||
],
|
||||
"receivenpc": [
|
||||
|
@ -4,5 +4,5 @@ Website = "http://legu.cc"
|
||||
Icon = "app.png"
|
||||
Name = "RobotGUI"
|
||||
ID = "cc.legu.app"
|
||||
Version = "1.2.10"
|
||||
Build = 40
|
||||
Version = "1.2.11"
|
||||
Build = 41
|
||||
|
@ -41,6 +41,12 @@ type Config struct {
|
||||
MgoDB *MgoDB `json:"mgoDB,omitempty"` //MongoDB配置
|
||||
ServiceDBInfo *pb.ServiceDBInfo `json:"serviceDBInfo,omitempty"` //
|
||||
JsonDir string `json:"jsonDir,omitempty"` //json配置目录
|
||||
PingConf *PingConf `json:"pingConf,omitempty"` //ping配置
|
||||
}
|
||||
|
||||
type PingConf struct {
|
||||
Host string
|
||||
Ports string
|
||||
}
|
||||
|
||||
type MgoDB struct {
|
||||
|
@ -3,6 +3,7 @@ package ui
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
os_storage "go_dreamfactory/cmd/v2/lib/storage"
|
||||
"go_dreamfactory/cmd/v2/service"
|
||||
"go_dreamfactory/cmd/v2/service/observer"
|
||||
"net"
|
||||
@ -37,17 +38,56 @@ func (this *appPing) LazyInit(ptService service.PttService, obs observer.Observe
|
||||
|
||||
targetHost := widget.NewEntry()
|
||||
targetHost.PlaceHolder = "目标主机Ip"
|
||||
//load
|
||||
storage, _ := os_storage.NewOSStorage()
|
||||
conf, err := storage.LoadConfig()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
portEntry := widget.NewMultiLineEntry()
|
||||
portEntry.Text = "20,21,22,80,1521,2379,2380,3306,6379,8080,8020,8500,9000,9090,13306,50070,27019,10013,8300,8301,8600,10012,10011"
|
||||
saveBtn := widget.NewButton("保存配置", func() {
|
||||
pingConf := &os_storage.PingConf{
|
||||
Host: targetHost.Text,
|
||||
Ports: portEntry.Text,
|
||||
}
|
||||
conf.PingConf = pingConf
|
||||
if err := storage.StoreConfig(conf); err != nil {
|
||||
logrus.WithField("err", err).Debug("保存配置")
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
form := widget.NewForm(
|
||||
widget.NewFormItem("主机", targetHost),
|
||||
widget.NewFormItem("端口", portEntry),
|
||||
widget.NewFormItem("端口", container.NewBorder(nil, nil, nil, saveBtn, portEntry)),
|
||||
)
|
||||
|
||||
if conf.PingConf != nil {
|
||||
targetHost.SetText(conf.PingConf.Host)
|
||||
portEntry.SetText(conf.PingConf.Ports)
|
||||
}
|
||||
// result
|
||||
result := widget.NewMultiLineEntry()
|
||||
result.Disable()
|
||||
|
||||
//初始化端口对应说明字典
|
||||
portDesc := map[int]string{
|
||||
7891: "websocket",
|
||||
10013: "MongoDB",
|
||||
10011: "Redis",
|
||||
10012: "Consul",
|
||||
9567: "gateway",
|
||||
9568: "mainte",
|
||||
9569: "worker",
|
||||
9897: "battle",
|
||||
8001: "cross_mainte",
|
||||
9570: "cross_worker",
|
||||
8000: "web",
|
||||
9571: "cross_web",
|
||||
}
|
||||
|
||||
form.OnSubmit = func() {
|
||||
result.Text = ""
|
||||
if portEntry.Text == "" {
|
||||
@ -87,13 +127,17 @@ func (this *appPing) LazyInit(ptService service.PttService, obs observer.Observe
|
||||
this.ping(ip.String(), ports)
|
||||
|
||||
for p := range this.resultCh {
|
||||
msgs = append(msgs, fmt.Sprintf("端口:%d %s", p.port, p.err))
|
||||
desc, ok := portDesc[p.port]
|
||||
if !ok {
|
||||
desc = "未知"
|
||||
}
|
||||
msgs = append(msgs, fmt.Sprintf("%s 端口:%d %s", desc, p.port, p.err))
|
||||
result.Text = strings.Join(msgs, "\n")
|
||||
result.Refresh()
|
||||
}
|
||||
|
||||
}
|
||||
form.Items[1].HintText = "多个端口使用英文,号分隔"
|
||||
form.SubmitText = "Ping"
|
||||
|
||||
result.OnChanged = func(s string) {
|
||||
result.Refresh()
|
||||
|
@ -130,7 +130,7 @@ func (this *Sociaty) MembersBySociatyId(sociatyId string) (list []*pb.SociatyMem
|
||||
return this.modelSociaty.members(sociaty)
|
||||
}
|
||||
|
||||
//公会
|
||||
// 公会
|
||||
func (this *Sociaty) Reddot(session comm.IUserSession, rid ...comm.ReddotType) (reddot map[comm.ReddotType]bool) {
|
||||
reddot = make(map[comm.ReddotType]bool)
|
||||
sociaty := this.modelSociaty.getUserSociaty(session.GetUserId())
|
||||
@ -192,7 +192,7 @@ type SociatyUpdateParam struct {
|
||||
Update map[string]interface{}
|
||||
}
|
||||
|
||||
//跨服更新数据
|
||||
// 跨服更新数据
|
||||
func (this *Sociaty) RpcUpdateSociaty(ctx context.Context, req *SociatyUpdateParam, reply *pb.DBSociaty) error {
|
||||
return this.modelSociaty.ChangeList(comm.RDS_EMPTY, req.SociatyId, req.Update)
|
||||
}
|
||||
@ -308,3 +308,23 @@ func (this *Sociaty) RpcGetUserTask(ctx context.Context, p *pb.RPCGeneralReqA2,
|
||||
reply.LastUpdateTime = dt.LastUpdateTime
|
||||
return nil
|
||||
}
|
||||
|
||||
// 创建公会3.10
|
||||
func (this *Sociaty) CreateSociaty(uid, sociatyName string) error {
|
||||
//创建公会
|
||||
sociaty := &pb.DBSociaty{
|
||||
Creater: uid,
|
||||
Name: sociatyName,
|
||||
Icon: "wp_icon_10015",
|
||||
ApplyLv: 1,
|
||||
}
|
||||
|
||||
//会长
|
||||
sociaty.Members = append(sociaty.Members, &pb.SociatyMember{
|
||||
Uid: uid,
|
||||
Job: pb.SociatyJob_PRESIDENT, //创建人是会长
|
||||
Ctime: configure.Now().Unix(),
|
||||
})
|
||||
|
||||
return this.modelSociaty.create(sociaty)
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.UserCreateRe
|
||||
return
|
||||
}
|
||||
|
||||
//创角
|
||||
// 创角
|
||||
func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (code pb.ErrorCode, data proto.Message) {
|
||||
if code = this.CreateCheck(session, req); code != pb.ErrorCode_Success {
|
||||
return
|
||||
@ -112,6 +112,9 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
|
||||
//初始化用户设置
|
||||
// this.module.modelSetting.InitSetting(session.GetUserId())
|
||||
|
||||
//初始化公会 date3.10
|
||||
this.module.CrossCreateSociaty(uid, req.NickName)
|
||||
|
||||
if err := session.SendMsg(string(this.module.GetType()), UserSubTypeCreate, &pb.UserCreateResp{IsSucc: true}); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/sys/db"
|
||||
"go_dreamfactory/utils"
|
||||
"strings"
|
||||
@ -24,6 +25,7 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
@ -36,6 +38,9 @@ const (
|
||||
Rpc_GetCrossUserSession string = "Rpc_GetCrossUserSession"
|
||||
// 搜索用户
|
||||
Rpc_QueryUser = "Rpc_QueryUser"
|
||||
|
||||
//创建公会
|
||||
Rpc_CreateSociaty string = "Rpc_CreateSociaty"
|
||||
)
|
||||
|
||||
var _ comm.IUser = (*User)(nil)
|
||||
@ -78,6 +83,8 @@ func (this *User) Start() (err error) {
|
||||
this.service.RegisterFunctionName(Rpc_GetCrossUser, this.RpcGetCrossUser)
|
||||
this.service.RegisterFunctionName(Rpc_GetCrossUserSession, this.RpcGetCrossUserSession)
|
||||
this.service.RegisterFunctionName(Rpc_QueryUser, this.RpcQueryUser)
|
||||
//date 3.10
|
||||
this.service.RegisterFunctionName(Rpc_CreateSociaty, this.RpcCreateSociaty)
|
||||
this.globalConf = this.configure.GetGlobalConf()
|
||||
if this.globalConf == nil {
|
||||
err = errors.New("global config not found")
|
||||
@ -237,6 +244,45 @@ func (this *User) CrossUserSession(uid string) *pb.CacheUser {
|
||||
return cacheUser
|
||||
}
|
||||
|
||||
// 跨服创建玩家公会 date 3.10
|
||||
func (this *User) CrossCreateSociaty(uid, sociatyName string) *pb.EmptyResp {
|
||||
this.service.AcrossClusterRpcCall(context.Background(), this.GetCrossTag(),
|
||||
comm.Service_Worker, Rpc_CreateSociaty, &pb.RPCGeneralReqA2{Param1: uid, Param2: sociatyName}, &pb.EmptyResp{})
|
||||
return nil
|
||||
}
|
||||
|
||||
// date 3.10
|
||||
func (this *User) RpcCreateSociaty(ctx context.Context, req *pb.RPCGeneralReqA2, reply *pb.EmptyResp) error {
|
||||
conn, err := db.Local()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
model := db.NewDBModel(comm.TableSociaty, 0, conn)
|
||||
|
||||
sociaty := &pb.DBSociaty{}
|
||||
_id := primitive.NewObjectID().Hex()
|
||||
sociaty.Creater = req.Param1
|
||||
sociaty.Name = req.Param2
|
||||
sociaty.Icon = "wp_icon_10015"
|
||||
sociaty.ApplyLv = 1
|
||||
sociaty.Id = _id
|
||||
sociaty.Ctime = configure.Now().Unix()
|
||||
sociaty.Lv = 1 //默认1级
|
||||
|
||||
sociaty.Members = append(sociaty.Members, &pb.SociatyMember{
|
||||
Uid: req.Param1,
|
||||
Job: pb.SociatyJob_PRESIDENT,
|
||||
Ctime: configure.Now().Unix(),
|
||||
})
|
||||
|
||||
if err := model.AddList(comm.RDS_EMPTY, sociaty.Id, sociaty); err != nil {
|
||||
if err != mongo.ErrNoDocuments {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 跨服搜索用户
|
||||
func (this *User) CrossSearchUser(nickName string) ([]*pb.DBUser, error) {
|
||||
name := strings.TrimSpace(nickName)
|
||||
|
Loading…
Reference in New Issue
Block a user