40 lines
669 B
Go
40 lines
669 B
Go
package busi
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
"legu.airobot/lib"
|
|
"legu.airobot/pb"
|
|
)
|
|
|
|
var _ lib.IScene = (*CreateUserScene)(nil)
|
|
|
|
// 创角场景
|
|
type CreateUserScene struct {
|
|
lib.Action
|
|
}
|
|
|
|
func (c *CreateUserScene) Info() lib.SceneInfo {
|
|
return lib.SceneInfo{
|
|
Name: "创角",
|
|
Desc: "",
|
|
}
|
|
}
|
|
|
|
func (c *CreateUserScene) Run(robot lib.IRobot) error {
|
|
user, ok := robot.Get("user.login").(*pb.UserLoginResp)
|
|
if !ok {
|
|
return nil
|
|
}
|
|
req := &pb.UserCreateReq{
|
|
NickName: user.Data.Uid,
|
|
}
|
|
rsp := &pb.UserCreateResp{}
|
|
|
|
code := robot.SendMsg("user", "create", req, rsp)
|
|
if code != pb.ErrorCode_Success {
|
|
return nil
|
|
}
|
|
logrus.Debug(rsp)
|
|
return nil
|
|
}
|