refactor(blazing): 重构登录模块并移除示例代码
- 重构了登录控制器和登录服务,使用了cool框架的控制器和服务结构 - 移除了注册相关代码和不必要的示例代码 - 更新了登录服务,关联了服务器列表模型 - 删除了与示例相关的模型和服务文件
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
package demo
|
package blazing
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "blazing/modules/blazing/controller"
|
_ "blazing/modules/blazing/controller"
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"blazing/cool"
|
||||||
baseservice "blazing/modules/base/service"
|
baseservice "blazing/modules/base/service"
|
||||||
"blazing/modules/blazing/service"
|
"blazing/modules/blazing/service"
|
||||||
|
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
@@ -21,6 +23,23 @@ type SessionRes struct {
|
|||||||
Session string `json:"session"`
|
Session string `json:"session"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BlazingController struct {
|
||||||
|
*cool.Controller
|
||||||
|
}
|
||||||
|
|
||||||
|
var biazing_service = service.NewLoginServiceService()
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
var blazing_controller = &BlazingController{
|
||||||
|
&cool.Controller{
|
||||||
|
Prefix: "/seer/game",
|
||||||
|
Api: []string{},
|
||||||
|
Service: biazing_service,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
// 注册路由
|
||||||
|
cool.RegisterController(blazing_controller)
|
||||||
|
}
|
||||||
func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (res *SessionRes, err error) {
|
func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (res *SessionRes, err error) {
|
||||||
// res = &DemoSampleWelcomeRes{
|
// res = &DemoSampleWelcomeRes{
|
||||||
// BaseRes: cool.Ok("Welcome to Cool Admin Go"),
|
// BaseRes: cool.Ok("Welcome to Cool Admin Go"),
|
||||||
@@ -44,7 +63,7 @@ func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (re
|
|||||||
}
|
}
|
||||||
|
|
||||||
accountID := res1.ID
|
accountID := res1.ID
|
||||||
retsid, sid, err := service.NewLoginServiceService().GetSessionId(accountID)
|
retsid, sid, err := biazing_service.GetSessionId(accountID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.Code = 400
|
res.Code = 400
|
||||||
res.Msg = err.Error()
|
res.Msg = err.Error()
|
||||||
@@ -53,7 +72,7 @@ func (c *BlazingController) GetSession(ctx context.Context, req *SessionReq) (re
|
|||||||
|
|
||||||
res.Session = retsid
|
res.Session = retsid
|
||||||
|
|
||||||
if err := service.NewLoginServiceService().SaveSessionId(sid, gconv.String(accountID)); err != nil {
|
if err := biazing_service.SaveSessionId(sid, gconv.String(accountID)); err != nil {
|
||||||
res.Code = 400
|
res.Code = 400
|
||||||
res.Msg = err.Error()
|
res.Msg = err.Error()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,55 +0,0 @@
|
|||||||
package admin
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"blazing/cool"
|
|
||||||
|
|
||||||
"blazing/modules/blazing/service"
|
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/frame/g"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BlazingController struct {
|
|
||||||
*cool.Controller
|
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
var demo_sample_controller = &BlazingController{
|
|
||||||
&cool.Controller{
|
|
||||||
Prefix: "/seer/game",
|
|
||||||
Api: []string{},
|
|
||||||
Service: service.NewDemoSampleService(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
// 注册路由
|
|
||||||
cool.RegisterController(demo_sample_controller)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 增加 Welcome 演示 方法
|
|
||||||
type RegReq struct {
|
|
||||||
g.Meta `path:"/reg" method:"POST"`
|
|
||||||
Email string `json:"email" v:"required|email"`
|
|
||||||
Password string `json:"password" v:"required"`
|
|
||||||
}
|
|
||||||
type RegRes struct {
|
|
||||||
*cool.BaseRes
|
|
||||||
Data interface{} `json:"data"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *BlazingController) Reg(ctx context.Context, req *RegReq) (res *cool.BaseRes, err error) {
|
|
||||||
// res = &DemoSampleWelcomeRes{
|
|
||||||
// BaseRes: cool.Ok("Welcome to Cool Admin Go"),
|
|
||||||
// Data: gjson.New(`{"name": "Cool Admin Go", "age":0}`),
|
|
||||||
// }
|
|
||||||
if err := g.Validator().Data(req).Run(ctx); err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
res = cool.Ok(err)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
res = cool.Ok("注册成功")
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
42
modules/blazing/model/challenge.go
Normal file
42
modules/blazing/model/challenge.go
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNameChallenge = "challenge"
|
||||||
|
|
||||||
|
// Challenge mapped from table <challenge>
|
||||||
|
type Challenge struct {
|
||||||
|
*cool.Model
|
||||||
|
PlayerID uint64 `gorm:"not null;uniqueIndex:idx_challenge_unique_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||||||
|
MonKingWin int32 `gorm:"not null;default:0;comment:'精灵王之战胜场数'" json:"mon_king_win"`
|
||||||
|
CurStage int16 `gorm:"not null;default:0;comment:'当期勇者之塔到达的层数'" json:"cur_stage"`
|
||||||
|
MaxStage int16 `gorm:"not null;default:0;comment:'历史勇者之塔到达的最大层数'" json:"max_stage"`
|
||||||
|
MessWin int32 `gorm:"not null;default:0;comment:'精灵大乱斗胜场数'" json:"mess_win"`
|
||||||
|
CurFreshStage int16 `gorm:"not null;default:0;comment:'试炼之塔当前层数'" json:"cur_fresh_stage"`
|
||||||
|
MaxFreshStage int16 `gorm:"not null;default:0;comment:'试炼之塔当前层数'" json:"max_fresh_stage"`
|
||||||
|
MaxArenaWins int32 `gorm:"not null;default:0;comment:'最大星际擂台连胜数'" json:"max_arena_wins"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName Challenge's table name
|
||||||
|
func (*Challenge) TableName() string {
|
||||||
|
return TableNameChallenge
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName Challenge's table group
|
||||||
|
func (*Challenge) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewChallenge create a new Challenge
|
||||||
|
func NewChallenge() *Challenge {
|
||||||
|
return &Challenge{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
cool.CreateTable(&Challenge{})
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/cool"
|
|
||||||
)
|
|
||||||
|
|
||||||
const TableNameDemoGoods = "demo_goods"
|
|
||||||
|
|
||||||
// DemoGoods mapped from table <demo_goods>
|
|
||||||
type DemoGoods struct {
|
|
||||||
*cool.Model
|
|
||||||
Name string `gorm:"not null" json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TableName DemoGoods's table name
|
|
||||||
func (*DemoGoods) TableName() string {
|
|
||||||
return TableNameDemoGoods
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupName DemoGoods's table group
|
|
||||||
func (*DemoGoods) GroupName() string {
|
|
||||||
return "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewDemoGoods create a new DemoGoods
|
|
||||||
func NewDemoGoods() *DemoGoods {
|
|
||||||
return &DemoGoods{
|
|
||||||
Model: cool.NewModel(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// init 创建表
|
|
||||||
func init() {
|
|
||||||
cool.CreateTable(&DemoGoods{})
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package model
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/cool"
|
|
||||||
)
|
|
||||||
|
|
||||||
const TableNameDemoSample = "demo_sample"
|
|
||||||
|
|
||||||
// DemoSample mapped from table <demo_sample>
|
|
||||||
type DemoSample struct {
|
|
||||||
*cool.Model
|
|
||||||
// Name string `gorm:"column:name;not null;comment:名称" json:"name"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// TableName DemoSample's table name
|
|
||||||
func (*DemoSample) TableName() string {
|
|
||||||
return TableNameDemoSample
|
|
||||||
}
|
|
||||||
|
|
||||||
// GroupName DemoSample's table group
|
|
||||||
func (*DemoSample) GroupName() string {
|
|
||||||
return "default"
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewDemoSample create a new DemoSample
|
|
||||||
func NewDemoSample() *DemoSample {
|
|
||||||
return &DemoSample{
|
|
||||||
Model: cool.NewModel(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// init 创建表
|
|
||||||
func init() {
|
|
||||||
cool.CreateTable(&DemoSample{})
|
|
||||||
}
|
|
||||||
81
modules/blazing/model/pet.go
Normal file
81
modules/blazing/model/pet.go
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNamePet = "pet"
|
||||||
|
|
||||||
|
// Pet mapped from table <pet>
|
||||||
|
type Pet struct {
|
||||||
|
*cool.Model
|
||||||
|
PlayerID uint64 `gorm:"not null;index:idx_pet_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||||||
|
Data string `gorm:"type:longtext;not null;comment:'精灵全部数据'" json:"data"`
|
||||||
|
}
|
||||||
|
type PetInfo struct {
|
||||||
|
CapturePlayerID uint64 `gorm:"not null;comment:'捕获者ID'" json:"capture_player_id"`
|
||||||
|
CaptureTime int64 `gorm:"not null;comment:'捕获时间(时间戳)'" json:"capture_time"`
|
||||||
|
CaptureMap int32 `gorm:"not null;comment:'捕获地图ID'" json:"capture_map"`
|
||||||
|
CaptureRect int16 `gorm:"not null;default:0;comment:'捕获区域(未知用途,默认为0)'" json:"capture_rect"`
|
||||||
|
CaptureLevel int16 `gorm:"not null;default:0;comment:'捕获时的等级'" json:"capture_level"`
|
||||||
|
PetTypeID int32 `gorm:"not null;comment:'精灵类型ID/精灵图鉴ID'" json:"pet_type_id"`
|
||||||
|
IndividualValue int16 `gorm:"not null;comment:'个体值(DV)'" json:"individual_value"`
|
||||||
|
Nature int16 `gorm:"not null;comment:'性格类型'" json:"nature"`
|
||||||
|
AbilityTypeEnum int16 `gorm:"comment:'特性枚举'" json:"ability_type_enum"`
|
||||||
|
Shiny int32 `gorm:"not null;default:0;comment:'闪光ID(异色!=0,非异色=0)'" json:"shiny"`
|
||||||
|
Level int16 `gorm:"not null;default:1;comment:'当前等级'" json:"level"`
|
||||||
|
CurrentExp int32 `gorm:"not null;default:0;comment:'当前等级已获得经验值'" json:"current_exp"`
|
||||||
|
CurrentHP int32 `gorm:"not null;comment:'当前生命值'" json:"current_hp"`
|
||||||
|
MaxHP int32 `gorm:"not null;comment:'实际最大生命值'" json:"max_hp"`
|
||||||
|
Attack int32 `gorm:"not null;comment:'实际攻击力'" json:"attack"`
|
||||||
|
Defense int32 `gorm:"not null;comment:'实际防御力'" json:"defense"`
|
||||||
|
SpecialAttack int32 `gorm:"not null;comment:'实际特殊攻击力'" json:"special_attack"`
|
||||||
|
SpecialDefense int32 `gorm:"not null;comment:'实际特殊防御力'" json:"special_defense"`
|
||||||
|
Speed int32 `gorm:"not null;comment:'实际速度'" json:"speed"`
|
||||||
|
EvHP int16 `gorm:"not null;default:0;comment:'生命值学习力'" json:"ev_hp"`
|
||||||
|
EvAttack int16 `gorm:"not null;default:0;comment:'攻击学习力'" json:"ev_attack"`
|
||||||
|
EvDefense int16 `gorm:"not null;default:0;comment:'防御学习力'" json:"ev_defense"`
|
||||||
|
EvSpecialAttack int16 `gorm:"not null;default:0;comment:'特殊攻击学习力'" json:"ev_special_attack"`
|
||||||
|
EvSpecialDefense int16 `gorm:"not null;default:0;comment:'特殊防御学习力'" json:"ev_special_defense"`
|
||||||
|
EvSpeed int16 `gorm:"not null;default:0;comment:'速度学习力'" json:"ev_speed"`
|
||||||
|
Skill1ID int32 `gorm:"not null;default:0;comment:'技能1'" json:"skill_1_id"`
|
||||||
|
Skill2ID int32 `gorm:"not null;default:0;comment:'技能2'" json:"skill_2_id"`
|
||||||
|
Skill3ID int32 `gorm:"not null;default:0;comment:'技能3'" json:"skill_3_id"`
|
||||||
|
Skill4ID int32 `gorm:"not null;default:0;comment:'技能4'" json:"skill_4_id"`
|
||||||
|
Skill1PP int16 `gorm:"not null;default:0;comment:'技能1PP'" json:"skill_1_pp"`
|
||||||
|
Skill2PP int16 `gorm:"not null;default:0;comment:'技能2PP'" json:"skill_2_pp"`
|
||||||
|
Skill3PP int16 `gorm:"not null;default:0;comment:'技能3PP'" json:"skill_3_pp"`
|
||||||
|
Skill4PP int16 `gorm:"not null;default:0;comment:'技能4PP'" json:"skill_4_pp"`
|
||||||
|
ElementalOrbID int32 `gorm:"not null;default:0;comment:'属性能量珠ID'" json:"elemental_orb_id"`
|
||||||
|
SpecialOrbID int32 `gorm:"not null;default:0;comment:'平衡/暴击能量珠ID'" json:"special_orb_id"`
|
||||||
|
ElementalOrbCount int16 `gorm:"not null;default:0;comment:'属性能量珠剩余使用次数'" json:"elemental_orb_count"`
|
||||||
|
SpecialOrbCount int16 `gorm:"not null;default:0;comment:'平衡/暴击能量珠剩余使用次数'" json:"special_orb_count"`
|
||||||
|
IndividualGuarantee int64 `gorm:"not null;default:0;comment:'个体值保底(0=无保底)'" json:"individual_guarantee"`
|
||||||
|
NatureGuarantee int64 `gorm:"not null;default:0;comment:'性格保底(0=无保底)'" json:"nature_guarantee"`
|
||||||
|
Freed bool `gorm:"default:false;not null;comment:'是否已放生(0=未放生,1=已放生)'" json:"freed"`
|
||||||
|
FreedTime string `gorm:"comment:'放生时间'" json:"freed_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName Pet's table name
|
||||||
|
func (*Pet) TableName() string {
|
||||||
|
return TableNamePet
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName Pet's table group
|
||||||
|
func (*Pet) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPet create a new Pet
|
||||||
|
func NewPet() *Pet {
|
||||||
|
return &Pet{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
err := cool.CreateTable(&Pet{})
|
||||||
|
fmt.Println(err)
|
||||||
|
}
|
||||||
37
modules/blazing/model/player_bag_item.go
Normal file
37
modules/blazing/model/player_bag_item.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNamePlayerBagItem = "player_bag_item"
|
||||||
|
|
||||||
|
// PlayerBagItem mapped from table <player_bag_item>
|
||||||
|
type PlayerBagItem struct {
|
||||||
|
*cool.Model
|
||||||
|
PlayerID uint64 `gorm:"not null;index:idx_player_bag_item_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||||||
|
ItemID int32 `gorm:"not null;comment:'道具唯一编号'" json:"item_id"`
|
||||||
|
Quantity int32 `gorm:"not null;default:0;comment:'拥有数量(uint16)'" json:"quantity"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName PlayerBagItem's table name
|
||||||
|
func (*PlayerBagItem) TableName() string {
|
||||||
|
return TableNamePlayerBagItem
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName PlayerBagItem's table group
|
||||||
|
func (*PlayerBagItem) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPlayerBagItem create a new PlayerBagItem
|
||||||
|
func NewPlayerBagItem() *PlayerBagItem {
|
||||||
|
return &PlayerBagItem{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
cool.CreateTable(&PlayerBagItem{})
|
||||||
|
}
|
||||||
37
modules/blazing/model/player_battery.go
Normal file
37
modules/blazing/model/player_battery.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNamePlayerBattery = "player_battery"
|
||||||
|
|
||||||
|
// PlayerBattery mapped from table <player_battery>
|
||||||
|
type PlayerBattery struct {
|
||||||
|
*cool.Model
|
||||||
|
PlayerID uint64 `gorm:"not null;uniqueIndex:idx_player_battery_unique_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||||||
|
RemainingTime int64 `gorm:"not null;default:0;comment:'剩余电池时间单位秒(uint32)'" json:"remaining_time"`
|
||||||
|
LastResetTime string `gorm:"comment:'上一次重置时间'" json:"last_reset_time"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName PlayerBattery's table name
|
||||||
|
func (*PlayerBattery) TableName() string {
|
||||||
|
return TableNamePlayerBattery
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName PlayerBattery's table group
|
||||||
|
func (*PlayerBattery) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPlayerBattery create a new PlayerBattery
|
||||||
|
func NewPlayerBattery() *PlayerBattery {
|
||||||
|
return &PlayerBattery{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
cool.CreateTable(&PlayerBattery{})
|
||||||
|
}
|
||||||
56
modules/blazing/model/player_info.go
Normal file
56
modules/blazing/model/player_info.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNamePlayerInfo = "player_info"
|
||||||
|
|
||||||
|
// PlayerInfo mapped from table <player_info>
|
||||||
|
type PlayerInfo struct {
|
||||||
|
*cool.Model
|
||||||
|
AccountID uint64 `gorm:"not null;uniqueIndex:idx_player_info_unique_by_account_id;comment:'所属账户ID'" json:"account_id"`
|
||||||
|
Nickname string `gorm:"type:varchar(16);not null;default:'nieo';comment:'昵称'" json:"nickname"`
|
||||||
|
NieoBean int64 `gorm:"not null;default:0;comment:'尼尔豆(基础货币,uint32)'" json:"nieo_bean"`
|
||||||
|
NieoGoldBean string `gorm:"type:decimal(12,2);not null;default:0;comment:'尼尔金豆(特殊货币,uint32)'" json:"nieo_gold_bean"`
|
||||||
|
EquipmentHead int32 `gorm:"not null;default:0;comment:'头部穿戴装备ID(0=未穿戴)'" json:"equipment_head"`
|
||||||
|
EquipmentFace int32 `gorm:"not null;default:0;comment:'脸部穿戴装备ID'" json:"equipment_face"`
|
||||||
|
EquipmentHand int32 `gorm:"not null;default:0;comment:'手部穿戴装备ID'" json:"equipment_hand"`
|
||||||
|
EquipmentWaist int32 `gorm:"not null;default:0;comment:'腰部穿戴装备ID'" json:"equipment_waist"`
|
||||||
|
EquipmentLeg int32 `gorm:"not null;default:0;comment:'腿部穿戴装备ID'" json:"equipment_leg"`
|
||||||
|
EquipmentBackground int32 `gorm:"not null;default:0;comment:'背景穿戴装备ID'" json:"equipment_background"`
|
||||||
|
RobotColor int64 `gorm:"not null;default:0;comment:'RGB颜色值(uint32,实际为3个uint8)'" json:"robot_color"`
|
||||||
|
HasNono bool `gorm:"default:false;not null;comment:'是否拥普通NONO(布尔转TINYINT)'" json:"has_nono"`
|
||||||
|
HasSuperNono bool `gorm:"default:false;not null;comment:'是否拥超能NONO'" json:"has_super_nono"`
|
||||||
|
NonoNickname string `gorm:"type:varchar(16);not null;default:'NONO';comment:'NONO昵称(byte[16])'" json:"nono_nickname"`
|
||||||
|
NonoColor int64 `gorm:"not null;default:0;comment:'NONO颜色值'" json:"nono_color"`
|
||||||
|
ExpPool int64 `gorm:"not null;default:0;comment:'累计经验池'" json:"exp_pool"`
|
||||||
|
Pet1 int64 `gorm:"not null;default:0;comment:'背包精灵1(首发精灵),捕获时间戳'" json:"pet1"`
|
||||||
|
Pet2 int64 `gorm:"not null;default:0;comment:'背包精灵2'" json:"pet2"`
|
||||||
|
Pet3 int64 `gorm:"not null;default:0;comment:'背包精灵3'" json:"pet3"`
|
||||||
|
Pet4 int64 `gorm:"not null;default:0;comment:'背包精灵4'" json:"pet4"`
|
||||||
|
Pet5 int64 `gorm:"not null;default:0;comment:'背包精灵5'" json:"pet5"`
|
||||||
|
Pet6 int64 `gorm:"not null;default:0;comment:'背包精灵6'" json:"pet6"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName PlayerInfo's table name
|
||||||
|
func (*PlayerInfo) TableName() string {
|
||||||
|
return TableNamePlayerInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName PlayerInfo's table group
|
||||||
|
func (*PlayerInfo) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewPlayerInfo create a new PlayerInfo
|
||||||
|
func NewPlayerInfo() *PlayerInfo {
|
||||||
|
return &PlayerInfo{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
cool.CreateTable(&PlayerInfo{})
|
||||||
|
}
|
||||||
37
modules/blazing/model/server_list.go
Normal file
37
modules/blazing/model/server_list.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNameServerList = "server_list"
|
||||||
|
|
||||||
|
// ServerList mapped from table <server_list>
|
||||||
|
type ServerList struct {
|
||||||
|
*cool.Model
|
||||||
|
IP string `gorm:"type:varchar(16);comment:'服务器IP'" json:"ip"`
|
||||||
|
Port uint16 `gorm:"comment:'端口号,通常是小整数'" json:"port"`
|
||||||
|
IsOpen bool `gorm:"default:true;not null;comment:'服务器是否开启,默认为开启状态'" json:"is_open"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName ServerList's table name
|
||||||
|
func (*ServerList) TableName() string {
|
||||||
|
return TableNameServerList
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName ServerList's table group
|
||||||
|
func (*ServerList) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewServerList create a new ServerList
|
||||||
|
func NewServerList() *ServerList {
|
||||||
|
return &ServerList{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
cool.CreateTable(&ServerList{})
|
||||||
|
}
|
||||||
56
modules/blazing/model/soul_orb.go
Normal file
56
modules/blazing/model/soul_orb.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"blazing/cool"
|
||||||
|
)
|
||||||
|
|
||||||
|
const TableNameSoulOrb = "soul_orb"
|
||||||
|
|
||||||
|
// SoulOrb mapped from table <soul_orb>
|
||||||
|
type SoulOrb struct {
|
||||||
|
*cool.Model
|
||||||
|
PlayerID uint64 `gorm:"not null;index:idx_soul_orb_by_player_id;comment:'所属玩家ID'" json:"player_id"`
|
||||||
|
ItemID int64 `gorm:"not null;comment:'对应物品ID'" json:"item_id"`
|
||||||
|
ObtainTime int64 `gorm:"not null;comment:'捕获时间(时间戳)'" json:"obtain_time"`
|
||||||
|
StartHatchTime string `gorm:"comment:'开始孵化时间'" json:"start_hatch_time"`
|
||||||
|
HatchTime int32 `gorm:"not null;default:0;comment:'剩余孵化时间(秒)'" json:"hatch_time"`
|
||||||
|
PetTypeID int32 `gorm:"not null;comment:'精灵类型ID/精灵图鉴ID'" json:"pet_type_id"`
|
||||||
|
IndividualValue int16 `gorm:"not null;comment:'个体值(DV)'" json:"individual_value"`
|
||||||
|
Nature int16 `gorm:"not null;comment:'性格类型'" json:"nature"`
|
||||||
|
AbilityTypeEnum int16 `gorm:"comment:'特性枚举'" json:"ability_type_enum"`
|
||||||
|
IsShiny int32 `gorm:"not null;default:0;comment:'是否为闪光宠物(1=是,0=否)'" json:"is_shiny"`
|
||||||
|
Level int16 `gorm:"not null;default:1;comment:'当前等级'" json:"level"`
|
||||||
|
CurrentExp int32 `gorm:"not null;default:0;comment:'当前等级已获得经验值'" json:"current_exp"`
|
||||||
|
EvHP int16 `gorm:"not null;default:0;comment:'生命值学习力'" json:"ev_hp"`
|
||||||
|
EvAttack int16 `gorm:"not null;default:0;comment:'攻击学习力'" json:"ev_attack"`
|
||||||
|
EvDefense int16 `gorm:"not null;default:0;comment:'防御学习力'" json:"ev_defense"`
|
||||||
|
EvSpecialAttack int16 `gorm:"not null;default:0;comment:'特殊攻击学习力'" json:"ev_special_attack"`
|
||||||
|
EvSpecialDefense int16 `gorm:"not null;default:0;comment:'特殊防御学习力'" json:"ev_special_defense"`
|
||||||
|
EvSpeed int16 `gorm:"not null;default:0;comment:'速度学习力'" json:"ev_speed"`
|
||||||
|
Skill1ID int32 `gorm:"not null;default:0;comment:'技能1'" json:"skill_1_id"`
|
||||||
|
Skill2ID int32 `gorm:"not null;default:0;comment:'技能2'" json:"skill_2_id"`
|
||||||
|
Skill3ID int32 `gorm:"not null;default:0;comment:'技能3'" json:"skill_3_id"`
|
||||||
|
Skill4ID int32 `gorm:"not null;default:0;comment:'技能4'" json:"skill_4_id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TableName SoulOrb's table name
|
||||||
|
func (*SoulOrb) TableName() string {
|
||||||
|
return TableNameSoulOrb
|
||||||
|
}
|
||||||
|
|
||||||
|
// GroupName SoulOrb's table group
|
||||||
|
func (*SoulOrb) GroupName() string {
|
||||||
|
return "default"
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewSoulOrb create a new SoulOrb
|
||||||
|
func NewSoulOrb() *SoulOrb {
|
||||||
|
return &SoulOrb{
|
||||||
|
Model: cool.NewModel(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// init 创建表
|
||||||
|
func init() {
|
||||||
|
cool.CreateTable(&SoulOrb{})
|
||||||
|
}
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/cool"
|
|
||||||
|
|
||||||
"blazing/modules/blazing/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DemoGoodsService struct {
|
|
||||||
*cool.Service
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDemoGoodsService() *DemoGoodsService {
|
|
||||||
return &DemoGoodsService{
|
|
||||||
&cool.Service{
|
|
||||||
Model: model.NewDemoGoods(),
|
|
||||||
ListQueryOp: &cool.QueryOp{
|
|
||||||
|
|
||||||
Join: []*cool.JoinOp{},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/cool"
|
|
||||||
|
|
||||||
"blazing/modules/blazing/model"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DemoSampleService struct {
|
|
||||||
*cool.Service
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDemoSampleService() *DemoSampleService {
|
|
||||||
return &DemoSampleService{
|
|
||||||
&cool.Service{
|
|
||||||
Model: model.NewDemoSample(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package service
|
|
||||||
|
|
||||||
import (
|
|
||||||
"blazing/cool"
|
|
||||||
)
|
|
||||||
|
|
||||||
type DemoTestService struct {
|
|
||||||
*cool.Service
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewDemoTestService() *DemoTestService {
|
|
||||||
return &DemoTestService{
|
|
||||||
&cool.Service{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *DemoTestService) GetDemoTestList() (interface{}, error) {
|
|
||||||
// gsvc.SetRegistry(etcd.New(`127.0.0.1:2379`))
|
|
||||||
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
@@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"blazing/cool"
|
"blazing/cool"
|
||||||
|
"blazing/modules/blazing/model"
|
||||||
"context"
|
"context"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
@@ -20,7 +21,9 @@ type LoginService struct {
|
|||||||
|
|
||||||
func NewLoginServiceService() *LoginService {
|
func NewLoginServiceService() *LoginService {
|
||||||
return &LoginService{
|
return &LoginService{
|
||||||
&cool.Service{},
|
&cool.Service{
|
||||||
|
Model: model.NewServerList(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user