Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
37d782032c
44
bin/json/game_privilege.json
Normal file
44
bin/json/game_privilege.json
Normal file
@ -0,0 +1,44 @@
|
||||
[
|
||||
{
|
||||
"privilege_id": 10001,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10001",
|
||||
"text": "特权描述1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10002,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10002",
|
||||
"text": "特权描述2"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10003,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10003",
|
||||
"text": "特权描述3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10004,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10004",
|
||||
"text": "特权描述4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10005,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10005",
|
||||
"text": "特权描述5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"privilege_id": 10006,
|
||||
"privilege_describe": {
|
||||
"key": "privilegecard_10006",
|
||||
"text": "特权描述6"
|
||||
}
|
||||
}
|
||||
]
|
50
bin/json/game_privilegecard.json
Normal file
50
bin/json/game_privilegecard.json
Normal file
@ -0,0 +1,50 @@
|
||||
[
|
||||
{
|
||||
"id": 1,
|
||||
"name": "经典月卡",
|
||||
"proid": "yueka_lv1",
|
||||
"assert_day": 30,
|
||||
"renew_day": 3,
|
||||
"day_reward": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 60
|
||||
}
|
||||
],
|
||||
"disposable_reward": {
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 300
|
||||
},
|
||||
"privilege_id": [
|
||||
10001,
|
||||
10002,
|
||||
10003
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "典藏月卡",
|
||||
"proid": "yueka_lv2",
|
||||
"assert_day": 30,
|
||||
"renew_day": 3,
|
||||
"day_reward": [
|
||||
{
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 90
|
||||
}
|
||||
],
|
||||
"disposable_reward": {
|
||||
"a": "attr",
|
||||
"t": "diamond",
|
||||
"n": 980
|
||||
},
|
||||
"privilege_id": [
|
||||
10004,
|
||||
10005,
|
||||
10006
|
||||
]
|
||||
}
|
||||
]
|
@ -4,20 +4,20 @@
|
||||
"name": "右屏商人",
|
||||
"information": "这是一位熊猫商人",
|
||||
"ico": "action_11001",
|
||||
"time": 10
|
||||
"time": 300
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"name": "上屏商人",
|
||||
"information": "这是一位波比商人再此",
|
||||
"ico": "action_11003",
|
||||
"time": 10
|
||||
"time": 300
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"name": "左屏商人",
|
||||
"information": "这是一位滑板鞋王子",
|
||||
"ico": "ytx_js_14007",
|
||||
"time": 10
|
||||
"time": 300
|
||||
}
|
||||
]
|
@ -63,6 +63,7 @@ type Item struct {
|
||||
Quantity int `json:"quantity"`
|
||||
Checked bool `json:"checked"`
|
||||
Size int64 `json:"size"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
func NewList(name string) List {
|
||||
|
@ -52,8 +52,8 @@ func (a *appTester) LazyInit(service service.PttService, obs observer.Observer)
|
||||
|
||||
if view, ok := viewRegister[viewKey]; ok {
|
||||
timeLbl := widget.NewLabel("time")
|
||||
view.Init(service, obs, globalWin.w)
|
||||
resLog := widget.NewMultiLineEntry()
|
||||
view.Init(service, obs, globalWin.w, resLog)
|
||||
|
||||
obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
|
||||
OnNotify: func(data interface{}, args ...interface{}) {
|
||||
|
@ -22,13 +22,14 @@ import (
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/sirupsen/logrus"
|
||||
"github.com/spf13/cast"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
type MyCaseView interface {
|
||||
Init(service service.PttService, obs observer.Observer, w fyne.Window)
|
||||
Init(service service.PttService, obs observer.Observer, w fyne.Window, res *widget.Entry)
|
||||
CreateView(t *model.TestCase) fyne.CanvasObject
|
||||
Load()
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ type toyUserInfo struct {
|
||||
obs observer.Observer
|
||||
copyBtn *widget.Button
|
||||
refreshBtn *widget.Button
|
||||
logoutBtn *widget.Button
|
||||
}
|
||||
|
||||
func (this *toyUserInfo) Init(obs observer.Observer) error {
|
||||
@ -62,6 +63,17 @@ func (this *toyUserInfo) Init(obs observer.Observer) error {
|
||||
})
|
||||
this.refreshBtn.Disable()
|
||||
|
||||
// 注销用户
|
||||
this.logoutBtn = widget.NewButtonWithIcon("", theme.AccountIcon(), func() {
|
||||
if err := service.GetPttService().SendToClient(
|
||||
string(comm.ModuleUser),
|
||||
user.UserSubTypeInfo,
|
||||
&pb.UserInfoReq{}); err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
// list
|
||||
this.dataList = widget.NewListWithData(this.data,
|
||||
func() fyne.CanvasObject {
|
||||
@ -76,7 +88,7 @@ func (this *toyUserInfo) Init(obs observer.Observer) error {
|
||||
// sign := widget.NewRichTextFromMarkdown(``)
|
||||
// layout
|
||||
this.widget = widget.NewCard("", "",
|
||||
container.NewBorder(container.NewHBox(this.titleLabel, layout.NewSpacer(), this.refreshBtn, this.copyBtn),
|
||||
container.NewBorder(container.NewHBox(this.titleLabel, layout.NewSpacer(), this.logoutBtn, this.refreshBtn, this.copyBtn),
|
||||
nil, nil, nil, container.NewVScroll(this.dataList)))
|
||||
this.widget.Resize(fyne.NewSize(ToyWidth, 650))
|
||||
|
||||
|
@ -13,13 +13,15 @@ type BaseformView struct {
|
||||
form *widget.Form
|
||||
obs observer.Observer
|
||||
w fyne.Window
|
||||
res *widget.Entry
|
||||
service service.PttService
|
||||
}
|
||||
|
||||
func (this *BaseformView) Init(service service.PttService, obs observer.Observer, w fyne.Window) {
|
||||
func (this *BaseformView) Init(service service.PttService, obs observer.Observer, w fyne.Window, res *widget.Entry) {
|
||||
this.service = service
|
||||
this.obs = obs
|
||||
this.w = w
|
||||
this.res = res
|
||||
this.form = widget.NewForm()
|
||||
this.form.SubmitText = common.BUTTON_OK
|
||||
}
|
||||
|
@ -10,8 +10,11 @@ import (
|
||||
"go_dreamfactory/modules/sociaty"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -22,6 +25,7 @@ type SociatyListView struct {
|
||||
BaseformView
|
||||
itemList *common.ItemList
|
||||
flag bool
|
||||
detailFlag bool
|
||||
}
|
||||
|
||||
func (this *SociatyListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
@ -29,6 +33,14 @@ func (this *SociatyListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
|
||||
this.itemList.ItemList = this.itemList.CreateList()
|
||||
|
||||
this.itemList.ItemList.OnSelected = func(id widget.ListItemID) {
|
||||
item := this.itemList.CachedList.Items[id]
|
||||
logrus.Debug(item)
|
||||
if s, ok := item.Data.(*pb.DBSociaty); ok {
|
||||
this.res.Text, _ = jsoniter.MarshalToString(s)
|
||||
}
|
||||
}
|
||||
|
||||
this.sociatyList = func() {
|
||||
this.itemList.Reset()
|
||||
if err := service.GetPttService().SendToClient(
|
||||
@ -82,7 +94,31 @@ func (this *SociatyListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
})
|
||||
|
||||
// 明细
|
||||
detailBtn := widget.NewButton("明细", nil)
|
||||
// item := &entryItem{
|
||||
// sociatyName: widget.NewEntry(),
|
||||
// notice: widget.NewMultiLineEntry(),
|
||||
// icon: widget.NewEntry(),
|
||||
// isApplyCheck: widget.NewCheck("审批", nil),
|
||||
// applyLv: widget.NewEntry(),
|
||||
// }
|
||||
|
||||
// this.form.AppendItem(widget.NewFormItem("公会名称", item.sociatyName))
|
||||
// this.form.AppendItem(widget.NewFormItem("公告", item.notice))
|
||||
// this.form.AppendItem(widget.NewFormItem("图标", item.icon))
|
||||
// this.form.AppendItem(widget.NewFormItem("审批", item.isApplyCheck))
|
||||
// this.form.AppendItem(widget.NewFormItem("入会等级", item.applyLv))
|
||||
// this.formdataListen(item)
|
||||
|
||||
// detailBtn := widget.NewButton("明细", func() {
|
||||
// if err := service.GetPttService().SendToClient(
|
||||
// string(comm.ModuleSociaty),
|
||||
// sociaty.SociatySubTypeMine,
|
||||
// &pb.SociatyMineReq{}); err != nil {
|
||||
// logrus.Error(err)
|
||||
// }
|
||||
|
||||
// defer this.showSociatyDetailWin()
|
||||
// })
|
||||
|
||||
//过滤
|
||||
filter := widget.NewSelect([]string{"全部", "满足条件", "无需审批", "申请中"}, func(s string) {
|
||||
@ -127,7 +163,7 @@ func (this *SociatyListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
}
|
||||
})
|
||||
|
||||
buttonBar := container.NewHBox(refreshBtn, applyBtn, cancalApplyBtn, detailBtn, filter)
|
||||
buttonBar := container.NewHBox(refreshBtn, applyBtn, cancalApplyBtn, filter)
|
||||
cBar := container.NewBorder(nil, nil, buttonBar, searchBtn, searchEntry)
|
||||
// layout
|
||||
c := container.NewBorder(cBar, nil, nil, nil, this.itemList.ItemList)
|
||||
@ -161,10 +197,12 @@ func (this *SociatyListView) dataListener() {
|
||||
} else {
|
||||
isApplyCheckLbl = "无需审核"
|
||||
}
|
||||
lbl := fmt.Sprintf("%d - %-15s 等级:%-5d 等级限制:%-5d (%d) %10v", i+1, v.Name, v.Lv, v.ApplyLv, memberCount, isApplyCheckLbl)
|
||||
lbl := fmt.Sprintf("%d - %-15s 等级:%-5d 等级限制:%-5d (%d) %10v",
|
||||
i+1, v.Name, v.Lv, v.ApplyLv, memberCount, isApplyCheckLbl)
|
||||
item := common.Item{
|
||||
Id: v.Id,
|
||||
Text: lbl,
|
||||
Data: v,
|
||||
}
|
||||
this.itemList.AddItem(item)
|
||||
}
|
||||
@ -192,3 +230,38 @@ func (this *SociatyListView) dataListener() {
|
||||
})
|
||||
this.flag = true
|
||||
}
|
||||
|
||||
// 显示公会明细
|
||||
func (this *SociatyListView) showSociatyDetailWin() {
|
||||
c := container.NewBorder(nil, nil, nil, nil, this.form)
|
||||
dconf := dialog.NewCustom("公会详情", "关闭", c, this.w)
|
||||
dconf.Resize(fyne.NewSize(800, 500))
|
||||
dconf.Show()
|
||||
this.form.Refresh()
|
||||
}
|
||||
|
||||
func (this *SociatyListView) formdataListen(item *entryItem) {
|
||||
if this.detailFlag {
|
||||
return
|
||||
}
|
||||
this.obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
|
||||
OnNotify: func(d interface{}, args ...interface{}) {
|
||||
data := d.(*pb.UserMessage)
|
||||
if !(data.MainType == string(comm.ModuleSociaty) &&
|
||||
data.SubType == sociaty.SociatySubTypeMine) {
|
||||
return
|
||||
}
|
||||
rsp := &pb.SociatyMineResp{}
|
||||
|
||||
if rsp.Sociaty == nil {
|
||||
return
|
||||
}
|
||||
logrus.Debug(rsp.Sociaty)
|
||||
item.sociatyName.Text = rsp.Sociaty.Name
|
||||
item.notice.Text = rsp.Sociaty.Notice
|
||||
|
||||
this.form.Refresh()
|
||||
},
|
||||
})
|
||||
this.detailFlag = true
|
||||
}
|
||||
|
@ -207,7 +207,6 @@ func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
t.MainType,
|
||||
sociaty.SociatySubTypeSetting,
|
||||
&pb.SociatySettingReq{
|
||||
SociatyId: this.sociaty.Id,
|
||||
Icon: item.icon.Text,
|
||||
Notice: item.notice.Text,
|
||||
ApplyLv: cast.ToInt32(item.applyLv.Text),
|
||||
|
@ -61,6 +61,8 @@ type (
|
||||
QueryCrossHeroinfo(oid string) (hero *pb.DBHero, err error)
|
||||
|
||||
GetHeroListByUse(uid string) []*pb.DBHero // 非初始状态的英雄列表
|
||||
// 推送属性变化
|
||||
PushHeroProperty(session IUserSession, heros []*pb.DBHero) (err error)
|
||||
}
|
||||
|
||||
//玩家
|
||||
@ -216,8 +218,10 @@ type (
|
||||
ISociaty interface {
|
||||
//会长弹劾处理
|
||||
ProcessAccuse(uid, sociatyId string)
|
||||
// 公会成员
|
||||
Members(uid string) (list []*pb.SociatyMemberInfo)
|
||||
// 获取我的公会成员
|
||||
MembersByUid(uid string) (list []*pb.SociatyMemberInfo)
|
||||
// 获取公会成员
|
||||
MembersBySociatyId(sociatyId string) (list []*pb.SociatyMemberInfo)
|
||||
}
|
||||
//星座图
|
||||
IHoroscope interface {
|
||||
|
@ -298,7 +298,7 @@ func (this *Chat) pushChatToWorld(msg *pb.DBChat) (err error) {
|
||||
|
||||
//推送消息到工会
|
||||
func (this *Chat) pushChatToUnion(msg *pb.DBChat) (err error) {
|
||||
if members := this.sociaty.Members(msg.Suid); members != nil {
|
||||
if members := this.sociaty.MembersBySociatyId(msg.UnionId); members != nil {
|
||||
users := make([]string, 0, len(members))
|
||||
for _, v := range members {
|
||||
if v.OfflineTime == 0 { //离线时间为0 表示在线
|
||||
|
@ -380,3 +380,9 @@ func (this *Hero) GetHeroListByUse(uid string) []*pb.DBHero {
|
||||
}
|
||||
return tmp
|
||||
}
|
||||
|
||||
func (this *Hero) PushHeroProperty(session comm.IUserSession, heros []*pb.DBHero) (err error) {
|
||||
|
||||
err = session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: heros})
|
||||
return
|
||||
}
|
||||
|
26
modules/privilege/api.go
Normal file
26
modules/privilege/api.go
Normal file
@ -0,0 +1,26 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/modules"
|
||||
|
||||
"go_dreamfactory/lego/core"
|
||||
)
|
||||
|
||||
type apiComp struct {
|
||||
modules.MCompGate
|
||||
service core.IService
|
||||
module *Privilege
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompGate.Init(service, module, comp, options)
|
||||
this.module = module.(*Privilege)
|
||||
this.service = service
|
||||
return
|
||||
}
|
||||
|
||||
func (this *apiComp) Start() (err error) {
|
||||
err = this.MCompGate.Start()
|
||||
return
|
||||
}
|
20
modules/privilege/api_getlist.go
Normal file
20
modules/privilege/api_getlist.go
Normal file
@ -0,0 +1,20 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
//参数校验
|
||||
func (this *apiComp) GetlistCheck(session comm.IUserSession, req *pb.ShopGetListReq) (code pb.ErrorCode) {
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
///获取特权列表
|
||||
func (this *apiComp) Getlist(session comm.IUserSession, req *pb.ShopGetListReq) (code pb.ErrorCode, data proto.Message) {
|
||||
|
||||
return
|
||||
}
|
116
modules/privilege/configure.go
Normal file
116
modules/privilege/configure.go
Normal file
@ -0,0 +1,116 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
)
|
||||
|
||||
const (
|
||||
game_shop = "game_shop.json"
|
||||
game_shopitem = "game_shopitem.json"
|
||||
)
|
||||
|
||||
///背包配置管理组件
|
||||
type configureComp struct {
|
||||
modules.MCompConfigure
|
||||
module *Privilege
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.MCompConfigure.Init(service, module, comp, options)
|
||||
this.module = module.(*Privilege)
|
||||
this.LoadConfigure(game_shop, cfg.NewGameShop)
|
||||
this.LoadConfigure(game_shopitem, cfg.NewGameShopitem)
|
||||
return
|
||||
}
|
||||
|
||||
//获取装备配置数据
|
||||
func (this *configureComp) GetShopConfigure(id int32) (configure *cfg.GameShopData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shop); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
if configure, ok = v.(*cfg.GameShop).GetDataMap()[id]; !ok {
|
||||
err = fmt.Errorf("ShopConfigure not found:%d ", id)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取商品
|
||||
func (this *configureComp) GetShopItemsConfigure(key int32) (result *cfg.GameShopitemData, err error) {
|
||||
var (
|
||||
v interface{}
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopitem); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
if result, ok = v.(*cfg.GameShopitem).GetDataMap()[key]; !ok {
|
||||
err = fmt.Errorf("ShopConfigure not found:%d ", key)
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取商品组
|
||||
func (this *configureComp) GetShopItemsConfigureByGroups(groupid int32, user *pb.DBUser) (result []*cfg.GameShopitemData, err error) {
|
||||
result = make([]*cfg.GameShopitemData, 0, 10)
|
||||
var (
|
||||
v interface{}
|
||||
table *cfg.GameShopitem
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopitem); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
table = v.(*cfg.GameShopitem)
|
||||
for _, v := range table.GetDataMap() {
|
||||
if v.Id == groupid &&
|
||||
user.Lv >= v.Lvmin &&
|
||||
user.Lv <= v.Lvmax &&
|
||||
user.Vip >= v.Vip {
|
||||
result = append(result, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
//读取商品
|
||||
func (this *configureComp) GetShopItemsConfigureByIds(keys ...int32) (result []*cfg.GameShopitemData, err error) {
|
||||
result = make([]*cfg.GameShopitemData, 0, len(keys))
|
||||
var (
|
||||
v interface{}
|
||||
table *cfg.GameShopitem
|
||||
item *cfg.GameShopitemData
|
||||
ok bool
|
||||
)
|
||||
if v, err = this.GetConfigure(game_shopitem); err != nil {
|
||||
this.module.Errorf("err:%v", err)
|
||||
return
|
||||
} else {
|
||||
table = v.(*cfg.GameShopitem)
|
||||
for _, v := range keys {
|
||||
if item, ok = table.GetDataMap()[v]; ok {
|
||||
result = append(result, item)
|
||||
} else {
|
||||
this.module.Errorf("no found GetShopItemsConfigureByIds:%d", v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
28
modules/privilege/model_privilege.go
Normal file
28
modules/privilege/model_privilege.go
Normal file
@ -0,0 +1,28 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
///论坛 数据组件
|
||||
type modelShopComp struct {
|
||||
modules.MCompModel
|
||||
module *Privilege
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
func (this *modelShopComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
|
||||
this.MCompModel.Init(service, module, comp, opt)
|
||||
this.module = module.(*Privilege)
|
||||
this.TableName = comm.TableShop
|
||||
//创建uid索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
44
modules/privilege/module.go
Normal file
44
modules/privilege/module.go
Normal file
@ -0,0 +1,44 @@
|
||||
package privilege
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/sys/db"
|
||||
)
|
||||
|
||||
func NewModule() core.IModule {
|
||||
m := new(Privilege)
|
||||
return m
|
||||
}
|
||||
|
||||
type Privilege struct {
|
||||
modules.ModuleBase
|
||||
api_comp *apiComp
|
||||
configure *configureComp
|
||||
modelShop *modelShopComp
|
||||
}
|
||||
|
||||
//模块名
|
||||
func (this *Privilege) GetType() core.M_Modules {
|
||||
return comm.ModuleShop
|
||||
}
|
||||
|
||||
//模块初始化接口 注册用户创建角色事件
|
||||
func (this *Privilege) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
|
||||
err = this.ModuleBase.Init(service, module, options)
|
||||
return
|
||||
}
|
||||
|
||||
//装备组件
|
||||
func (this *Privilege) OnInstallComp() {
|
||||
this.ModuleBase.OnInstallComp()
|
||||
this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
|
||||
this.modelShop = this.RegisterComp(new(modelShopComp)).(*modelShopComp)
|
||||
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
|
||||
}
|
||||
|
||||
//Event------------------------------------------------------------------------------------------------------------
|
||||
func (this *Privilege) EventUserOffline(session comm.IUserSession) {
|
||||
this.modelShop.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
|
||||
}
|
93
modules/privilege/module_test.go
Normal file
93
modules/privilege/module_test.go
Normal file
@ -0,0 +1,93 @@
|
||||
package privilege_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego"
|
||||
"go_dreamfactory/lego/base/rpcx"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules/equipment"
|
||||
"go_dreamfactory/modules/hero"
|
||||
"go_dreamfactory/modules/items"
|
||||
"go_dreamfactory/modules/shop"
|
||||
"go_dreamfactory/modules/user"
|
||||
"go_dreamfactory/pb"
|
||||
"go_dreamfactory/services"
|
||||
"go_dreamfactory/sys/configure"
|
||||
"go_dreamfactory/sys/db"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/golang/protobuf/ptypes"
|
||||
)
|
||||
|
||||
func newService(ops ...rpcx.Option) core.IService {
|
||||
s := new(TestService)
|
||||
s.Configure(ops...)
|
||||
return s
|
||||
}
|
||||
|
||||
//梦工厂基础服务对象
|
||||
type TestService struct {
|
||||
rpcx.RPCXService
|
||||
}
|
||||
|
||||
//初始化相关系统
|
||||
func (this *TestService) InitSys() {
|
||||
this.RPCXService.InitSys()
|
||||
if err := db.OnInit(this.GetSettings().Sys["db"]); err != nil {
|
||||
panic(fmt.Sprintf("init sys.db err: %s", err.Error()))
|
||||
} else {
|
||||
log.Infof("init sys.db success!")
|
||||
}
|
||||
if err := configure.OnInit(this.GetSettings().Sys["configure"], configure.SetConfigPath("F:/work/go/go_dreamfactory/bin/json")); err != nil {
|
||||
panic(fmt.Sprintf("init sys.configure err: %s", err.Error()))
|
||||
} else {
|
||||
log.Infof("init sys.configure success!")
|
||||
}
|
||||
}
|
||||
|
||||
var service core.IService
|
||||
var s_gateComp comm.ISC_GateRouteComp = services.NewGateRouteComp()
|
||||
var module = new(shop.Shop)
|
||||
|
||||
//测试环境下初始化db和cache 系统
|
||||
func TestMain(m *testing.M) {
|
||||
service = newService(
|
||||
rpcx.SetConfPath("../../bin/conf/worker_1.yaml"),
|
||||
rpcx.SetVersion("1.0.0.0"),
|
||||
)
|
||||
service.OnInstallComp( //装备组件
|
||||
s_gateComp, //此服务需要接受用户的消息 需要装备网关组件
|
||||
)
|
||||
go func() {
|
||||
lego.Run(service, //运行模块
|
||||
module,
|
||||
hero.NewModule(),
|
||||
user.NewModule(),
|
||||
items.NewModule(),
|
||||
equipment.NewModule(),
|
||||
)
|
||||
}()
|
||||
time.Sleep(time.Second * 3)
|
||||
defer os.Exit(m.Run())
|
||||
}
|
||||
|
||||
//测试api_getlist
|
||||
func Test_Module_APIGetList(t *testing.T) {
|
||||
data, _ := ptypes.MarshalAny(&pb.ShopGetListReq{SType: pb.ShopType_GoldShop, IsManualRefresh: false})
|
||||
reply := &pb.RPCMessageReply{}
|
||||
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "shop", SubType: "getlist", Message: data}, reply)
|
||||
log.Debugf("reply:%v", reply)
|
||||
}
|
||||
|
||||
//测试api_buy
|
||||
func Test_Module_APIBuy(t *testing.T) {
|
||||
data, _ := ptypes.MarshalAny(&pb.ShopBuyReq{GoodsId: 7})
|
||||
reply := &pb.RPCMessageReply{}
|
||||
s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "shop", SubType: "buy", Message: data}, reply)
|
||||
log.Debugf("reply:%v", reply)
|
||||
}
|
@ -32,6 +32,7 @@ const (
|
||||
SociatySubTypeRank = "rank"
|
||||
SociatySubTypeTasklist = "tasklist"
|
||||
SociatySubTypeLog = "log"
|
||||
SociatySubTypeAgreePush = "agree"
|
||||
)
|
||||
|
||||
type apiComp struct {
|
||||
|
@ -42,6 +42,12 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (
|
||||
return
|
||||
}
|
||||
|
||||
//审核通过推送
|
||||
this.module.SendMsgToUser(string(this.module.GetType()), "pagree", &pb.SociatyPAgreePush{
|
||||
Uid: uid,
|
||||
SociatyId: sociaty.Id,
|
||||
}, req.Uid)
|
||||
|
||||
rsp := &pb.SociatyAgreeResp{
|
||||
Uid: req.Uid,
|
||||
SociatyId: sociaty.Id,
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
// 公会创建
|
||||
func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.SociatyCreateReq) (code pb.ErrorCode) {
|
||||
if len(req.Notice) > 150 {
|
||||
if len(req.Notice) > 150 || req.Name == ""{
|
||||
code = pb.ErrorCode_ReqParameterError
|
||||
}
|
||||
return
|
||||
|
@ -311,9 +311,20 @@ func (this *ModelSociaty) dismiss(sociaty *pb.DBSociaty) error {
|
||||
if err := this.memberClear(sociaty); err != nil {
|
||||
return err
|
||||
}
|
||||
err := this.DelListlds("", sociaty.Id)
|
||||
if err := this.DelListlds("", sociaty.Id); err != nil {
|
||||
return err
|
||||
}
|
||||
//推送
|
||||
if err := this.moduleSociaty.SendMsgToUsers(
|
||||
string(this.moduleSociaty.GetType()),
|
||||
"pdismiss",
|
||||
&pb.SociatyPDismissPush{SociatyId: sociaty.Id},
|
||||
this.getMemberIds(sociaty)...); err != nil {
|
||||
log.Errorf("公会解散推送 err:%v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
//删除请求记录
|
||||
func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty) error {
|
||||
|
@ -144,7 +144,7 @@ func (this *ModelSociatyLog) addLog(tag Tag, sociatyId string, params ...string)
|
||||
}
|
||||
|
||||
// 发消息到公会聊天
|
||||
if module, err := this.moduleSociaty.service.GetModule(comm.ModuleChat); err == nil {
|
||||
if module, err := this.service.GetModule(comm.ModuleChat); err == nil {
|
||||
if chat, ok := module.(comm.IChat); ok {
|
||||
chat.SendUnionChat(&pb.DBChat{
|
||||
Channel: pb.ChatChannel_Union,
|
||||
|
@ -75,8 +75,14 @@ func (this *Sociaty) ProcessAccuse(uid, sociatyId string) {
|
||||
}
|
||||
}
|
||||
|
||||
// 公会成员
|
||||
func (this *Sociaty) Members(uid string) (list []*pb.SociatyMemberInfo) {
|
||||
// 获取我的公会成员
|
||||
func (this *Sociaty) MembersByUid(uid string) (list []*pb.SociatyMemberInfo) {
|
||||
sociaty := this.modelSociaty.getUserSociaty(uid)
|
||||
return this.modelSociaty.members(sociaty)
|
||||
}
|
||||
|
||||
// 获取公会成员
|
||||
func (this *Sociaty) MembersBySociatyId(sociatyId string) (list []*pb.SociatyMemberInfo) {
|
||||
sociaty := this.modelSociaty.getSociaty(sociatyId)
|
||||
return this.modelSociaty.members(sociaty)
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
||||
return
|
||||
}
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||
aiMaxCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||
for k, v := range req.Items {
|
||||
|
||||
if v == 0 { // 过滤数量为0 的消息
|
||||
@ -48,7 +49,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.TrollBuyOrSell
|
||||
if !bSell {
|
||||
bSell = true
|
||||
trolltrain.SellCount += 1 // 交易次数+1
|
||||
if trolltrain.SellCount > dayMaxCount {
|
||||
if trolltrain.SellCount > aiMaxCount-dayMaxCount {
|
||||
code = pb.ErrorCode_TrollMaxSellCount // 达到最大交易次数 直接返回
|
||||
return
|
||||
}
|
||||
|
@ -32,9 +32,9 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq)
|
||||
code = pb.ErrorCode_DBError
|
||||
return
|
||||
}
|
||||
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||
aiCount := this.configure.GetTrollRule(comm.TrollAIBuyCount)
|
||||
if trolltrain.AiCount <= aiCount { // 小于离线挂机次数可执行
|
||||
if trolltrain.AiCount <= aiCount-dayMaxCount { // 小于离线挂机次数可执行
|
||||
this.module.TrollAI(session, trolltrain, aiCount)
|
||||
}
|
||||
|
||||
|
@ -71,6 +71,7 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
|
||||
sellPrice = make(map[int32]int32)
|
||||
now := time.Now().Unix()
|
||||
trainNum := this.configure.GetTrollMaxTraintNum()
|
||||
dayMaxCount := this.configure.GetTrollRule(comm.TrollBuyCount)
|
||||
maxCoefficient := this.configure.GetTrollMaxCoefficientNux() // 增长幅度的最大值
|
||||
if maxCoefficient == 0 {
|
||||
code = pb.ErrorCode_ConfigNoFound
|
||||
@ -121,7 +122,8 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain, ai
|
||||
this.SeTrollRankList(troll.TotalEarn, session.GetUserId()) // 设置排行数据
|
||||
|
||||
troll.AiCount++
|
||||
if troll.AiCount > aiCount { //达到最大交易次数
|
||||
|
||||
if troll.AiCount > aiCount-dayMaxCount { //达到最大交易次数
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -2621,6 +2621,110 @@ func (x *SociatyRankResp) GetRank() []*DBSociatyRank {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 公会解散推送
|
||||
type SociatyPDismissPush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId"`
|
||||
}
|
||||
|
||||
func (x *SociatyPDismissPush) Reset() {
|
||||
*x = SociatyPDismissPush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_sociaty_sociaty_msg_proto_msgTypes[51]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SociatyPDismissPush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SociatyPDismissPush) ProtoMessage() {}
|
||||
|
||||
func (x *SociatyPDismissPush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sociaty_sociaty_msg_proto_msgTypes[51]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SociatyPDismissPush.ProtoReflect.Descriptor instead.
|
||||
func (*SociatyPDismissPush) Descriptor() ([]byte, []int) {
|
||||
return file_sociaty_sociaty_msg_proto_rawDescGZIP(), []int{51}
|
||||
}
|
||||
|
||||
func (x *SociatyPDismissPush) GetSociatyId() string {
|
||||
if x != nil {
|
||||
return x.SociatyId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// 审核通过推送
|
||||
type SociatyPAgreePush struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"`
|
||||
SociatyId string `protobuf:"bytes,2,opt,name=sociatyId,proto3" json:"sociatyId"`
|
||||
}
|
||||
|
||||
func (x *SociatyPAgreePush) Reset() {
|
||||
*x = SociatyPAgreePush{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_sociaty_sociaty_msg_proto_msgTypes[52]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *SociatyPAgreePush) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SociatyPAgreePush) ProtoMessage() {}
|
||||
|
||||
func (x *SociatyPAgreePush) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_sociaty_sociaty_msg_proto_msgTypes[52]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use SociatyPAgreePush.ProtoReflect.Descriptor instead.
|
||||
func (*SociatyPAgreePush) Descriptor() ([]byte, []int) {
|
||||
return file_sociaty_sociaty_msg_proto_rawDescGZIP(), []int{52}
|
||||
}
|
||||
|
||||
func (x *SociatyPAgreePush) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SociatyPAgreePush) GetSociatyId() string {
|
||||
if x != nil {
|
||||
return x.SociatyId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_sociaty_sociaty_msg_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_sociaty_sociaty_msg_proto_rawDesc = []byte{
|
||||
@ -2810,13 +2914,20 @@ var file_sociaty_sociaty_msg_proto_rawDesc = []byte{
|
||||
0x79, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x22, 0x35, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69,
|
||||
0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x04, 0x72,
|
||||
0x61, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x53, 0x6f,
|
||||
0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x2a,
|
||||
0x42, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69,
|
||||
0x6c, 0x74, 0x65, 0x72, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, 0x00, 0x12, 0x09, 0x0a,
|
||||
0x05, 0x43, 0x4f, 0x4e, 0x44, 0x49, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x41, 0x50,
|
||||
0x50, 0x4c, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x49, 0x4e,
|
||||
0x47, 0x10, 0x03, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x61, 0x6e, 0x6b, 0x52, 0x04, 0x72, 0x61, 0x6e, 0x6b, 0x22,
|
||||
0x33, 0x0a, 0x13, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x50, 0x44, 0x69, 0x73, 0x6d, 0x69,
|
||||
0x73, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74,
|
||||
0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x6f, 0x63, 0x69, 0x61,
|
||||
0x74, 0x79, 0x49, 0x64, 0x22, 0x43, 0x0a, 0x11, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x50,
|
||||
0x41, 0x67, 0x72, 0x65, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73,
|
||||
0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
|
||||
0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x49, 0x64, 0x2a, 0x42, 0x0a, 0x11, 0x53, 0x6f, 0x63,
|
||||
0x69, 0x61, 0x74, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x69, 0x6c, 0x74, 0x65, 0x72, 0x12, 0x07,
|
||||
0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x43, 0x4f, 0x4e, 0x44, 0x49,
|
||||
0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x4e, 0x4f, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x10, 0x02, 0x12,
|
||||
0x0c, 0x0a, 0x08, 0x41, 0x50, 0x50, 0x4c, 0x59, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x42, 0x06, 0x5a,
|
||||
0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -2832,7 +2943,7 @@ func file_sociaty_sociaty_msg_proto_rawDescGZIP() []byte {
|
||||
}
|
||||
|
||||
var file_sociaty_sociaty_msg_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_sociaty_sociaty_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 51)
|
||||
var file_sociaty_sociaty_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 53)
|
||||
var file_sociaty_sociaty_msg_proto_goTypes = []interface{}{
|
||||
(SociatyListFilter)(0), // 0: SociatyListFilter
|
||||
(*SociatyCreateReq)(nil), // 1: SociatyCreateReq
|
||||
@ -2886,28 +2997,30 @@ var file_sociaty_sociaty_msg_proto_goTypes = []interface{}{
|
||||
(*SociatyActivityReceiveResp)(nil), // 49: SociatyActivityReceiveResp
|
||||
(*SociatyRankReq)(nil), // 50: SociatyRankReq
|
||||
(*SociatyRankResp)(nil), // 51: SociatyRankResp
|
||||
(*DBSociaty)(nil), // 52: DBSociaty
|
||||
(SociatyJob)(0), // 53: SociatyJob
|
||||
(*DBSociatyLog)(nil), // 54: DBSociatyLog
|
||||
(*SociatyTask)(nil), // 55: SociatyTask
|
||||
(*SociatyActivity)(nil), // 56: SociatyActivity
|
||||
(*DBSociatyRank)(nil), // 57: DBSociatyRank
|
||||
(*SociatyPDismissPush)(nil), // 52: SociatyPDismissPush
|
||||
(*SociatyPAgreePush)(nil), // 53: SociatyPAgreePush
|
||||
(*DBSociaty)(nil), // 54: DBSociaty
|
||||
(SociatyJob)(0), // 55: SociatyJob
|
||||
(*DBSociatyLog)(nil), // 56: DBSociatyLog
|
||||
(*SociatyTask)(nil), // 57: SociatyTask
|
||||
(*SociatyActivity)(nil), // 58: SociatyActivity
|
||||
(*DBSociatyRank)(nil), // 59: DBSociatyRank
|
||||
}
|
||||
var file_sociaty_sociaty_msg_proto_depIdxs = []int32{
|
||||
0, // 0: SociatyListReq.filter:type_name -> SociatyListFilter
|
||||
52, // 1: SociatyListResp.list:type_name -> DBSociaty
|
||||
52, // 2: SociatySearchResp.list:type_name -> DBSociaty
|
||||
52, // 3: SociatyMineResp.sociaty:type_name -> DBSociaty
|
||||
54, // 1: SociatyListResp.list:type_name -> DBSociaty
|
||||
54, // 2: SociatySearchResp.list:type_name -> DBSociaty
|
||||
54, // 3: SociatyMineResp.sociaty:type_name -> DBSociaty
|
||||
11, // 4: SociatyMineResp.master:type_name -> SociatyMemberInfo
|
||||
53, // 5: SociatyMemberInfo.job:type_name -> SociatyJob
|
||||
55, // 5: SociatyMemberInfo.job:type_name -> SociatyJob
|
||||
11, // 6: SociatyApplyListResp.list:type_name -> SociatyMemberInfo
|
||||
11, // 7: SociatyMembersResp.list:type_name -> SociatyMemberInfo
|
||||
53, // 8: SociatySettingJobReq.job:type_name -> SociatyJob
|
||||
53, // 9: SociatySettingJobResp.job:type_name -> SociatyJob
|
||||
54, // 10: SociatyLogResp.log:type_name -> DBSociatyLog
|
||||
55, // 11: SociatyTaskListResp.list:type_name -> SociatyTask
|
||||
56, // 12: SociatyActivityListResp.list:type_name -> SociatyActivity
|
||||
57, // 13: SociatyRankResp.rank:type_name -> DBSociatyRank
|
||||
55, // 8: SociatySettingJobReq.job:type_name -> SociatyJob
|
||||
55, // 9: SociatySettingJobResp.job:type_name -> SociatyJob
|
||||
56, // 10: SociatyLogResp.log:type_name -> DBSociatyLog
|
||||
57, // 11: SociatyTaskListResp.list:type_name -> SociatyTask
|
||||
58, // 12: SociatyActivityListResp.list:type_name -> SociatyActivity
|
||||
59, // 13: SociatyRankResp.rank:type_name -> DBSociatyRank
|
||||
14, // [14:14] is the sub-list for method output_type
|
||||
14, // [14:14] is the sub-list for method input_type
|
||||
14, // [14:14] is the sub-list for extension type_name
|
||||
@ -3534,6 +3647,30 @@ func file_sociaty_sociaty_msg_proto_init() {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_sociaty_sociaty_msg_proto_msgTypes[51].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SociatyPDismissPush); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_sociaty_sociaty_msg_proto_msgTypes[52].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*SociatyPAgreePush); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
@ -3541,7 +3678,7 @@ func file_sociaty_sociaty_msg_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_sociaty_sociaty_msg_proto_rawDesc,
|
||||
NumEnums: 1,
|
||||
NumMessages: 51,
|
||||
NumMessages: 53,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
42
sys/configure/structs/Game.Privilege.go
Normal file
42
sys/configure/structs/Game.Privilege.go
Normal file
@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
type GamePrivilege struct {
|
||||
_dataMap map[int32]*GamePrivilegeData
|
||||
_dataList []*GamePrivilegeData
|
||||
}
|
||||
|
||||
func NewGamePrivilege(_buf []map[string]interface{}) (*GamePrivilege, error) {
|
||||
_dataList := make([]*GamePrivilegeData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamePrivilegeData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamePrivilegeData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.PrivilegeId] = _v
|
||||
}
|
||||
}
|
||||
return &GamePrivilege{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamePrivilege) GetDataMap() map[int32]*GamePrivilegeData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamePrivilege) GetDataList() []*GamePrivilegeData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamePrivilege) Get(key int32) *GamePrivilegeData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
42
sys/configure/structs/Game.PrivilegeCard.go
Normal file
42
sys/configure/structs/Game.PrivilegeCard.go
Normal file
@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
type GamePrivilegeCard struct {
|
||||
_dataMap map[int32]*GamePrivilegeCardData
|
||||
_dataList []*GamePrivilegeCardData
|
||||
}
|
||||
|
||||
func NewGamePrivilegeCard(_buf []map[string]interface{}) (*GamePrivilegeCard, error) {
|
||||
_dataList := make([]*GamePrivilegeCardData, 0, len(_buf))
|
||||
dataMap := make(map[int32]*GamePrivilegeCardData)
|
||||
for _, _ele_ := range _buf {
|
||||
if _v, err2 := DeserializeGamePrivilegeCardData(_ele_); err2 != nil {
|
||||
return nil, err2
|
||||
} else {
|
||||
_dataList = append(_dataList, _v)
|
||||
dataMap[_v.Id] = _v
|
||||
}
|
||||
}
|
||||
return &GamePrivilegeCard{_dataList:_dataList, _dataMap:dataMap}, nil
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) GetDataMap() map[int32]*GamePrivilegeCardData {
|
||||
return table._dataMap
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) GetDataList() []*GamePrivilegeCardData {
|
||||
return table._dataList
|
||||
}
|
||||
|
||||
func (table *GamePrivilegeCard) Get(key int32) *GamePrivilegeCardData {
|
||||
return table._dataMap[key]
|
||||
}
|
||||
|
||||
|
75
sys/configure/structs/Game.PrivilegeCardData.go
Normal file
75
sys/configure/structs/Game.PrivilegeCardData.go
Normal file
@ -0,0 +1,75 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GamePrivilegeCardData struct {
|
||||
Id int32
|
||||
Name string
|
||||
Proid string
|
||||
AssertDay int32
|
||||
RenewDay int32
|
||||
DayReward []*Gameatn
|
||||
DisposableReward *Gameatn
|
||||
PrivilegeId []int32
|
||||
}
|
||||
|
||||
const TypeId_GamePrivilegeCardData = 1735553455
|
||||
|
||||
func (*GamePrivilegeCardData) GetTypeId() int32 {
|
||||
return 1735553455
|
||||
}
|
||||
|
||||
func (_v *GamePrivilegeCardData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
||||
{ var _ok_ bool; if _v.Name, _ok_ = _buf["name"].(string); !_ok_ { err = errors.New("name error"); return } }
|
||||
{ var _ok_ bool; if _v.Proid, _ok_ = _buf["proid"].(string); !_ok_ { err = errors.New("proid error"); return } }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["assert_day"].(float64); !_ok_ { err = errors.New("assert_day error"); return }; _v.AssertDay = int32(_tempNum_) }
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["renew_day"].(float64); !_ok_ { err = errors.New("renew_day error"); return }; _v.RenewDay = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["day_reward"].([]interface{}); !_ok_ { err = errors.New("day_reward error"); return }
|
||||
|
||||
_v.DayReward = make([]*Gameatn, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ *Gameatn
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
_v.DayReward = append(_v.DayReward, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["disposable_reward"].(map[string]interface{}); !_ok_ { err = errors.New("disposable_reward error"); return }; if _v.DisposableReward, err = DeserializeGameatn(_x_); err != nil { return } }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
if _arr_, _ok_ = _buf["privilege_id"].([]interface{}); !_ok_ { err = errors.New("privilege_id error"); return }
|
||||
|
||||
_v.PrivilegeId = make([]int32, 0, len(_arr_))
|
||||
|
||||
for _, _e_ := range _arr_ {
|
||||
var _list_v_ int32
|
||||
{ var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
|
||||
_v.PrivilegeId = append(_v.PrivilegeId, _list_v_)
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamePrivilegeCardData(_buf map[string]interface{}) (*GamePrivilegeCardData, error) {
|
||||
v := &GamePrivilegeCardData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
37
sys/configure/structs/Game.PrivilegeData.go
Normal file
37
sys/configure/structs/Game.PrivilegeData.go
Normal file
@ -0,0 +1,37 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
package cfg
|
||||
|
||||
import "errors"
|
||||
|
||||
type GamePrivilegeData struct {
|
||||
PrivilegeId int32
|
||||
PrivilegeDescribe string
|
||||
}
|
||||
|
||||
const TypeId_GamePrivilegeData = 40320255
|
||||
|
||||
func (*GamePrivilegeData) GetTypeId() int32 {
|
||||
return 40320255
|
||||
}
|
||||
|
||||
func (_v *GamePrivilegeData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["privilege_id"].(float64); !_ok_ { err = errors.New("privilege_id error"); return }; _v.PrivilegeId = int32(_tempNum_) }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["privilege_describe"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.PrivilegeDescribe error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.PrivilegeDescribe, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
return
|
||||
}
|
||||
|
||||
func DeserializeGamePrivilegeData(_buf map[string]interface{}) (*GamePrivilegeData, error) {
|
||||
v := &GamePrivilegeData{}
|
||||
if err := v.Deserialize(_buf); err == nil {
|
||||
return v, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
}
|
@ -120,6 +120,8 @@ type Tables struct {
|
||||
TrollTrain *GameTrollTrain
|
||||
TrollLv *GameTrollLv
|
||||
TrollCoefficient *GameTrollCoefficient
|
||||
PrivilegeCard *GamePrivilegeCard
|
||||
Privilege *GamePrivilege
|
||||
}
|
||||
|
||||
func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
@ -781,5 +783,17 @@ func NewTables(loader JsonLoader) (*Tables, error) {
|
||||
if tables.TrollCoefficient, err = NewGameTrollCoefficient(buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_privilegecard"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.PrivilegeCard, err = NewGamePrivilegeCard(buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if buf, err = loader("game_privilege"); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if tables.Privilege, err = NewGamePrivilege(buf); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return tables, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user