This commit is contained in:
liwei1dao 2022-10-31 16:06:00 +08:00
commit b386c05176
99 changed files with 9923 additions and 66 deletions

View File

@ -0,0 +1,57 @@
[
{
"id": 1,
"activity": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
}
]
},
{
"id": 2,
"activity": 2000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
}
]
},
{
"id": 3,
"activity": 3000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
}
]
},
{
"id": 4,
"activity": 4000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
}
]
},
{
"id": 5,
"activity": 5000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
}
]

102
bin/json/game_guildlv.json Normal file
View File

@ -0,0 +1,102 @@
[
{
"lv": 1,
"exp": 0,
"member_max": 20
},
{
"lv": 2,
"exp": 1000,
"member_max": 22
},
{
"lv": 3,
"exp": 2000,
"member_max": 24
},
{
"lv": 4,
"exp": 3000,
"member_max": 26
},
{
"lv": 5,
"exp": 4000,
"member_max": 28
},
{
"lv": 6,
"exp": 5000,
"member_max": 30
},
{
"lv": 7,
"exp": 6000,
"member_max": 32
},
{
"lv": 8,
"exp": 7000,
"member_max": 34
},
{
"lv": 9,
"exp": 8000,
"member_max": 36
},
{
"lv": 10,
"exp": 9000,
"member_max": 38
},
{
"lv": 11,
"exp": 10000,
"member_max": 40
},
{
"lv": 12,
"exp": 11000,
"member_max": 42
},
{
"lv": 13,
"exp": 12000,
"member_max": 44
},
{
"lv": 14,
"exp": 13000,
"member_max": 46
},
{
"lv": 15,
"exp": 14000,
"member_max": 48
},
{
"lv": 16,
"exp": 15000,
"member_max": 50
},
{
"lv": 17,
"exp": 16000,
"member_max": 52
},
{
"lv": 18,
"exp": 17000,
"member_max": 54
},
{
"lv": 19,
"exp": 18000,
"member_max": 56
},
{
"lv": 20,
"exp": 19000,
"member_max": 58
}
]

View File

@ -0,0 +1,46 @@
[
{
"id": 1,
"png": "wp_icon_10013"
},
{
"id": 2,
"png": "wp_icon_10014"
},
{
"id": 3,
"png": "wp_icon_10015"
},
{
"id": 4,
"png": "wp_icon_10016"
},
{
"id": 5,
"png": "wp_icon_10017"
},
{
"id": 6,
"png": "wp_icon_10018"
},
{
"id": 7,
"png": "wp_icon_10019"
},
{
"id": 8,
"png": "wp_icon_10020"
},
{
"id": 9,
"png": "wp_icon_10021"
},
{
"id": 10,
"png": "wp_icon_10022"
},
{
"id": 11,
"png": "wp_icon_10023"
}
]

View File

@ -0,0 +1,132 @@
[
{
"id": 1,
"down": 0,
"up": 4,
"SignIn_text": {
"key": "signin1",
"text": "昨日0人签到"
},
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 10
},
{
"a": "attr",
"t": "guildcoin",
"n": 10
}
],
"exp": {
"a": "attr",
"t": "guildexp",
"n": 10
}
},
{
"id": 2,
"down": 5,
"up": 9,
"SignIn_text": {
"key": "signin2",
"text": "昨日5人签到"
},
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"exp": {
"a": "attr",
"t": "guildexp",
"n": 50
}
},
{
"id": 3,
"down": 10,
"up": 14,
"SignIn_text": {
"key": "signin3",
"text": "昨日10人签到"
},
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
},
{
"a": "attr",
"t": "guildcoin",
"n": 100
}
],
"exp": {
"a": "attr",
"t": "guildexp",
"n": 100
}
},
{
"id": 4,
"down": 15,
"up": 19,
"SignIn_text": {
"key": "signin4",
"text": "昨日15人签到"
},
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 150
},
{
"a": "attr",
"t": "guildcoin",
"n": 150
}
],
"exp": {
"a": "attr",
"t": "guildexp",
"n": 150
}
},
{
"id": 5,
"down": 20,
"up": 99,
"SignIn_text": {
"key": "signin5",
"text": "昨日20人签到"
},
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 200
},
{
"a": "attr",
"t": "guildcoin",
"n": 200
}
],
"exp": {
"a": "attr",
"t": "guildexp",
"n": 200
}
}
]

View File

@ -0,0 +1,292 @@
[
{
"id": 10001,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10002,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10003,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10004,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10005,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10006,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10007,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10008,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10009,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 20
}
],
"contribution": 50
},
{
"id": 10010,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildactive",
"n": 20
},
{
"a": "attr",
"t": "guildexp",
"n": 40
}
],
"contribution": 50
}
]

View File

@ -255,7 +255,7 @@
"msgid": "sociaty.settingjob",
"open": true,
"routrules": "~/worker",
"describe": "设置职位"
"describe": "设置公会职位"
},
{
"msgid": "smithy.getranduser",
@ -268,5 +268,41 @@
"open": true,
"routrules": "~/worker",
"describe": "竞技场"
},
{
"msgid": "sociaty.sign",
"open": true,
"routrules": "~/worker",
"describe": "公会签到"
},
{
"msgid": "sociaty.applycancel",
"open": true,
"routrules": "~/worker",
"describe": "公会申请撤销"
},
{
"msgid": "sociaty.receive",
"open": true,
"routrules": "~/worker",
"describe": "公会任务奖励领取"
},
{
"msgid": "sociaty.activityreceive",
"open": true,
"routrules": "~/worker",
"describe": "公会活跃度领取"
},
{
"msgid": "sociaty.rank",
"open": true,
"routrules": "~/worker",
"describe": "公会排行"
},
{
"msgid": "sociaty.tasklist",
"open": true,
"routrules": "~/worker",
"describe": "公会任务列表"
}
]

View File

@ -0,0 +1,57 @@
[
{
"id": 1,
"activity": "1000",
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
}
]
},
{
"id": 2,
"activity": "2000",
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
}
]
},
{
"id": 3,
"activity": "3000",
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
}
]
},
{
"id": 4,
"activity": "4000",
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
}
]
},
{
"id": 5,
"activity": "5000",
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
}
]
}
]

View File

@ -0,0 +1,102 @@
[
{
"lv": 1,
"exp": 0,
"member_max": 20
},
{
"lv": 2,
"exp": 1000,
"member_max": 22
},
{
"lv": 3,
"exp": 2000,
"member_max": 24
},
{
"lv": 4,
"exp": 3000,
"member_max": 26
},
{
"lv": 5,
"exp": 4000,
"member_max": 28
},
{
"lv": 6,
"exp": 5000,
"member_max": 30
},
{
"lv": 7,
"exp": 6000,
"member_max": 32
},
{
"lv": 8,
"exp": 7000,
"member_max": 34
},
{
"lv": 9,
"exp": 8000,
"member_max": 36
},
{
"lv": 10,
"exp": 9000,
"member_max": 38
},
{
"lv": 11,
"exp": 10000,
"member_max": 40
},
{
"lv": 12,
"exp": 11000,
"member_max": 42
},
{
"lv": 13,
"exp": 12000,
"member_max": 44
},
{
"lv": 14,
"exp": 13000,
"member_max": 46
},
{
"lv": 15,
"exp": 14000,
"member_max": 48
},
{
"lv": 16,
"exp": 15000,
"member_max": 50
},
{
"lv": 17,
"exp": 16000,
"member_max": 52
},
{
"lv": 18,
"exp": 17000,
"member_max": 54
},
{
"lv": 19,
"exp": 18000,
"member_max": 56
},
{
"lv": 20,
"exp": 19000,
"member_max": 58
}
]

View File

@ -0,0 +1,97 @@
[
{
"id": 1,
"down": 0,
"up": 4,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
}
],
"exp": [
{
"a": "attr",
"t": "exp",
"n": 0
}
]
},
{
"id": 2,
"down": 5,
"up": 9,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
}
],
"exp": [
{
"a": "attr",
"t": "exp",
"n": 50
}
]
},
{
"id": 3,
"down": 10,
"up": 14,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
}
],
"exp": [
{
"a": "attr",
"t": "exp",
"n": 100
}
]
},
{
"id": 4,
"down": 15,
"up": 19,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
}
],
"exp": [
{
"a": "attr",
"t": "exp",
"n": 150
}
]
},
{
"id": 5,
"down": 20,
"up": 99,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
}
],
"exp": [
{
"a": "attr",
"t": "exp",
"n": 200
}
]
}
]

View File

@ -0,0 +1,292 @@
[
{
"id": 10001,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10002,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10003,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10004,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10005,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10006,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 50
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10007,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 60
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10008,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 70
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10009,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 80
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
},
{
"id": 10010,
"weight": 1000,
"reward": [
{
"a": "attr",
"t": "diamond",
"n": 100
},
{
"a": "attr",
"t": "guildcoin",
"n": 50
}
],
"sociaty_reward": [
{
"a": "attr",
"t": "guildexp",
"n": 50
},
{
"a": "attr",
"t": "guildactive",
"n": 50
}
],
"contribution": 20
}
]

View File

@ -15,7 +15,8 @@ import (
)
type ItemList struct {
SelItemIds []string //选择的ID
SelItemIds []string //选择的ID 多选
SelItemId string //选择的ID 单选
ItemTotal int //总数
TitleLabel *widget.Label
CachedList List
@ -34,7 +35,9 @@ func NewItemList() *ItemList {
func (f *ItemList) Reset() {
f.ItemTotal = 0
f.SelItemIds = []string{}
f.SelItemId = ""
f.CachedList = NewList("")
f.ItemList.Refresh()
}
func (f *ItemList) CreateList() *widget.List {
@ -53,13 +56,14 @@ func (f *ItemList) CreateList() *widget.List {
)
f.ItemList.OnSelected = func(id widget.ListItemID) {
selId := f.CachedList.Items[id].Id
f.SelItemIds = append(f.SelItemIds, selId)
f.SelItemId = selId
return
}
f.ItemList.OnUnselected = func(id widget.ListItemID) {
f.SelItemIds = append(f.SelItemIds[:id], f.SelItemIds[id+1:]...)
}
// f.ItemList.OnUnselected = func(id widget.ListItemID) {
// selId := f.CachedList.Items[id].Id
// utils.DeleteString(f.SelItemIds, selId)
// }
return f.ItemList
}

View File

@ -37,4 +37,4 @@ func ShowCanvasTip(content string) {
w.Close()
}()
}
}
}

View File

@ -1,6 +1,7 @@
package ui
import (
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"fyne.io/fyne/v2/container"
@ -9,12 +10,13 @@ import (
type appContainer struct {
appStatusMap map[string]appStatus
container.DocTabs
obs observer.Observer
ai []appInterface
obs observer.Observer
ai []appInterface
service service.PttService
}
func newAppContainer(ai []appInterface, obs observer.Observer) *appContainer {
at := &appContainer{ai: ai, obs: obs}
func newAppContainer(ai []appInterface, service service.PttService, obs observer.Observer) *appContainer {
at := &appContainer{ai: ai, service: service, obs: obs}
at.appStatusMap = make(map[string]appStatus)
at.CloseIntercept = at.closeHandle
@ -83,7 +85,7 @@ func (at *appContainer) openDefaultApp() (string, error) {
func (at *appContainer) initApp(app appInterface) error {
st, ok := at.appStatusMap[app.GetAppName()]
if !ok || !st.lazyInit {
err := app.LazyInit(at.obs)
err := app.LazyInit(at.service, at.obs)
if err != nil {
return err
}

View File

@ -1,13 +1,14 @@
package ui
import (
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"fyne.io/fyne/v2/container"
)
type appInterface interface {
LazyInit(obs observer.Observer) error
LazyInit(service service.PttService, obs observer.Observer) error
GetTabItem() *container.TabItem
GetAppName() string
OpenDefault() bool

View File

@ -4,6 +4,7 @@ import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"fyne.io/fyne/v2"
@ -27,7 +28,7 @@ type appMonitor struct {
monitorData *model.PushModelList
}
func (this *appMonitor) LazyInit(obs observer.Observer) error {
func (this *appMonitor) LazyInit(service service.PttService, obs observer.Observer) error {
this.obs = obs
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_MONITOR, theme.MediaVideoIcon(), nil)

View File

@ -4,6 +4,7 @@ import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/pb"
"time"
@ -18,6 +19,7 @@ import (
type appTester struct {
appAdapter
progress *widget.ProgressBarInfinite
}
func (a *appTester) GetAppName() string {
@ -28,9 +30,12 @@ func (a *appTester) disEnabled(t *model.TestCase) bool {
return !t.Enabled
}
func (a *appTester) LazyInit(obs observer.Observer) error {
func (a *appTester) LazyInit(service service.PttService, obs observer.Observer) error {
a.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_TESTER, theme.DocumentIcon(), nil)
a.progress = widget.NewProgressBarInfinite()
a.progress.Hide()
content := container.NewMax()
title := widget.NewLabel(common.APP_TESTCASE_TITLE)
intro := widget.NewLabel("")
@ -39,14 +44,15 @@ func (a *appTester) LazyInit(obs observer.Observer) error {
container.NewVBox(title, widget.NewSeparator(), intro), nil, nil, nil, content)
setNav := func(t *model.TestCase) {
defer a.progress.Hide()
viewKey := fmt.Sprintf("%s.%s", t.MainType, t.SubType)
title.SetText(fmt.Sprintf("> %s", viewKey))
title.SetText(fmt.Sprintf("> %s", viewKey))
intro.SetText(t.Desc)
content.Objects = []fyne.CanvasObject{}
if view, ok := viewRegister[viewKey]; ok {
timeLbl := widget.NewLabel("time")
view.Init(obs, globalWin.w)
view.Init(service, obs, globalWin.w)
resLog := widget.NewMultiLineEntry()
obs.AddListener(observer.EVENT_REQ_RSP, observer.Listener{
@ -100,7 +106,7 @@ func (a *appTester) LazyInit(obs observer.Observer) error {
}
split := container.NewHSplit(a.makeNav(setNav), caseContent)
split.Offset = 0.2
a.tabItem.Content = split
a.tabItem.Content = container.NewBorder(nil, a.progress, nil, nil, split)
return nil
}
@ -156,8 +162,9 @@ func (a *appTester) makeNav(setNav func(testCase *model.TestCase)) fyne.CanvasOb
if t.SubType == "" {
return
}
setNav(t)
a.progress.Start()
a.progress.Show()
go setNav(t)
}
},
}

View File

@ -96,7 +96,7 @@ func (ui *MainWindowImpl) createWindowContainer() {
ui.toys = newToys(ui.obs)
// main app tabs
ui.at = newAppContainer(appRegister, ui.obs)
ui.at = newAppContainer(appRegister, ui.pttService, ui.obs)
content := container.NewBorder(ui.tb.toolbar, ui.sb.widget, nil, ui.toys.widget, ui.at)
ui.w.SetContent(content)
ui.w.CenterOnScreen()

View File

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
formview "go_dreamfactory/cmd/v2/ui/views"
"go_dreamfactory/comm"
@ -13,6 +14,7 @@ import (
"go_dreamfactory/modules/linestory"
"go_dreamfactory/modules/mainline"
"go_dreamfactory/modules/rtask"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/modules/sys"
"go_dreamfactory/modules/task"
"go_dreamfactory/modules/user"
@ -26,7 +28,7 @@ import (
)
type MyCaseView interface {
Init(obs observer.Observer, w fyne.Window)
Init(service service.PttService, obs observer.Observer, w fyne.Window)
CreateView(t *model.TestCase) fyne.CanvasObject
Load()
}
@ -105,6 +107,14 @@ var (
// linestory
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDostart): &formview.LinestoryStartView{},
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDotask): &formview.LinestoryTaskView{},
// gourmet
ff(comm.ModuleGourmet, "getranduser"): &formview.GourmentGetRandView{},
// sociaty
ff(comm.ModuleSociaty, sociaty.SociatySubTypeList): &formview.SociatyListView{},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeCreate): &formview.SociatyCreateView{},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeMine): &formview.SociatyMineView{},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeTasklist): &formview.SociatyTasklistView{},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeRank): &formview.SociatyRankView{},
}
)
@ -126,6 +136,8 @@ var (
string(comm.ModulePagoda),
string(comm.ModuleRtask),
string(comm.ModuleLinestory),
string(comm.ModuleGourmet),
string(comm.ModuleSociaty),
},
"gm": {ff(comm.ModuleGM, "cmd")},
"sys": {
@ -210,6 +222,16 @@ var (
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDostart),
ff(comm.ModuleLinestory, linestory.LinestorySubTypeDotask),
},
"gourmet": {
ff(comm.ModuleGourmet, "getranduser"),
},
"sociaty": {
ff(comm.ModuleSociaty, sociaty.SociatySubTypeList),
ff(comm.ModuleSociaty, sociaty.SociatySubTypeCreate),
ff(comm.ModuleSociaty, sociaty.SociatySubTypeMine),
ff(comm.ModuleSociaty, sociaty.SociatySubTypeTasklist),
ff(comm.ModuleSociaty, sociaty.SociatySubTypeRank),
},
}
)
@ -777,6 +799,63 @@ var (
SubType: linestory.LinestorySubTypeDotask,
Enabled: true,
},
// gourmet
string(comm.ModuleGourmet): {
NavLabel: "美食馆",
MainType: string(comm.ModuleGourmet),
Enabled: true,
},
ff(comm.ModuleGourmet, "getranduser"): {
NavLabel: "随机玩家",
Desc: "随机玩家",
MainType: string(comm.ModuleGourmet),
SubType: "getranduser",
Enabled: true,
},
// sociaty
string(comm.ModuleSociaty): {
NavLabel: "公会",
MainType: string(comm.ModuleSociaty),
Enabled: true,
},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeCreate): {
NavLabel: "公会创建",
Desc: "公会创建",
MainType: string(comm.ModuleSociaty),
SubType: sociaty.SociatySubTypeCreate,
Enabled: true,
},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeList): {
NavLabel: "公会推荐",
Desc: "公会列表",
MainType: string(comm.ModuleSociaty),
SubType: sociaty.SociatySubTypeList,
Enabled: true,
Print: func(rsp proto.Message) string {
return "不打印"
},
},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeMine): {
NavLabel: "我的公会",
Desc: "我的公会",
MainType: string(comm.ModuleSociaty),
SubType: sociaty.SociatySubTypeMine,
Enabled: true,
},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeTasklist): {
NavLabel: "任务列表",
Desc: "任务列表",
MainType: string(comm.ModuleSociaty),
SubType: sociaty.SociatySubTypeTasklist,
Enabled: true,
},
ff(comm.ModuleSociaty, sociaty.SociatySubTypeRank): {
NavLabel: "排行榜",
Desc: "排行榜",
MainType: string(comm.ModuleSociaty),
SubType: sociaty.SociatySubTypeRank,
Enabled: true,
},
}
)

View File

@ -29,7 +29,7 @@ type appGen struct {
jsonList *common.ItemList
}
func (this *appGen) LazyInit(obs observer.Observer) error {
func (this *appGen) LazyInit(ptService service.PttService, obs observer.Observer) error {
this.obs = obs
this.goList = common.NewItemList()
this.jsonList = common.NewItemList()

View File

@ -3,6 +3,7 @@ package ui
import (
"errors"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"image/color"
"strconv"
@ -20,7 +21,7 @@ type appLock struct {
appAdapter
}
func (this *appLock) LazyInit(obs observer.Observer) error {
func (this *appLock) LazyInit(ptService service.PttService, obs observer.Observer) error {
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_SEC, theme.DownloadIcon(), nil)

View File

@ -28,7 +28,7 @@ type appPbGen struct {
folderList *folderList
}
func (this *appPbGen) LazyInit(obs observer.Observer) error {
func (this *appPbGen) LazyInit(ptService service.PttService, obs observer.Observer) error {
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_PB, theme.ContentAddIcon(), nil)
this.folderList = NewFolderList()

View File

@ -40,7 +40,7 @@ type appTerm struct {
downloadList *common.ItemList //download列表
}
func (this *appTerm) LazyInit(obs observer.Observer) error {
func (this *appTerm) LazyInit(ptService service.PttService, obs observer.Observer) error {
this.obs = obs
this.sshService = &service.SSHService{}
this.jsonList = common.NewItemList()

View File

@ -2,6 +2,7 @@ package ui
import (
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
them "go_dreamfactory/cmd/v2/theme"
@ -18,7 +19,7 @@ type appWelcome struct {
appAdapter
}
func (a *appWelcome) LazyInit(obs observer.Observer) error {
func (a *appWelcome) LazyInit(service service.PttService, obs observer.Observer) error {
logo := canvas.NewImageFromResource(them.ResourceLogoPng)
logo.FillMode = canvas.ImageFillContain
logo.SetMinSize(fyne.NewSize(362*0.8, 192*0.8))

View File

@ -59,7 +59,7 @@ func NewToolWindow(ui *UIImpl, parent fyne.Window) ToolWindow {
mw.tb = newToolBar(toolbar)
mw.at = newAppContainer(toolRegister, ui.obs)
mw.at = newAppContainer(toolRegister, nil, ui.obs)
return mw
}

View File

@ -36,7 +36,7 @@ func (tdt *toyDateTime) Init(obs observer.Observer) error {
),
)
tdt.widget.Resize(fyne.NewSize(ToyWidth, 100))
tdt.widget.Resize(fyne.NewSize(ToyWidth, 150))
// for init
tdt.Run()

View File

@ -100,6 +100,7 @@ func (this *toyUserInfo) dataListener() {
return
}
uid = this.userInfo.DbUser.Uid
// _ = this.data.Append(fmt.Sprintf("%-3s\t: %s", common.USERINFO_UID, this.userInfo.DbUser.Uid))
_ = this.data.Append(this.getAcc()) //0
_ = this.data.Append(this.getSid()) //1

View File

@ -11,6 +11,8 @@ import (
"github.com/BabySid/gobase"
)
var uid string
type UI interface {
AddWindow(name string, w fyne.Window)
Run()

View File

@ -2,6 +2,7 @@ package formview
import (
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"fyne.io/fyne/v2"
@ -9,12 +10,14 @@ import (
)
type BaseformView struct {
form *widget.Form
obs observer.Observer
w fyne.Window
form *widget.Form
obs observer.Observer
w fyne.Window
service service.PttService
}
func (this *BaseformView) Init(obs observer.Observer, w fyne.Window) {
func (this *BaseformView) Init(service service.PttService, obs observer.Observer, w fyne.Window) {
this.service = service
this.obs = obs
this.w = w
this.form = widget.NewForm()

View File

@ -0,0 +1,35 @@
package formview
import (
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type GourmentGetRandView struct {
BaseformView
}
func (this *GourmentGetRandView) CreateView(t *model.TestCase) fyne.CanvasObject {
peopleEntry := widget.NewEntry()
this.form.AppendItem(widget.NewFormItem("People", peopleEntry))
this.form.OnSubmit = func() {
if err := service.GetPttService().SendToClient(
string(comm.ModuleGourmet),
"getranduser",
&pb.GourmetGetRandUserReq{
People: cast.ToInt32(peopleEntry.Text),
}); err != nil {
logrus.Error(err)
}
}
return this.form
}

View File

@ -0,0 +1,43 @@
package formview
import (
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
type SociatyAppListView struct {
BaseformView
applyList func()
itemList *common.ItemList
flag bool
}
func (this *SociatyAppListView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.itemList = common.NewItemList()
this.itemList.ItemList = this.itemList.CreateDefaultCheckList()
this.applyList = func() {
}
defer this.applyList()
// 同意
agreeBtn := widget.NewButton("同意", nil)
// 拒绝
refuseBtn := widget.NewButton("拒绝", nil)
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.itemList.Reset()
this.applyList()
})
buttonBar := container.NewHBox(refreshBtn, agreeBtn, refuseBtn)
c := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
return c
}

View File

@ -0,0 +1,51 @@
package formview
import (
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/comm"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type SociatyCreateView struct {
BaseformView
}
func (this *SociatyCreateView) CreateView(t *model.TestCase) fyne.CanvasObject {
sociatyName := widget.NewEntry()
notice := widget.NewMultiLineEntry()
icon := widget.NewEntry()
isApplyCheck := widget.NewCheck("审批", nil)
applyLv := widget.NewEntry()
applyLv.Text = "1" //默认
this.form.AppendItem(widget.NewFormItem("公会名称", sociatyName))
this.form.AppendItem(widget.NewFormItem("公告", notice))
this.form.AppendItem(widget.NewFormItem("图标", icon))
this.form.AppendItem(widget.NewFormItem("审批", isApplyCheck))
this.form.AppendItem(widget.NewFormItem("入会等级", applyLv))
this.form.OnSubmit = func() {
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeCreate,
&pb.SociatyCreateReq{
Name: sociatyName.Text,
Icon: icon.Text,
Notice: notice.Text,
IsApplyCheck: isApplyCheck.Checked,
ApplyLv: cast.ToInt32(applyLv.Text),
}); err != nil {
logrus.Error(err)
}
}
this.form.SubmitText = "创建"
return this.form
}

View File

@ -0,0 +1,197 @@
package formview
import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/comm"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
)
type SociatyListView struct {
sociatyList func()
BaseformView
itemList *common.ItemList
flag bool
}
func (this *SociatyListView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.itemList = common.NewItemList()
this.itemList.ItemList = this.itemList.CreateList()
this.sociatyList = func() {
this.itemList.Reset()
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeList,
&pb.SociatyListReq{}); err != nil {
logrus.Error(err)
}
}
defer this.sociatyList()
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.itemList.Reset()
this.sociatyList()
})
// 申请
applyBtn := widget.NewButton("申请", func() {
defer func() {
common.ShowTip("已申请")
}()
selId := this.itemList.SelItemId
if selId == "" {
common.ShowTip("请选择项目")
return
}
logrus.Debugf("%s", selId)
if err := service.GetPttService().SendToClient(
t.MainType,
sociaty.SociatySubTypeApply,
&pb.SociatyApplyReq{
SociatyId: selId,
},
); err != nil {
logrus.Error(err)
return
}
})
//取消申请
cancalApplyBtn := widget.NewButton("取消申请", func() {
selId := this.itemList.SelItemId
if selId == "" {
common.ShowTip("请选择项目")
return
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeApplyCanel,
&pb.SociatyApplyCancelReq{
SociatyId: selId,
}); err != nil {
logrus.Error(err)
}
})
// 明细
detailBtn := widget.NewButton("明细", nil)
//过滤
filter := widget.NewSelect([]string{"全部", "满足条件", "无需审批", "申请中"}, func(s string) {
this.itemList.Reset()
var filter pb.SociatyListFilter
if s == "全部" {
filter = pb.SociatyListFilter_ALL
} else if s == "满足条件" {
filter = pb.SociatyListFilter_CONDI
} else if s == "无需审批" {
filter = pb.SociatyListFilter_NOAPPLY
} else if s == "申请中" {
filter = pb.SociatyListFilter_APPLYING
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeList,
&pb.SociatyListReq{
Filter: filter,
}); err != nil {
logrus.Error(err)
}
})
filter.Selected = "全部"
//搜索
searchEntry := widget.NewEntry()
searchEntry.PlaceHolder = "输入公会名称"
searchBtn := widget.NewButtonWithIcon("", theme.SearchIcon(), func() {
if searchEntry.Text == "" {
common.ShowTip("请输入公会名称")
return
}
this.itemList.Reset()
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeSearch,
&pb.SociatySearchReq{
Name: searchEntry.Text,
}); err != nil {
logrus.Error(err)
}
})
buttonBar := container.NewHBox(refreshBtn, applyBtn, cancalApplyBtn, detailBtn, filter)
cBar := container.NewBorder(nil, nil, buttonBar, searchBtn, searchEntry)
// layout
c := container.NewBorder(cBar, nil, nil, nil, this.itemList.ItemList)
//data listener for
this.dataListener()
return c
}
func (this *SociatyListView) dataListener() {
if this.flag {
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.SociatySubTypeList {
rsp := &pb.SociatyListResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for i, v := range rsp.List {
memberCount := len(v.Members)
var isApplyCheckLbl string
if v.IsApplyCheck {
isApplyCheckLbl = "需要审核"
} else {
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,
}
this.itemList.AddItem(item)
}
} else if data.MainType == string(comm.ModuleSociaty) &&
data.SubType == sociaty.SociatySubTypeSearch {
rsp := &pb.SociatySearchResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for i, v := range rsp.List {
memberCount := len(v.Members)
item := common.Item{
Id: v.Id,
Text: fmt.Sprintf("%d - %s 等级:%d 等级限制:%d %d人", i+1, v.Name, v.Lv, v.ApplyLv, memberCount),
}
this.itemList.AddItem(item)
}
}
},
})
this.flag = true
}

View File

@ -0,0 +1,518 @@
package formview
import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/comm"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type SociatyMineView struct {
BaseformView
loadSociaty func()
flag bool
itemList *common.ItemList //申请列表
memberList *common.ItemList //成员列表
flag2 bool
applyListFun func()
memberListFun func()
sociaty *pb.DBSociaty // 公会
job pb.SociatyJob // 职位
uid string
flag3 bool
}
type entryItem struct {
sociatyName *widget.Entry
notice *widget.Entry
icon *widget.Entry
isApplyCheck *widget.Check
applyLv *widget.Entry
}
func (this *SociatyMineView) CreateView(t *model.TestCase) fyne.CanvasObject {
user := this.service.GetUser()
if user == nil {
common.ShowTip("user not found")
}
this.uid = user.DbUser.Uid
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.loadSociaty = func() {
if err := service.GetPttService().SendToClient(
t.MainType,
sociaty.SociatySubTypeMine,
&pb.SociatyMineReq{},
); err != nil {
logrus.Error(err)
return
}
}
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.loadSociaty()
this.sociatyRender(item)
this.form.Refresh()
})
// 签到
signBtn := widget.NewButton("签到", this.showSignWin)
// 退出
quitBtn := widget.NewButton("退出", func() {
dialog.ShowConfirm("提示", "确定退出公会?", func(b bool) {
if !b {
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
sociaty.SociatySubTypeQuit,
&pb.SociatyQuitReq{},
); err != nil {
logrus.Error(err)
return
}
item = &entryItem{}
}, this.w)
})
btns := container.NewHBox(refreshBtn, signBtn)
//解散公会
jiesanBtn := widget.NewButton("解散", func() {
dialog.ShowConfirm("提示", "确定解散公会?", func(b bool) {
if !b {
return
}
if err := service.GetPttService().SendToClient(
t.MainType,
sociaty.SociatySubTypeDismiss,
&pb.SociatyDismissReq{},
); err != nil {
logrus.Error(err)
return
}
item = &entryItem{}
}, this.w)
})
// 转让
zhuanrangBtn := widget.NewButton("转让", nil)
//申请列表
applyListBtn := widget.NewButton("申请审批", this.showSociatyApplyListWin)
// 任务列表
taskListBtn := widget.NewButton("任务列表", this.showTaskListWin)
defer func() {
this.loadSociaty()
time.Sleep(time.Millisecond * 30) //必须要延迟,否则职位获取不到
if this.sociaty == nil {
dialog.ShowInformation("提示", "还没有加入任何公会", this.w)
return
}
if this.job == pb.SociatyJob_ADMIN ||
this.job == pb.SociatyJob_VICEPRESIDENT {
btns.Add(applyListBtn)
}
//会长
if this.job == pb.SociatyJob_PRESIDENT {
btns.Add(applyListBtn)
btns.Add(zhuanrangBtn)
btns.Add(jiesanBtn)
} else {
btns.Add(quitBtn)
}
btns.Add(taskListBtn)
this.sociatyRender(item)
this.form.Refresh()
}()
//成员列表
membersBtn := widget.NewButton("成员列表", this.showSociatyMemberWin)
btns.Add(membersBtn)
// 保存修改
this.form.OnSubmit = func() {
defer func() {
common.ShowTip("公告已更新")
}()
if err := service.GetPttService().SendToClient(
t.MainType,
sociaty.SociatySubTypeSetting,
&pb.SociatySettingReq{
SociatyId: this.sociaty.Id,
Icon: item.icon.Text,
Notice: item.notice.Text,
ApplyLv: cast.ToInt32(item.applyLv.Text),
IsApplyCheck: item.isApplyCheck.Checked,
},
); err != nil {
logrus.Error(err)
return
}
}
this.form.SubmitText = "保存修改"
c := container.NewBorder(btns, nil, nil, nil, this.form)
this.dataListener(item)
return c
}
func (this *SociatyMineView) sociatyRender(item *entryItem) {
if this.sociaty == nil {
dialog.ShowInformation("提示", "还没有加入任何公会", this.w)
return
}
if item != nil {
item.sociatyName.Text = this.sociaty.Name
item.notice.Text = this.sociaty.Notice
item.icon.Text = this.sociaty.Icon
item.isApplyCheck.Checked = this.sociaty.IsApplyCheck
item.applyLv.Text = cast.ToString(this.sociaty.ApplyLv)
}
}
func (this *SociatyMineView) dataListener(item *entryItem) {
if this.flag {
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 !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
if rsp.Sociaty == nil {
logrus.Debug("公会信息 nil")
return
}
this.sociaty = rsp.Sociaty
//设置成员职位
for _, m := range rsp.Sociaty.Members {
if m.Uid == this.uid {
logrus.Debug(m.Uid)
this.job = m.Job
break
}
}
logrus.Debugf("公会:%v", rsp.Sociaty)
item.sociatyName.Text = rsp.Sociaty.Name
item.notice.Text = rsp.Sociaty.Notice
item.icon.Text = rsp.Sociaty.Icon
item.isApplyCheck.Checked = rsp.Sociaty.IsApplyCheck
item.applyLv.Text = cast.ToString(rsp.Sociaty.ApplyLv)
this.form.Refresh()
},
})
this.flag = true
}
// 申请列表windows
func (this *SociatyMineView) showSociatyApplyListWin() {
this.itemList = common.NewItemList()
this.itemList.ItemList = this.itemList.CreateList()
this.applyListFun = func() {
if this.sociaty == nil {
dialog.ShowInformation("提示", "还没有加入任何公会", this.w)
return
}
sociatyId := this.sociaty.Id
if sociatyId == "" {
common.ShowTip("公会ID空")
return
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeApplyList,
&pb.SociatyApplyListReq{
SociatyId: sociatyId,
}); err != nil {
logrus.Error(err)
}
}
defer this.applyListFun()
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.itemList.Reset()
this.applyListFun()
})
agreeBtn := widget.NewButton("同意", func() {
defer this.itemList.Reset()
selId := this.itemList.SelItemId
if selId == "" {
common.ShowTip("请选择项目")
return
}
sociatyId := this.sociaty.Id
if sociatyId == "" {
common.ShowTip("公会ID空")
return
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeAgree,
&pb.SociatyAgreeReq{
Uid: selId,
}); err != nil {
logrus.Error(err)
}
})
refuseBtn := widget.NewButton("拒绝", func() {
defer this.itemList.Reset()
selId := this.itemList.SelItemId
if selId == "" {
common.ShowTip("请选择项目")
return
}
sociatyId := this.sociaty.Id
if sociatyId == "" {
common.ShowTip("公会ID空")
return
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeRefuse,
&pb.SociatyRefuseReq{
Uid: selId,
}); err != nil {
logrus.Error(err)
}
})
btns := container.NewHBox(refreshBtn, agreeBtn, refuseBtn)
c := container.NewBorder(btns, nil, nil, nil, this.itemList.ItemList)
dconf := dialog.NewCustom("公会审批", "关闭", c, this.w)
dconf.Resize(fyne.NewSize(800, 500))
dconf.Show()
this.applyListen()
}
func (this *SociatyMineView) applyListen() {
if this.flag2 {
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.SociatySubTypeApplyList) {
return
}
rsp := &pb.SociatyApplyListResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for i, v := range rsp.List {
item := common.Item{
Id: v.Uid,
Text: fmt.Sprintf("%d - %s lv:%d", i+1, v.Name, v.Lv),
}
this.itemList.AddItem(item)
}
},
})
this.flag2 = true
}
// 成员列表windows
func (this *SociatyMineView) showSociatyMemberWin() {
this.memberList = common.NewItemList()
this.memberList.ItemList = this.memberList.CreateList()
this.memberListFun = func() {
sociatyId := this.sociaty.Id
if sociatyId == "" {
common.ShowTip("公会ID空")
return
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeMembers,
&pb.SociatyMembersReq{}); err != nil {
logrus.Error(err)
}
}
defer this.memberListFun()
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.memberList.Reset()
this.memberListFun()
})
//弹劾
tanheBtn := widget.NewButton("弹劾", nil)
// 日志
logBtn := widget.NewButton("日志", nil)
// 退出
quitBtn := widget.NewButton("退出", nil)
btns := container.NewHBox(refreshBtn)
// 会长
if this.job == pb.SociatyJob_PRESIDENT {
}
// 副会长或管理员
if this.job == pb.SociatyJob_VICEPRESIDENT ||
this.job == pb.SociatyJob_ADMIN {
btns.Add(tanheBtn)
btns.Add(logBtn)
btns.Add(quitBtn)
}
// 成员
if this.job == pb.SociatyJob_MEMBER {
btns.Add(quitBtn)
}
c := container.NewBorder(btns, nil, nil, nil, this.memberList.ItemList)
dconf := dialog.NewCustom("公会成员", "关闭", c, this.w)
dconf.Resize(fyne.NewSize(800, 500))
dconf.Show()
this.memberListen()
}
func (this *SociatyMineView) memberListen() {
if this.flag3 {
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.SociatySubTypeMembers) {
return
}
rsp := &pb.SociatyMembersResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for i, v := range rsp.List {
item := common.Item{
Id: v.Uid,
Text: fmt.Sprintf("%d - %s lv:%d %v", i+1, v.Name, v.Lv, v.Job),
}
this.memberList.AddItem(item)
}
},
})
this.flag3 = true
}
// 签到
func (this *SociatyMineView) showSignWin() {
var lastCount int32
if this.sociaty == nil {
logrus.Error("公会 is nil")
return
}
lastCount = this.sociaty.LastSignCount
card := canvas.NewText(cast.ToString(lastCount), nil)
card.TextSize = 50
btn := widget.NewButton("签到", nil)
btn.OnTapped = func() {
defer btn.Disable()
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeSign,
&pb.SociatySignReq{},
); err != nil {
logrus.Error(err)
return
}
}
if _, ok := utils.Findx(this.sociaty.SignIds, this.uid); ok {
btn.Text = "已签到"
btn.Disable()
}
l := container.NewVBox(container.NewCenter(card), btn)
dconf := dialog.NewCustom("签到", "关闭", l, this.w)
dconf.Resize(fyne.NewSize(400, 600))
dconf.Show()
}
// 任务列表
func (this *SociatyMineView) showTaskListWin() {
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.memberList.Reset()
this.taskList()
})
btns := container.NewHBox(refreshBtn)
c := container.NewBorder(btns, nil, nil, nil, this.memberList.ItemList)
dconf := dialog.NewCustom("任务", "关闭", c, this.w)
dconf.Resize(fyne.NewSize(800, 500))
dconf.Show()
}
func (this *SociatyMineView) taskList() {
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.SociatySubTypeMembers) {
return
}
},
})
}

View File

@ -0,0 +1,82 @@
package formview
import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/comm"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
)
type SociatyRankView struct {
rankList func()
BaseformView
itemList *common.ItemList
flag bool
}
func (this *SociatyRankView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.itemList = common.NewItemList()
this.itemList.ItemList = this.itemList.CreateList()
this.rankList = func() {
this.itemList.Reset()
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeRank,
&pb.SociatyRankReq{}); err != nil {
logrus.Error(err)
}
}
defer this.rankList()
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.itemList.Reset()
this.rankList()
})
buttonBar := container.NewHBox(refreshBtn)
c := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
this.dataListener()
return c
}
func (this *SociatyRankView) dataListener() {
if this.flag {
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.SociatySubTypeRank) {
return
}
rsp := &pb.SociatyRankResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for i, v := range rsp.Rank {
item := common.Item{
Id: v.SociatyId,
Text: fmt.Sprintf("%d - %s 等级:%d 活跃度:%d", i+1, v.Name, v.Lv, v.Activity),
}
this.itemList.AddItem(item)
}
},
})
this.flag = true
}

View File

@ -0,0 +1,108 @@
package formview
import (
"fmt"
"go_dreamfactory/cmd/v2/lib/common"
"go_dreamfactory/cmd/v2/model"
"go_dreamfactory/cmd/v2/service"
"go_dreamfactory/cmd/v2/service/observer"
"go_dreamfactory/comm"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/pb"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
"github.com/sirupsen/logrus"
"github.com/spf13/cast"
)
type SociatyTasklistView struct {
BaseformView
taskList func()
itemList *common.ItemList
flag bool
}
func (this *SociatyTasklistView) CreateView(t *model.TestCase) fyne.CanvasObject {
this.itemList = common.NewItemList()
this.itemList.ItemList = this.itemList.CreateList()
this.taskList = func() {
this.itemList.Reset()
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeTasklist,
&pb.SociatyTaskListReq{}); err != nil {
logrus.Error(err)
}
}
defer this.taskList()
refreshBtn := widget.NewButtonWithIcon("", theme.ViewRefreshIcon(), func() {
this.itemList.Reset()
this.taskList()
})
// 领取
receiveBtn := widget.NewButton("", func() {
selId := this.itemList.SelItemId
if selId == "" {
common.ShowTip("请选择项目")
return
}
if err := service.GetPttService().SendToClient(
string(comm.ModuleSociaty),
sociaty.SociatySubTypeReceive,
&pb.SociatyReceiveReq{
TaskId: cast.ToInt32(selId),
}); err != nil {
logrus.Error(err)
}
})
//活跃度领取
activityBtn := widget.NewButton("", nil)
activityVal := canvas.NewText("", nil)
buttonBar := container.NewHBox(refreshBtn, receiveBtn)
c1 := container.NewBorder(buttonBar, nil, nil, nil, this.itemList.ItemList)
c2 := container.NewBorder(nil, nil, nil, nil, container.NewVBox(container.NewCenter(activityVal), activityBtn))
cols := container.NewGridWithColumns(2, c1, c2)
this.dataListener()
return cols
}
func (this *SociatyTasklistView) dataListener() {
if this.flag {
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.SociatySubTypeTasklist) {
return
}
rsp := &pb.SociatyTaskListResp{}
if !comm.ProtoUnmarshal(data, rsp) {
logrus.Error("unmarshal err")
return
}
for i, v := range rsp.List {
item := common.Item{
Id: cast.ToString(v.TaskId),
Text: fmt.Sprintf("%d - Id:%v 状态:%d ", i+1, v.TaskId, v.Status),
}
this.itemList.AddItem(item)
}
},
})
this.flag = true
}

View File

@ -23,7 +23,9 @@ const (
)
const (
RDS_SESSION = "online"
RDS_SESSION = "online"
RDS_SOCIATY = "all"
RDS_SOCIATYRANK = "rank"
)
//ERR
@ -68,6 +70,7 @@ const (
ModuleTroll core.M_Modules = "troll" //巨怪商队
ModuleHoroscope core.M_Modules = "horoscope" //星座图
//ModuleFetter core.M_Modules = "herofetter" //好友模块
ModuleSociaty core.M_Modules = "sociaty" //公会
)
//数据表名定义处
@ -166,6 +169,11 @@ const (
//星座图
TableHoroscope = "horoscope"
// 公会
TableSociaty = "sociaty"
// 公会任务
TableSociatyTask = "sociatytask"
)
//RPC服务接口定义处
@ -203,6 +211,8 @@ const (
EventUserChanged core.Event_Key = "event_user_changed" //用户数据变化
EventTaskChanged core.Event_Key = "event_task_changed" //任务数据变化
EventSociatyRankChanged core.Event_Key = "event_sociatyRank_changed" //公会数据变化
)
const (

View File

@ -90,9 +90,13 @@ type (
// 跨服搜索玩家
CrossSearchUser(nickname string) ([]*pb.DBUser, error)
// 获取远程用户
GetRmoteUser(uid string) (*pb.DBUser, error)
GetRemoteUser(uid string) (*pb.DBUser, error)
// 搜索远程用户
SearchRmoteUser(nickname string) ([]*pb.DBUser, error)
// 获取远程用户expand
GetRemoteUserExpand(uid string) (result *pb.DBUserExpand, err error)
// 更新远程用户expand
ChangeRemoteUserExpand(uid string, value map[string]interface{}) error
}
//武器模块
IEquipment interface {
@ -200,4 +204,11 @@ type (
IHunting interface {
CheckUserBaseHuntingInfo(uid string) (data []*pb.DBHuntingRank) // 查询玩家最佳通关记录
}
// 公会
ISociaty interface {
//会长弹劾处理
ProcessAccuse(uid, sociatyId string)
// 公会成员
Members(uid string) (list []*pb.SociatyMemberInfo)
}
)

View File

@ -39,7 +39,7 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core.
}
func (this *apiComp) setDefaultFriendUserBaseInfo(userId string) *pb.FriendBase {
if user, err := this.moduleFriend.ModuleUser.GetRmoteUser(userId); err != nil {
if user, err := this.moduleFriend.ModuleUser.GetRemoteUser(userId); err != nil {
this.moduleFriend.Errorf("GetRmoteUser err:%v", err)
return nil
} else {

View File

@ -51,7 +51,7 @@ func (this *apiComp) Agree(session comm.IUserSession, req *pb.FriendAgreeReq) (c
agreeIds := []string{}
for _, friendId := range req.FriendIds {
// 验证friendId是否有效
user, err := this.moduleFriend.ModuleUser.GetRmoteUser(friendId)
user, err := this.moduleFriend.ModuleUser.GetRemoteUser(friendId)
if err != nil {
continue
}

View File

@ -21,7 +21,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success {
return
}
globalCnf := this.moduleFriend.configure.GetGlobalConf()
if globalCnf == nil {
code = pb.ErrorCode_ConfigNoFound

View File

@ -26,6 +26,7 @@ func (this *apiComp) Search(session comm.IUserSession, req *pb.FriendSearchReq)
users, err := this.moduleFriend.ModuleUser.SearchRmoteUser(req.NickName)
if err != nil {
code = pb.ErrorCode_DBError
this.moduleFriend.Errorf("搜索玩家 err:%v", err)
return
}

View File

@ -85,7 +85,7 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.GourmetGetRa
}
}
for k := range mapUser {
if user, err := this.module.ModuleUser.GetRmoteUser(k); err == nil && user.Uid != "" {
if user, err := this.module.ModuleUser.GetRemoteUser(k); err == nil && user.Uid != "" {
szDbUser = append(szDbUser, user) // 转成user对象
} else {
this.module.Errorf("%v", err)

View File

@ -36,6 +36,7 @@ type ModuleBase struct {
ModuleTask comm.ITask //任务
ModuleFriend comm.IFriend //好友
ModuleRtask comm.IRtask //随机任务
ModuleSociaty comm.ISociaty //公会
}
//重构模块配置对象
@ -99,8 +100,12 @@ func (this *ModuleBase) Start() (err error) {
if module, err = this.service.GetModule(comm.ModuleSys); err != nil {
return
}
this.ModuleSys = module.(comm.ISys)
if module, err = this.service.GetModule(comm.ModuleSociaty); err != nil {
return
}
this.ModuleSociaty = module.(comm.ISociaty)
return
}

View File

@ -216,7 +216,7 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
session.GetServiecTag(),
comm.Service_Worker,
string(comm.Rpc_ModuleRtaskSendTask),
pb.RPCRTaskReq{Uid: session.GetUserId(), TaskType: int32(rtaskType), Param: params},
pb.RPCRTaskReq{Uid: session.GetUserId(), TaskType: int32(rtaskType),},
nil); err != nil {
this.Errorln(err)
}
@ -358,7 +358,7 @@ func (this *ModuleRtask) Rpc_ModuleRtaskSendTask(ctx context.Context, args *pb.R
err = fmt.Errorf("未查询到用户:%s在线信息!", args.Uid)
return
} else {
this.SendToRtask(session, comm.TaskType(args.TaskType), args.Param...)
this.SendToRtask(session, comm.TaskType(args.TaskType),)
session.Push()
}
return

View File

@ -85,7 +85,7 @@ func (this *apiComp) GetRandUser(session comm.IUserSession, req *pb.SmithyGetRan
}
}
for k := range mapUser {
if user, err := this.module.ModuleUser.GetRmoteUser(k); err == nil && user.Uid != "" {
if user, err := this.module.ModuleUser.GetRemoteUser(k); err == nil && user.Uid != "" {
szDbUser = append(szDbUser, user) // 转成user对象
} else {
this.module.Errorf("%v", err)

44
modules/sociaty/api.go Normal file
View File

@ -0,0 +1,44 @@
package sociaty
import (
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
)
const (
SociatySubTypeList = "list"
SociatySubTypeMine = "mine"
SociatySubTypeCreate = "create"
SociatySubTypeSearch = "search"
SociatySubTypeApply = "apply"
SociatySubTypeApplyCanel = "applycancel"
SociatySubTypeApplyList = "applylist"
SociatySubTypeCancel = "cancel"
SociatySubTypeDismiss = "dismiss"
SociatySubTypeQuit = "quit"
SociatySubTypeAgree = "agree"
SociatySubTypeRefuse = "refuse"
SociatySubTypeSetting = "setting"
SociatySubTypeMembers = "members"
SociatySubTypeAssign = "assign"
SociatySubTypeDischarge = "discharge"
SociatySubTypeSettingJob = "settingjob"
SociatySubTypeSign = "sign"
SociatySubTypeReceive = "receive"
SociatySubTypeActivityReceive = "activityreceive"
SociatySubTypeRank = "rank"
SociatySubTypeTasklist = "tasklist"
)
type apiComp struct {
modules.MCompGate
service base.IRPCXService
module *Sociaty
}
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.(*Sociaty)
return
}

View File

@ -0,0 +1,50 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 弹劾会长
func (this *apiComp) AsscuseCheck(session comm.IUserSession, req *pb.SociatyAccuseReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Asscuse(session comm.IUserSession, req *pb.SociatyAccuseReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AsscuseCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_VICEPRESIDENT,
pb.SociatyJob_ADMIN,
pb.SociatyJob_MEMBER) {
code = pb.ErrorCode_SociatyNoRight
return
}
if err := this.module.modelSociaty.accuse(sociaty); err != nil {
code = pb.ErrorCode_SociatyAccuse
this.module.Errorf("弹劾失败:%v", err)
return
}
rsp := &pb.SociatyAccuseResp{
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,56 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 活跃度领取
func (this *apiComp) ActivityreceiveCheck(session comm.IUserSession, req *pb.SociatyActivityReceiveReq) (code pb.ErrorCode) {
if req.Id == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Activityreceive(session comm.IUserSession, req *pb.SociatyActivityReceiveReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ActivityreceiveCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
ggt, err := this.module.configure.getSociatyActivityCfg()
if err != nil || ggt == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
conf, ok := ggt.GetDataMap()[req.Id]
if !ok {
code = pb.ErrorCode_ConfigNoFound
return
}
//是否满足领取条件
if sociaty.Activity < conf.Activity {
this.module.Errorf("弹劾失败:%v", err)
return
}
rsp := &pb.SociatyActivityReceiveResp{
Id: req.Id,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeActivityReceive, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,53 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 申请-同意
func (this *apiComp) AgreeCheck(session comm.IUserSession, req *pb.SociatyAgreeReq) (code pb.ErrorCode) {
if req.Uid == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Agree(session comm.IUserSession, req *pb.SociatyAgreeReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AgreeCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT,
pb.SociatyJob_VICEPRESIDENT,
pb.SociatyJob_ADMIN) {
code = pb.ErrorCode_SociatyNoRight
return
}
if err := this.module.modelSociaty.agree(req.Uid, sociaty); err != nil {
code = pb.ErrorCode_SociatyAgree
this.module.Errorf("申请同意失败:%v", err)
return
}
rsp := &pb.SociatyAgreeResp{
Uid: req.Uid,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAgree, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,87 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会申请
func (this *apiComp) ApplyCheck(session comm.IUserSession, req *pb.SociatyApplyReq) (code pb.ErrorCode) {
if req.SociatyId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success {
return
}
// 全局配置
ggd := this.module.configure.GetGlobalConf()
if ggd == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("sociatyId: %s no found", req.SociatyId)
return
}
// 是否达到入会等级
user, err := this.module.ModuleUser.GetRemoteUser(uid)
if err != nil {
return
}
if user == nil {
code = pb.ErrorCode_UserSessionNobeing
return
}
if user.Lv < sociaty.ApplyLv {
code = pb.ErrorCode_SociatyAppyLvNoEnough
return
}
// 是否公会成员
if this.module.modelSociaty.isMember(uid, sociaty) {
code = pb.ErrorCode_SociatyBelongTo
return
}
// 是否已申请
if this.module.modelSociaty.isApplied(uid, sociaty) {
code = pb.ErrorCode_SociatyApplied
return
}
//判断申请人数是否超出最大允许申请数
if len(sociaty.ApplyRecord) >= int(ggd.GuildAcceptApplyMax) {
code = pb.ErrorCode_SociatyApplyMax
return
}
// 申请
if err := this.module.modelSociaty.apply(uid, sociaty); err != nil {
code = pb.ErrorCode_SociatyApply
this.module.Errorf("公会申请失败 sociatyId:%s err:%v", req.SociatyId, err)
return
}
rsp := &pb.SociatyApplyResp{
Uid: uid,
ScoiatyId: req.SociatyId,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApply, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,37 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) ApplyCancelCheck(session comm.IUserSession, req *pb.SociatyApplyCancelReq) (code pb.ErrorCode) {
if req.SociatyId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) ApplyCancel(session comm.IUserSession, req *pb.SociatyApplyCancelReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ApplyCancelCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
if err := this.module.modelSociaty.applyCancel(uid, req.SociatyId); err != nil {
code = pb.ErrorCode_SociatyApplyCanel
this.module.Errorf("申请撤销失败:%v", err)
return
}
rsp := &pb.SociatyApplyResp{
Uid: uid,
ScoiatyId: req.SociatyId,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyCanel, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,47 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 申请列表
func (this *apiComp) ApplyListCheck(session comm.IUserSession, req *pb.SociatyApplyListReq) (code pb.ErrorCode) {
if req.SociatyId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) ApplyList(session comm.IUserSession, req *pb.SociatyApplyListReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ApplyListCheck(session, req); code != pb.ErrorCode_Success {
return
}
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("sociatyId: %s no found", req.SociatyId)
return
}
uid := session.GetUserId()
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT,
pb.SociatyJob_VICEPRESIDENT,
pb.SociatyJob_ADMIN) {
code = pb.ErrorCode_SociatyNoRight
return
}
list := this.module.modelSociaty.applyList(sociaty)
rsp := &pb.SociatyApplyListResp{
List: list,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeApplyList, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,51 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会转让
func (this *apiComp) AssignCheck(session comm.IUserSession, req *pb.SociatyAssignReq) (code pb.ErrorCode) {
if req.TargetId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Assign(session comm.IUserSession, req *pb.SociatyAssignReq) (code pb.ErrorCode, data proto.Message) {
if code = this.AssignCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty, pb.SociatyJob_PRESIDENT) {
code = pb.ErrorCode_SociatyNoRight
return
}
if err := this.module.modelSociaty.assign(uid, req.TargetId, sociaty); err != nil {
code = pb.ErrorCode_SociatyAssign
this.module.Errorf("转让失败:%v", err)
return
}
rsp := &pb.SociatyAssignResp{
TargetId: req.TargetId,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeAssign, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,18 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 申请取消
func (this *apiComp) CancelCheck(session comm.IUserSession, req *pb.SociatyCancelReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Cancel(session comm.IUserSession, req *pb.SociatyCancelReq) (code pb.ErrorCode, data proto.Message) {
return
}

View File

@ -0,0 +1,117 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"time"
cfg "go_dreamfactory/sys/configure/structs"
"google.golang.org/protobuf/proto"
)
// 公会创建
func (this *apiComp) CreateCheck(session comm.IUserSession, req *pb.SociatyCreateReq) (code pb.ErrorCode) {
if len(req.Notice) > 150 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq) (code pb.ErrorCode, data proto.Message) {
if code = this.CreateCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
user, err := this.module.ModuleUser.GetRemoteUser(uid)
if err != nil {
this.module.Errorf("GetRmoteUser err:%v", err)
code = pb.ErrorCode_DBError
return
}
if user.Uid == "" {
this.module.Errorf("GetRmoteUser not found uid:%v", uid)
code = pb.ErrorCode_UserSessionNobeing
return
}
userExpand, err := this.module.ModuleUser.GetRemoteUserExpand(uid)
if err != nil {
this.module.Errorf("GetRemoteUserExpand err:%v", err)
code = pb.ErrorCode_DBError
return
}
//检查是否已加入公会
if userExpand.SociatyId != "" {
code = pb.ErrorCode_SociatyAdded
return
}
// CD校验
if this.module.modelSociaty.isInCDHour(userExpand.SociatyCd){
code = pb.ErrorCode_SociatyCDLimit
return
}
//检查钻石
ggd := this.module.modelSociaty.moduleSociaty.configure.GetGlobalConf()
if ggd == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
if code = this.module.ConsumeRes(session, []*cfg.Gameatn{ggd.GuildBuildCos}, true); code != pb.ErrorCode_Success {
return
}
//创建公会
sociaty := &pb.DBSociaty{
Creater: user.Uid,
Name: req.Name,
Icon: req.Icon,
Notice: req.Notice,
IsApplyCheck: req.IsApplyCheck,
ApplyLv: req.ApplyLv,
}
//会长
sociaty.Members = append(sociaty.Members, &pb.SociatyMember{
Uid: user.Uid,
Job: pb.SociatyJob_PRESIDENT, //创建人是会长
Ctime: time.Now().Unix(),
})
if err := this.module.modelSociaty.create(sociaty); err != nil {
code = pb.ErrorCode_DBError
this.module.Errorf("创建公会 err:%v", err)
return
}
// 更新玩家公会
update := map[string]interface{}{
"sociatyId": sociaty.Id,
}
if err = this.module.ModuleUser.ChangeRemoteUserExpand(user.Uid, update); err != nil {
code = pb.ErrorCode_DBError
this.module.Errorf("更新玩家公会ID err:%v", err)
return
}
// 初始化任务
if err := this.module.modelSociatyTask.initSociatyTask(user.Uid, sociaty.Id); err != nil {
this.module.Errorf("初始化玩家任务 err:%v", err)
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeCreate, &pb.SociatyCreateResp{
Id: sociaty.Id,
Uid: uid,
}); err != nil {
code = pb.ErrorCode_SystemError
return
}
return
}

View File

@ -0,0 +1,53 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 踢出公会
func (this *apiComp) DischargeCheck(session comm.IUserSession, req *pb.SociatyDischargeReq) (code pb.ErrorCode) {
if req.TargetId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Discharge(session comm.IUserSession, req *pb.SociatyDischargeReq) (code pb.ErrorCode, data proto.Message) {
if code = this.DischargeCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT,
pb.SociatyJob_VICEPRESIDENT) {
code = pb.ErrorCode_SociatyNoRight
return
}
if err := this.module.modelSociaty.discharge(req.TargetId, sociaty); err != nil {
code = pb.ErrorCode_SociatyDischarge
this.module.Errorf("踢出公会失败:%v", err)
return
}
rsp := &pb.SociatyDischargeResp{
TargetId: req.TargetId,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDischarge, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,61 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会解散
func (this *apiComp) DismissCheck(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT) {
code = pb.ErrorCode_SociatyNoRight
return
}
for _, m := range sociaty.Members {
//清除成员任务
this.module.modelSociatyTask.deleTask(sociaty.Id, m.Uid)
//清除玩家sociatyId
update := map[string]interface{}{
"sociatyId": "", //公会ID置空
}
if err := this.module.ModuleUser.ChangeRemoteUserExpand(m.Uid, update); err != nil {
code = pb.ErrorCode_DBError
this.module.Errorf("更新玩家公会ID err:%v", err)
return
}
}
// 删除公会
if err := this.module.modelSociaty.dismiss(sociaty); err != nil {
code = pb.ErrorCode_SociatyDismiss
this.module.Errorf("sociatyId: %s dismiss err:%v", sociaty.Id, err)
return
}
rsp := &pb.SociatyDismissResp{
Uid: session.GetUserId(),
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,27 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会列表
func (this *apiComp) ListCheck(session comm.IUserSession, req *pb.SociatyListReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) List(session comm.IUserSession, req *pb.SociatyListReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ListCheck(session, req); code != pb.ErrorCode_Success {
return
}
rsp := &pb.SociatyListResp{}
rsp.List = this.module.modelSociaty.list(session.GetUserId(), req.Filter)
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeList, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,34 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会成员列表
func (this *apiComp) MembersCheck(session comm.IUserSession, req *pb.SociatyMembersReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Members(session comm.IUserSession, req *pb.SociatyMembersReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
members := this.module.modelSociaty.members(sociaty)
rsp := &pb.SociatyMembersResp{
List: members,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMembers, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,43 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
func (this *apiComp) MineCheck(session comm.IUserSession, req *pb.SociatyMineReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
userEx, err := this.module.ModuleUser.GetRemoteUserExpand(uid)
if err != nil {
this.module.Errorf("GetRemoteUserExpand uid: err:%v", uid, err)
code = pb.ErrorCode_UserSessionNobeing
return
}
rsp := &pb.SociatyMineResp{}
// 已加入公会
if userEx.SociatyId != "" {
sociaty := this.module.modelSociaty.getSociaty(userEx.SociatyId)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("sociatyId: %s no found", userEx.SociatyId)
return
}
master := this.module.modelSociaty.getMasterInfo(sociaty)
rsp.Sociaty = sociaty
rsp.Master = master
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeMine, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,50 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 退出公会
func (this *apiComp) QuitCheck(session comm.IUserSession, req *pb.SociatyQuitReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if err := this.module.modelSociaty.quit(uid, sociaty); err != nil {
code = pb.ErrorCode_SociatyQuit
this.module.Errorf("退出公会失败:%v", err)
return
}
//更新玩家sociatyId
update := map[string]interface{}{
"sociatyId": "",
}
if err := this.module.ModuleUser.ChangeRemoteUserExpand(uid, update); err != nil {
code = pb.ErrorCode_DBError
this.module.Errorf("更新玩家公会ID err:%v", err)
return
}
rsp := &pb.SociatyQuitResp{
Uid: uid,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,26 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会排行榜
func (this *apiComp) RankCheck(session comm.IUserSession, req *pb.SociatyRankReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Rank(session comm.IUserSession, req *pb.SociatyRankReq) (code pb.ErrorCode, data proto.Message) {
list := this.module.modelSociaty.rank()
rsp := &pb.SociatyRankResp{
Rank: list,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeRank, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,84 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 任务奖励领取
func (this *apiComp) ReceiveCheck(session comm.IUserSession, req *pb.SociatyReceiveReq) (code pb.ErrorCode) {
if req.TaskId == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Receive(session comm.IUserSession, req *pb.SociatyReceiveReq) (code pb.ErrorCode, data proto.Message) {
if code = this.ReceiveCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
// 判断奖励是否已领
sociatyTask := this.module.modelSociaty.getUserTaskList(uid, sociaty.Id)
for _, v := range sociatyTask.List {
if v.TaskId == req.TaskId && v.Status == 1 {
code = pb.ErrorCode_SociatyRewardReceived
return
}
}
//TODO 验证任务是否完成
// 领取
if err := this.module.modelSociatyTask.receive(req.TaskId, uid, sociaty.Id); err != nil {
code = pb.ErrorCode_SociatyRewardReceive
this.module.Errorf("领取任务奖励 err:%v", err)
return
}
//获取奖励配置
ggt, err := this.module.configure.getSociatyTaskCfg()
if err != nil || ggt == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
conf, ok := ggt.GetDataMap()[req.TaskId]
if ok {
// 发放个人奖励
if code = this.module.DispenseRes(session, conf.Reward, true); code != pb.ErrorCode_Success {
this.module.Errorf("发放个人奖励失败 sociatyId:%s uid:%s taskId:%d code:%v", sociaty.Id, uid, req.TaskId, code)
}
}
// 更新公会经验和活跃度
if err := this.module.modelSociaty.updateResourceFromTask(sociaty, conf); err != nil {
this.module.Errorf("更新公会资源 sociatyId:%s uid:%s taskId:%d err:%v", sociaty.Id, uid, req.TaskId, err)
return
}
// 更新成员贡献值
if err := this.module.modelSociaty.updateMemberContribution(uid, conf.Contribution, sociaty); err != nil {
this.module.Errorf("更新成员贡献值 sociatyId:%s uid:%s taskId:%d err:%v", sociaty.Id, uid, req.TaskId, err)
return
}
rsp := &pb.SociatyReceiveResp{
SociatyId: sociaty.Id,
TaskId: req.TaskId,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeReceive, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,53 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 申请复查
func (this *apiComp) RefuseCheck(session comm.IUserSession, req *pb.SociatyRefuseReq) (code pb.ErrorCode) {
if req.Uid == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Refuse(session comm.IUserSession, req *pb.SociatyRefuseReq) (code pb.ErrorCode, data proto.Message) {
if code = this.RefuseCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT,
pb.SociatyJob_VICEPRESIDENT,
pb.SociatyJob_ADMIN) {
code = pb.ErrorCode_SociatyNoRight
return
}
if err := this.module.modelSociaty.refuse(req.Uid, sociaty); err != nil {
code = pb.ErrorCode_SociatyRefuse
this.module.Errorf("申请拒绝失败:%v", err)
return
}
rsp := &pb.SociatyRefuseResp{
Uid: req.Uid,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeRefuse, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,33 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会搜索
func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.SociatySearchReq) (code pb.ErrorCode) {
if req.Name == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Search(session comm.IUserSession, req *pb.SociatySearchReq) (code pb.ErrorCode, data proto.Message) {
if code = this.SearchCheck(session, req); code != pb.ErrorCode_Success {
return
}
rsp := &pb.SociatySearchResp{}
sociaty := this.module.modelSociaty.findByName(req.Name)
if sociaty.Id != "" {
rsp.List = append(rsp.List, sociaty)
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSearch, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,57 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 公会设置
func (this *apiComp) SettingCheck(session comm.IUserSession, req *pb.SociatySettingReq) (code pb.ErrorCode) {
if req.SociatyId == "" {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) Setting(session comm.IUserSession, req *pb.SociatySettingReq) (code pb.ErrorCode, data proto.Message) {
if code = this.SettingCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getSociaty(req.SociatyId)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("sociatyId: %s no found", req.SociatyId)
return
}
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT, pb.SociatyJob_VICEPRESIDENT) {
code = pb.ErrorCode_SociatyNoRight
return
}
sociaty.Icon = req.Icon
sociaty.Notice = req.Notice
sociaty.IsApplyCheck = req.IsApplyCheck
sociaty.ApplyLv = req.ApplyLv
if err := this.module.modelSociaty.setting(sociaty); err != nil {
code = pb.ErrorCode_SociatySetting
this.module.Errorf("公会修改失败:%v", err)
return
}
rsp := &pb.SociatySettingResp{
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSetting, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,75 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 设置职位
func (this *apiComp) SettingJobCheck(session comm.IUserSession, req *pb.SociatySettingJobReq) (code pb.ErrorCode) {
if req.TargetId == "" || req.Job == 0 {
code = pb.ErrorCode_ReqParameterError
}
return
}
func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettingJobReq) (code pb.ErrorCode, data proto.Message) {
if code = this.SettingJobCheck(session, req); code != pb.ErrorCode_Success {
return
}
// 全局配置
ggd := this.module.configure.GetGlobalConf()
if ggd == nil {
code = pb.ErrorCode_ConfigNoFound
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
// 权限校验
if !this.module.modelSociaty.isRight(uid, sociaty,
pb.SociatyJob_PRESIDENT) {
code = pb.ErrorCode_SociatyNoRight
return
}
// 判断职位人数
jobCount := this.module.modelSociaty.getJobCount(req.Job, sociaty)
if req.Job == pb.SociatyJob_VICEPRESIDENT && jobCount >= int(ggd.GuildViceAllianceLeaderMaxNum) ||
req.Job == pb.SociatyJob_ADMIN && jobCount >= int(ggd.GuildAdministratorsMaxNum) {
code = pb.ErrorCode_SociatyMemberCountLimit
return
}
// 不能设置自己
if uid == req.TargetId {
code = pb.ErrorCode_SociatySelfSetting
return
}
// 设置职位
if err := this.module.modelSociaty.settingJob(req.TargetId, req.Job, sociaty); err != nil {
code = pb.ErrorCode_SociatySettingJob
this.module.Errorf("设置职位失败:%v", err)
return
}
rsp := &pb.SociatySettingJobResp{
TargetId: req.TargetId,
SociatyId: sociaty.Id,
Job: req.Job,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSettingJob, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,76 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 签到
func (this *apiComp) SignCheck(session comm.IUserSession, req *pb.SociatySignReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) Sign(session comm.IUserSession, req *pb.SociatySignReq) (code pb.ErrorCode, data proto.Message) {
if code = this.SignCheck(session, req); code != pb.ErrorCode_Success {
return
}
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
if this.module.modelSociaty.IsSign(uid, sociaty) {
code = pb.ErrorCode_SociatySigned
return
}
// 签到
if err := this.module.modelSociaty.sign(uid, sociaty); err != nil {
code = pb.ErrorCode_SociatyAgree
this.module.Errorf("签到失败:%v", err)
return
}
ggs, err := this.module.configure.getSociatySignCfg()
if err != nil {
code = pb.ErrorCode_ConfigNoFound
return
}
// 发奖
lastSignCount := sociaty.LastSignCount
var signCfgId int32 //签到配置ID
for _, v := range ggs.GetDataList() {
if lastSignCount >= v.Down && lastSignCount <= v.Up {
// 发放签到奖励
if code = this.module.DispenseRes(session, v.Reward, true); code == pb.ErrorCode_Success {
signCfgId = v.Id
}
}
}
if cfg, ok := ggs.GetDataMap()[signCfgId]; ok {
// 更新公会经验
if cfg.Exp.T == "guildexp" {
if err := this.module.modelSociaty.updateSociatyExp(cfg.Exp.N, sociaty); err != nil {
this.module.Errorf("公会经验更新失败:%v", err)
}
}
}
rsp := &pb.SociatySignResp{
Uid: uid,
SociatyId: sociaty.Id,
}
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSign, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
return
}

View File

@ -0,0 +1,46 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
// 任务列表
func (this *apiComp) TaskListCheck(session comm.IUserSession, req *pb.SociatyTaskListReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) TaskList(session comm.IUserSession, req *pb.SociatyTaskListReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
this.module.Errorf("uid:%s not in sociaty", uid)
return
}
rsp := &pb.SociatyTaskListResp{}
defer func() {
if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeTasklist, rsp); err != nil {
code = pb.ErrorCode_SystemError
}
}()
sociatyTask := this.module.modelSociatyTask.taskList(uid, sociaty.Id)
if sociatyTask.SociatyId != "" {
var taskList []*pb.SociatyTask
for _, v := range sociatyTask.List {
taskList = append(taskList, &pb.SociatyTask{
TaskId: v.TaskId,
Status: v.Status,
})
}
rsp.List = taskList
}
return
}

98
modules/sociaty/config.go Normal file
View File

@ -0,0 +1,98 @@
package sociaty
import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
cfg "go_dreamfactory/sys/configure/structs"
)
const (
gameSociatyLv = "game_guildlv.json"
gameSociatyTask = "game_guildtask.json"
gameSociatySign = "game_guildsign.json"
gameSociatyActivity = "game_guildactivity.json"
)
type configureComp struct {
modules.MCompConfigure
}
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
err = this.MCompConfigure.Init(service, module, comp, options)
err = this.LoadMultiConfigure(map[string]interface{}{
gameSociatyLv: cfg.NewGameGuildLv,
gameSociatyTask: cfg.NewGameGuildTask,
gameSociatySign: cfg.NewGameGuildSign,
gameSociatyActivity: cfg.NewGameGuildActivity,
})
return
}
// 等级配置
func (this *configureComp) getSociatyLvCfg() (data *cfg.GameGuildLv, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatyLv); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildLv); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildLv", v)
return
}
}
return
}
// 签到配置
func (this *configureComp) getSociatySignCfg() (data *cfg.GameGuildSign, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatySign); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildSign); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildSign", v)
return
}
}
return
}
// 任务配置
func (this *configureComp) getSociatyTaskCfg() (data *cfg.GameGuildTask, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatyTask); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildTask); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildTask", v)
return
}
}
return
}
// 活跃度配置
func (this *configureComp) getSociatyActivityCfg() (data *cfg.GameGuildActivity, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(gameSociatyActivity); err != nil {
return
} else {
if data, ok = v.(*cfg.GameGuildActivity); !ok {
err = fmt.Errorf("%T no is *cfg.GameGuildActivity", v)
return
}
}
return
}

View File

@ -0,0 +1,750 @@
package sociaty
import (
"context"
"errors"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
event_v2 "go_dreamfactory/lego/sys/event/v2"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
cfg "go_dreamfactory/sys/configure/structs"
"go_dreamfactory/utils"
"sort"
"strings"
"time"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
)
type Tag string
const (
Log_Job Tag = `%s玩家已将%s玩家设为了%s` //职位变动
Log_Quit Tag = "log_quit" //退出
Log_Add Tag = `%s玩家加入了公会` //加入
Log_Upgrade Tag = "log_upgrade" //升级
Log_Discharge Tag = "log_discharge" //踢出
)
type ModelSociaty struct {
modules.MCompModel
moduleSociaty *Sociaty
service core.IService
EventApp *event_v2.App
}
type SociatyListen struct {
event_v2.App
sociatyId string
name string
lv int32
activity int32
ctime int64
}
func (this *ModelSociaty) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableSociaty
err = this.MCompModel.Init(service, module, comp, options)
this.moduleSociaty = module.(*Sociaty)
this.service = service
this.EventApp = event_v2.NewApp()
this.EventApp.Listen(comm.EventSociatyRankChanged, this.rankDataChanged)
return
}
// 创建公会
func (this *ModelSociaty) create(sociaty *pb.DBSociaty) error {
if sociaty == nil {
return fmt.Errorf("sociaty is nil")
}
_id := primitive.NewObjectID().Hex()
sociaty.Id = _id
sociaty.Ctime = time.Now().Unix()
sociaty.Lv = 1 //默认1级
if sociaty.Icon == "" {
sociaty.Icon = "1000" //默认图标
}
if sociaty.ApplyLv == 0 {
sociaty.ApplyLv = 1 //默认玩家入会等级
}
return this.AddList(comm.RDS_SOCIATY, sociaty.Id, sociaty)
}
// 公会列表
func (this *ModelSociaty) list(uid string, filter pb.SociatyListFilter) (list []*pb.DBSociaty) {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(uid)
if err != nil {
return
}
if user == nil {
return
}
switch filter {
case pb.SociatyListFilter_ALL: //所有
if err := this.GetList(comm.RDS_SOCIATY, &list); err != nil {
log.Errorf("sociaty list err:%v", err)
return
}
case pb.SociatyListFilter_CONDI: //满足条件
//玩家等级大于等于公会的申请等级限制
if err := this.GetList(comm.RDS_SOCIATY, &list); err != nil {
log.Errorf("sociaty list err:%v", err)
return
}
var newList []*pb.DBSociaty
for _, v := range list {
if user.Lv >= v.ApplyLv {
newList = append(newList, v)
}
}
return newList
case pb.SociatyListFilter_NOAPPLY: //无需审批
filter := bson.M{
"isApplyCheck": false,
}
cur, err := this.DB.Find(comm.TableSociaty, filter)
for cur.Next(context.TODO()) {
sociaty := &pb.DBSociaty{}
if err = cur.Decode(sociaty); err == nil {
list = append(list, sociaty)
}
}
case pb.SociatyListFilter_APPLYING: //申请中
if err := this.GetList(comm.RDS_SOCIATY, &list); err != nil {
log.Errorf("sociaty list err:%v", err)
return
}
var newList []*pb.DBSociaty
for _, v := range list {
for _, apply := range v.ApplyRecord {
if apply.Uid == uid {
newList = append(newList, v)
}
}
}
return newList
}
return
}
// 搜索公会
func (this *ModelSociaty) findByName(name string) *pb.DBSociaty {
filter := bson.M{
"name": name,
}
sr := this.DB.FindOne(comm.TableSociaty, filter)
sociaty := &pb.DBSociaty{}
if err := sr.Decode(sociaty); err != nil {
if err != mongo.ErrNoDocuments {
return nil
}
}
return sociaty
}
// 获取公会
func (this *ModelSociaty) getSociaty(sociatyId string) (sociaty *pb.DBSociaty) {
sociaty = &pb.DBSociaty{}
if err := this.GetListObj(comm.RDS_SOCIATY, sociatyId, sociaty); err != nil {
this.moduleSociaty.Errorf("sociaty [%s] found err:%v", sociatyId, err)
return
}
return
}
// 获取玩家所在的公会
func (this *ModelSociaty) getUserSociaty(uid string) (sociaty *pb.DBSociaty) {
sociaty = &pb.DBSociaty{}
userEx, err := this.moduleSociaty.ModuleUser.GetRemoteUserExpand(uid)
if err != nil {
return
}
if userEx.SociatyId != "" {
return this.getSociaty(userEx.SociatyId)
}
return
}
// 申请公会
func (this *ModelSociaty) apply(uid string, sociaty *pb.DBSociaty) error {
// 判断公会审批设置
if sociaty.IsApplyCheck { //需要审核
sociaty.ApplyRecord = append(sociaty.ApplyRecord, &pb.ApplyRecord{
Uid: uid,
Ctime: time.Now().Unix(),
})
update := map[string]interface{}{
"applyRecord": sociaty.ApplyRecord,
}
return this.updateSociaty(sociaty.Id, update)
} else { //无需审核直接入会
if err := this.addMember(uid, sociaty); err != nil {
return err
}
//初始玩家公会任务
this.moduleSociaty.modelSociatyTask.initSociatyTask(uid, sociaty.Id)
}
return nil
}
// 设置公会
func (this *ModelSociaty) setting(sociaty *pb.DBSociaty) error {
update := map[string]interface{}{
"icon": sociaty.Icon,
"notice": sociaty.Notice,
"isApplyCheck": sociaty.IsApplyCheck,
"applyLv": sociaty.ApplyLv,
}
return this.updateSociaty(sociaty.Id, update)
}
// 申请撤销
func (this *ModelSociaty) applyCancel(uid, sociatyId string) error {
sociaty := this.getSociaty(sociatyId)
if sociaty.Id == "" {
return fmt.Errorf("sociatyId: %s 公会不存在", sociatyId)
}
return this.delFromApplyRecord(uid, sociaty)
}
// 是否已申请
func (this *ModelSociaty) isApplied(uid string, sociaty *pb.DBSociaty) bool {
for _, v := range sociaty.ApplyRecord {
if v.Uid == uid {
return true
}
}
return false
}
// 申请列表
func (this *ModelSociaty) applyList(sociaty *pb.DBSociaty) (list []*pb.SociatyMemberInfo) {
for _, r := range sociaty.ApplyRecord {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(r.Uid)
if err != nil || user.Uid == "" {
continue
}
list = append(list, &pb.SociatyMemberInfo{
Uid: user.Uid,
Name: user.Name,
Avatar: user.Avatar,
Lv: user.Lv,
})
}
return
}
// 是否公会成员
func (this *ModelSociaty) isMember(uid string, sociaty *pb.DBSociaty) bool {
for _, m := range sociaty.Members {
if m.Uid == uid {
return true
}
}
return false
}
func (this *ModelSociaty) isInJobs(job pb.SociatyJob, jobs ...pb.SociatyJob) bool {
for _, j := range jobs {
if j == job {
return true
}
}
return false
}
// 是否有执行权限
func (this *ModelSociaty) isRight(uid string, sociaty *pb.DBSociaty, jobs ...pb.SociatyJob) bool {
for _, m := range sociaty.Members {
if m.Uid == uid {
return this.isInJobs(m.Job, jobs...)
}
}
return false
}
// 更新公会
func (this *ModelSociaty) updateSociaty(sociatyId string, update map[string]interface{}) error {
return this.ChangeList(comm.RDS_SOCIATY, sociatyId, update)
}
// 退出公会
func (this *ModelSociaty) quit(uid string, sociaty *pb.DBSociaty) error {
for i, m := range sociaty.Members {
if m.Uid == uid {
sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...)
}
}
update := map[string]interface{}{
"members": sociaty.Members,
}
return this.updateSociaty(sociaty.Id, update)
}
// 解散公会
func (this *ModelSociaty) dismiss(sociaty *pb.DBSociaty) error {
err := this.DelListlds(comm.RDS_SOCIATY, sociaty.Id)
return err
}
//删除请求记录
func (this *ModelSociaty) delFromApplyRecord(uid string, sociaty *pb.DBSociaty) error {
for i, ar := range sociaty.ApplyRecord {
if ar.Uid == uid {
sociaty.ApplyRecord = append(sociaty.ApplyRecord[:i], sociaty.ApplyRecord[i+1:]...)
}
}
update := map[string]interface{}{
"applyRecord": sociaty.ApplyRecord,
}
return this.updateSociaty(sociaty.Id, update)
}
//添加成员
func (this *ModelSociaty) addMember(uid string, sociaty *pb.DBSociaty) error {
defer this.addLog(Log_Add, sociaty.Id, uid)
sociaty.Members = append(sociaty.Members, &pb.SociatyMember{
Uid: uid,
Job: pb.SociatyJob_MEMBER,
Ctime: time.Now().Unix(),
})
update := map[string]interface{}{
"members": sociaty.Members,
}
if err := this.updateSociaty(sociaty.Id, update); err != nil {
return err
}
// 更新玩家公会
updateEx := map[string]interface{}{
"sociatyId": sociaty.Id,
}
return this.moduleSociaty.ModuleUser.ChangeRemoteUserExpand(uid, updateEx)
}
// 成员列表
func (this *ModelSociaty) members(sociaty *pb.DBSociaty) (list []*pb.SociatyMemberInfo) {
for _, m := range sociaty.Members {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(m.Uid)
if err != nil || user.Uid == "" {
continue
}
list = append(list, &pb.SociatyMemberInfo{
Uid: user.Uid,
Name: user.Name,
Avatar: user.Avatar,
Lv: user.Lv,
Job: m.Job,
OfflineTime: user.Offlinetime,
})
}
return
}
// 同意
func (this *ModelSociaty) agree(uid string, sociaty *pb.DBSociaty) error {
if this.isMember(uid, sociaty) {
return fmt.Errorf("已是该公会成员 uid:%s sociatyId:%s", uid, sociaty.Id)
}
//删除申请记录
if err := this.delFromApplyRecord(uid, sociaty); err != nil {
return err
}
//添加成员
if err := this.addMember(uid, sociaty); err != nil {
return err
}
//初始玩家公会任务
return this.moduleSociaty.modelSociatyTask.initSociatyTask(uid, sociaty.Id)
}
//拒绝
func (this *ModelSociaty) refuse(uid string, sociaty *pb.DBSociaty) error {
if this.isMember(uid, sociaty) {
return fmt.Errorf("已是该公会成员 uid:%s sociatyId:%s", uid, sociaty.Id)
}
return this.delFromApplyRecord(uid, sociaty)
}
// 记录日志
// tag 日志模板 sociatyId公会ID params 占位参数
func (this *ModelSociaty) addLog(tag Tag, sociatyId string, params ...string) error {
var content string
//日志 template
switch tag {
case Log_Add:
content = string(Log_Add)
count := strings.Count(content, "%s")
if count != len(params) {
return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params))
}
for i := 0; i < len(params); i++ {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i])
if err == nil && user.Uid != "" {
content = strings.Replace(content, "%s", user.Name, 1)
}
}
case Log_Quit:
content = string(Log_Quit)
count := strings.Count(content, "%s")
if count != len(params) {
return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params))
}
for i := 0; i < len(params); i++ {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i])
if err == nil && user.Uid != "" {
content = strings.Replace(content, "%s", user.Name, 1)
}
}
case Log_Job:
content = string(Log_Job)
count := strings.Count(content, "%s")
if count != len(params) {
return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params))
}
for i := 0; i < len(params); i++ {
if i == 2 {
var job string
switch params[i] {
case pb.SociatyJob_PRESIDENT.String():
job = "会长"
case pb.SociatyJob_VICEPRESIDENT.String():
job = "副会长"
case pb.SociatyJob_ADMIN.String():
job = "管理员"
case pb.SociatyJob_MEMBER.String():
job = "成员"
}
content = strings.Replace(content, "%s", job, 1)
} else {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i])
if err == nil && user.Uid != "" {
content = strings.Replace(content, "%s", user.Name, 1)
}
}
}
case Log_Discharge:
content = string(Log_Job)
count := strings.Count(content, "%s")
if count != len(params) {
return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params))
}
for i := 0; i < len(params); i++ {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(params[i])
if err == nil && user.Uid != "" {
content = strings.Replace(content, "%s", params[i], 1)
}
}
case Log_Upgrade:
content = string(Log_Job)
count := strings.Count(content, "%s")
if count != len(params) {
return fmt.Errorf("参数和模板参数不匹配 期望:%d 实际%d", count, len(params))
}
for i := 0; i < len(params); i++ {
content = strings.Replace(content, "%s", params[i], 1)
}
}
if content != "" {
update := map[string]interface{}{
"content": content,
"ctime": time.Now().Unix(),
}
return this.updateSociaty(sociatyId, update)
}
return nil
}
// 查询日志
func (this *ModelSociaty) logList(sociaty *pb.DBSociaty) (slist []*pb.SociatyLog) {
for _, l := range sociaty.Logs {
slist = append(slist, &pb.SociatyLog{
Content: l.Content,
Ctime: l.Ctime,
})
}
sort.SliceStable(slist, func(i, j int) bool {
return slist[i].Ctime > slist[j].Ctime
})
return
}
// 转让公会
// targetId 目标玩家ID
// srcId 玩家ID 会长
func (this *ModelSociaty) assign(srcId, targetId string, sociaty *pb.DBSociaty) error {
if !this.isMember(targetId, sociaty) {
return fmt.Errorf("不是该公会成员 uid:%s sociatyId:%s", targetId, sociaty.Id)
}
for _, m := range sociaty.Members {
if m.Uid == srcId {
m.Uid = targetId
}
if m.Uid == targetId {
m.Uid = srcId
}
}
update := map[string]interface{}{
"members": sociaty.Members,
}
return this.updateSociaty(sociaty.Id, update)
}
// 踢出公会
// targetId 踢出目标
// 不允许踢出会长
func (this *ModelSociaty) discharge(targetId string, sociaty *pb.DBSociaty) error {
for i, m := range sociaty.Members {
if m.Uid == targetId {
if m.Job == pb.SociatyJob_PRESIDENT {
return fmt.Errorf("会长 %s 不可以被踢出", targetId)
}
sociaty.Members = append(sociaty.Members[:i], sociaty.Members[i+1:]...)
}
}
update := map[string]interface{}{
"members": sociaty.Members,
}
return this.updateSociaty(sociaty.Id, update)
}
//获取职位数
func (this *ModelSociaty) getJobCount(job pb.SociatyJob, sociaty *pb.DBSociaty) (count int) {
for _, m := range sociaty.Members {
if m.Job == job {
count++
}
}
return
}
// 设置职位
func (this *ModelSociaty) settingJob(targetId string, job pb.SociatyJob, sociaty *pb.DBSociaty) error {
for _, m := range sociaty.Members {
if m.Uid == targetId {
m.Job = job
}
}
update := map[string]interface{}{
"members": sociaty.Members,
}
return this.updateSociaty(sociaty.Id, update)
}
// 获取会长信息
func (this *ModelSociaty) getMasterInfo(sociaty *pb.DBSociaty) *pb.SociatyMemberInfo {
for _, m := range sociaty.Members {
if m.Job == pb.SociatyJob_PRESIDENT {
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(m.Uid)
if err != nil || user.Uid == "" {
continue
}
return &pb.SociatyMemberInfo{
Uid: user.Uid,
Name: user.Name,
Lv: user.Lv,
Avatar: user.Avatar,
OfflineTime: user.Offlinetime,
}
}
}
return nil
}
// 弹劾会长
func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error {
master := this.getMasterInfo(sociaty)
if master == nil {
return errors.New("会长不存在")
}
user, err := this.moduleSociaty.ModuleUser.GetRemoteUser(master.Uid)
if err != nil {
return err
}
//会长离线时间
now := time.Now().Unix()
left := now - user.Offlinetime
if left < 7*3600 || user.Offlinetime == 0 {
return errors.New("会长很称职,无需弹劾")
}
return nil
}
// 签到
func (this *ModelSociaty) sign(uid string, sociaty *pb.DBSociaty) error {
if !this.isMember(uid, sociaty) {
return fmt.Errorf("不是该公会成员 uid:%s sociatyId:%s", uid, sociaty.Id)
}
sociaty.SignIds = append(sociaty.SignIds, uid)
update := map[string]interface{}{
"signIds": sociaty.SignIds,
}
return this.updateSociaty(sociaty.Id, update)
}
// 是否已签到
func (this *ModelSociaty) IsSign(uid string, sociaty *pb.DBSociaty) bool {
if _, ok := utils.Findx(sociaty.SignIds, uid); ok {
return ok
}
return false
}
// 获取玩家任务列表
func (this *ModelSociaty) getUserTaskList(uid, sociatyId string) (sociatyTask *pb.DBSociatyTask) {
sociatyTask = &pb.DBSociatyTask{}
this.moduleSociaty.modelSociatyTask.GetListObj(sociatyId, uid, sociatyTask)
return
}
// 更新公会资源 活跃度、经验
func (this *ModelSociaty) updateResourceFromTask(sociaty *pb.DBSociaty, conf *cfg.GameGuildTaskData) error {
if conf == nil {
return errors.New("配置未找到")
}
exp := sociaty.Exp //经验
activity := sociaty.Activity //活跃度
for _, v := range conf.SociatyReward {
if v.T == "guildactive" {
activity += v.N
} else if v.T == "guildexp" {
exp += v.N
}
}
update := map[string]interface{}{
"exp": exp,
"activity": activity,
}
return this.updateSociaty(sociaty.Id, update)
}
// 更新经验
func (this *ModelSociaty) updateSociatyExp(val int32, sociaty *pb.DBSociaty) error {
exp := sociaty.Exp //经验
exp += val
update := map[string]interface{}{
"exp": exp,
}
return this.updateSociaty(sociaty.Id, update)
}
// 更新成员贡献值
// 任务领取时更新
func (this *ModelSociaty) updateMemberContribution(uid string, val int32, sociaty *pb.DBSociaty) error {
for _, m := range sociaty.Members {
if m.Uid == uid {
m.Contribution += val
}
}
update := map[string]interface{}{
"members": sociaty.Members,
}
return this.updateSociaty(sociaty.Id, update)
}
func (this *ModelSociaty) sort(list []*pb.DBSociatyRank) []*pb.DBSociatyRank {
sort.SliceStable(list, func(i, j int) bool {
if list[i].Lv == list[j].Lv {
if list[i].Activity == list[j].Activity {
return list[i].Ctime > list[j].Ctime
} else {
return list[i].Activity < list[j].Activity
}
}
return list[i].Lv < list[j].Lv
})
return list
}
// 公会等级变化
// 更新排行榜
func (this *ModelSociaty) rankDataChanged(event interface{}, next func(event interface{})) {
var list []*pb.DBSociatyRank
if err := this.GetList(comm.RDS_SOCIATYRANK, &list); err != nil {
log.Errorf("sociaty list err:%v", err)
return
}
data := event.(*SociatyListen)
newRank := &pb.DBSociatyRank{
SociatyId: data.sociatyId,
Name: data.name,
Lv: data.lv,
Activity: data.activity,
Ctime: data.ctime,
}
if len(list) == 0 || len(list) > 0 && len(list) < 20 {
if data != nil {
this.AddList(comm.RDS_SOCIATYRANK, data.sociatyId, newRank)
}
} else {
this.AddList(comm.RDS_SOCIATYRANK, data.sociatyId, newRank)
if err := this.GetList(comm.RDS_SOCIATYRANK, &list); err != nil {
log.Errorf("sociaty list err:%v", err)
return
}
// 排名
tmp := this.sort(list)
//找出20条之后的数据
lastData := append(tmp[:19], tmp[len(tmp)-1:]...)
//删除20之后的数据
delIds := []string{}
for _, v := range lastData {
delIds = append(delIds, v.SociatyId)
}
this.DelListlds(comm.RDS_SOCIATYRANK, delIds...)
}
}
// 排行榜
func (this *ModelSociaty) rank() (rank []*pb.DBSociatyRank) {
var list []*pb.DBSociaty
if err := this.GetList(comm.RDS_SOCIATYRANK, &list); err != nil {
log.Errorf("sociaty list err:%v", err)
return nil
}
for _, v := range list {
rank = append(rank, &pb.DBSociatyRank{
Name: v.Name,
Lv: v.Lv,
Activity: v.Activity,
Ctime: v.Ctime,
})
}
rank = this.sort(rank)
rank = append(rank[:0], rank[19:]...)
return
}
func (this *ModelSociaty) isInCDHour(userCdTime int64) bool {
if userCdTime == 0 {
return false
}
return time.Now().Unix() < userCdTime
}

View File

@ -0,0 +1,89 @@
package sociaty
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
)
type ModelSociatyTask struct {
modules.MCompModel
moduleSociaty *Sociaty
service core.IService
}
func (this *ModelSociatyTask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableSociaty
err = this.MCompModel.Init(service, module, comp, options)
this.moduleSociaty = module.(*Sociaty)
this.service = service
return
}
// 初始化公会任务 加入成员时初始化
func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
ggt, err := this.moduleSociaty.configure.getSociatyTaskCfg()
if err != nil || ggt == nil {
return errors.New("SociatyTaskCfg not found")
}
sociatyTask := &pb.DBSociatyTask{
SociatyId: sociatyId,
Uid: uid,
}
var taskList []*pb.SociatyTask
list := ggt.GetDataList()
// 大于4条配置
if len(list) > 4 {
//随机4条任务
randInts := utils.Numbers(0, len(list)-1, 4)
for _, v := range randInts {
taskList = append(taskList, &pb.SociatyTask{
TaskId: list[v].Id,
})
}
} else {
for _, v := range list {
taskList = append(taskList, &pb.SociatyTask{
TaskId: v.Id,
})
}
}
sociatyTask.List = taskList
return this.moduleSociaty.modelSociatyTask.AddList(sociatyId, uid, sociatyTask)
}
//任务列表
func (this *ModelSociatyTask) taskList(uid, sociatyId string) (task *pb.DBSociatyTask) {
task = &pb.DBSociatyTask{}
this.GetListObj(sociatyId, uid, task)
return
}
// 删除公会任务
func (this *ModelSociatyTask) deleTask(sociatyId, uid string) error {
return this.DelListlds(sociatyId, uid)
}
// 奖励领取
func (this *ModelSociatyTask) receive(taskId int32, sociatyId, uid string) error {
sociatyTask := &pb.DBSociatyTask{}
this.GetListObj(sociatyId, uid, sociatyTask)
for _, t := range sociatyTask.List {
if t.TaskId == taskId {
t.Status = 1 //领取
}
}
update := map[string]interface{}{
"list": sociatyTask.List,
}
return this.ChangeList(sociatyId, uid, update)
}
// 活跃度领取
func (this *ModelSociatyTask) activityReceive() error {
return nil
}

80
modules/sociaty/module.go Normal file
View File

@ -0,0 +1,80 @@
package sociaty
import (
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"time"
)
var _ comm.ISociaty = (*Sociaty)(nil)
type Sociaty struct {
modules.ModuleBase
api *apiComp
service base.IRPCXService
modelSociaty *ModelSociaty
modelSociatyTask *ModelSociatyTask
configure *configureComp
}
func NewModule() core.IModule {
return &Sociaty{}
}
func (this *Sociaty) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
err = this.ModuleBase.Init(service, module, options)
return
}
func (this *Sociaty) GetType() core.M_Modules {
return comm.ModuleSociaty
}
func (this *Sociaty) OnInstallComp() {
this.ModuleBase.OnInstallComp()
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelSociaty = this.RegisterComp(new(ModelSociaty)).(*ModelSociaty)
this.modelSociatyTask = this.RegisterComp(new(ModelSociatyTask)).(*ModelSociatyTask)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (this *Sociaty) Start() (err error) {
err = this.ModuleBase.Start()
return
}
// 会长弹劾处理
func (this *Sociaty) ProcessAccuse(uid, sociatyId string) {
ggd := this.configure.GetGlobalConf()
t := ggd.GuildImpeachmentCountDown
if t == 0 {
return
}
sociaty := this.modelSociaty.getSociaty(sociatyId)
if sociaty != nil {
if sociaty.AccuseTime > 0 {
now := time.Now().Unix()
if now-sociaty.AccuseTime >= int64(3600*t) {
//TODO 选新会长
} else {
//结束弹劾
update := map[string]interface{}{
"accuseTime": 0,
}
if err := this.modelSociaty.updateSociaty(sociatyId, update); err != nil {
this.Errorf("弹劾时间更新失败 %v", err)
}
}
}
}
}
// 公会成员
func (this *Sociaty) Members(uid string) (list []*pb.SociatyMemberInfo) {
sociaty := this.modelSociaty.getUserSociaty(uid)
return this.modelSociaty.members(sociaty)
}

View File

@ -30,6 +30,7 @@ type Timer struct {
season *SeasonPagoda
forum *ForumComp
arena *ArenaComp
sociaty *SociatyTimer
}
//模块名
@ -64,6 +65,7 @@ func (this *Timer) OnInstallComp() {
this.chat = this.RegisterComp(new(ChatComp)).(*ChatComp)
this.season = this.RegisterComp(new(SeasonPagoda)).(*SeasonPagoda)
this.arena = this.RegisterComp(new(ArenaComp)).(*ArenaComp)
this.sociaty = this.RegisterComp(new(SociatyTimer)).(*SociatyTimer)
}
//日志

47
modules/timer/sociaty.go Normal file
View File

@ -0,0 +1,47 @@
package timer
import (
"context"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/cron"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go.mongodb.org/mongo-driver/bson"
)
type SociatyTimer struct {
modules.MCompModel
service core.IService
}
//组件初始化接口
func (this *SociatyTimer) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableSociaty
this.MCompModel.Init(service, module, comp, options)
this.service = service
return
}
func (this *SociatyTimer) Start() (err error) {
err = this.MCompModel.Start()
cron.AddFunc("0 0 12 * * ?", this.updateSign)
return
}
// updateSign
func (this *SociatyTimer) updateSign() {
cur, err := this.DB.Find(core.SqlTable(this.TableName), bson.M{})
if err != nil {
return
}
for cur.Next(context.TODO()) {
sociaty := &pb.DBSociaty{}
if err = cur.Decode(sociaty); err == nil {
sociaty.LastSignCount = int32(len(sociaty.SignIds))
sociaty.SignIds = make([]string, 0)
_, err = this.DB.UpdateOne(core.SqlTable(this.TableName), bson.M{}, sociaty)
}
}
}

View File

@ -96,7 +96,7 @@ func (this *User) GetCrossUser(uid string) (*pb.DBUser, error) {
}
// 获取远程用户数据sss
func (this *User) GetRmoteUser(uid string) (*pb.DBUser, error) {
func (this *User) GetRemoteUser(uid string) (*pb.DBUser, error) {
reply := &pb.DBUser{}
if err := this.getUserFromRemoteDb(uid, reply); err != nil {
return nil, err
@ -104,6 +104,20 @@ func (this *User) GetRmoteUser(uid string) (*pb.DBUser, error) {
return reply, nil
}
// 获取远程用户expand
func (this *User) GetRemoteUserExpand(uid string) (result *pb.DBUserExpand, err error) {
reply := &pb.DBUserExpand{}
if err := this.getUserExpandFromRemoteDb(uid, reply); err != nil {
return nil, err
}
return reply, nil
}
// 更新远程用户expand
func (this *User) ChangeRemoteUserExpand(uid string, value map[string]interface{}) error {
return this.changeUserExpandFromRemoteDb(uid, value)
}
//获取用户会话
func (this *User) GetUserSession(uid string) *pb.CacheUser {
return this.modelSession.getUserSession(uid)
@ -188,7 +202,7 @@ func (this *User) QueryAttributeValue(uid string, attr string) (value int64) {
err error
)
if this.IsCross() {
user, err = this.GetRmoteUser(uid)
user, err = this.GetRemoteUser(uid)
if err != nil {
return
}
@ -225,13 +239,13 @@ func (this *User) change(session comm.IUserSession, attr string, add int32) (cha
err error
)
if this.IsCross() {
user, err = this.GetRmoteUser(uid)
user, err = this.GetRemoteUser(uid)
if err != nil {
code = pb.ErrorCode_UserSessionNobeing
return
}
userEx, err = this.GetUserExpand(uid)
userEx, err = this.GetRemoteUserExpand(uid)
if err != nil {
code = pb.ErrorCode_UserExpandNull
return
@ -400,12 +414,46 @@ func (this *User) getUserFromRemoteDb(uid string, rsp *pb.DBUser) error {
return nil
}
func (this *User) getUserExpandFromRemoteDb(uid string, rsp *pb.DBUserExpand) error {
sid, _, ok := utils.UIdSplit(uid)
if !ok {
return errors.New("sid split error")
}
conn, err := db.ServerDBConn(sid)
if err != nil {
return err
}
model := db.NewDBModel(comm.TableUserExpand, 0, conn)
if err := model.Get(uid, rsp); err != nil {
return err
}
return nil
}
func (this *User) changeUserExpandFromRemoteDb(uid string, data map[string]interface{}) error {
sid, _, ok := utils.UIdSplit(uid)
if !ok {
return errors.New("sid split error")
}
conn, err := db.ServerDBConn(sid)
if err != nil {
return err
}
model := db.NewDBModel(comm.TableUserExpand, 0, conn)
if err := model.Change(uid, data); err != nil {
return err
}
return nil
}
func (this *User) queryUserFromRemoteDb(name string, reply *pb.UserDataListResp) error {
// 区服列表
for _, tag := range db.GetServerTags() {
conn, err := db.ServerDBConn(tag)
if err != nil {
return err
return fmt.Errorf("db tag:%v err:%v", tag, err)
}
//查询用户

View File

@ -223,6 +223,9 @@ const (
ErrorCode_SociatyRewardReceive ErrorCode = 30022 //奖励领取失败
ErrorCode_SociatyResource ErrorCode = 30023 //更新公会资源失败
ErrorCode_SociatyApplyCanel ErrorCode = 30024 //申请撤销失败
ErrorCode_SociatyBelongTo ErrorCode = 30025 //已是公会成员
ErrorCode_SociatyApplied ErrorCode = 30026 //已申请
ErrorCode_SociatyAppyLvNoEnough ErrorCode = 30027 //申请等级不满足
// arena
ErrorCode_ArenaTicketBuyUp ErrorCode = 3101 //票据上限
ErrorCode_ArenaTicketNotEnough ErrorCode = 3102 //票据不足
@ -423,6 +426,9 @@ var (
30022: "SociatyRewardReceive",
30023: "SociatyResource",
30024: "SociatyApplyCanel",
30025: "SociatyBelongTo",
30026: "SociatyApplied",
30027: "SociatyAppyLvNoEnough",
3101: "ArenaTicketBuyUp",
3102: "ArenaTicketNotEnough",
3103: "ArenaTicketNpcInCd",
@ -617,6 +623,9 @@ var (
"SociatyRewardReceive": 30022,
"SociatyResource": 30023,
"SociatyApplyCanel": 30024,
"SociatyBelongTo": 30025,
"SociatyApplied": 30026,
"SociatyAppyLvNoEnough": 30027,
"ArenaTicketBuyUp": 3101,
"ArenaTicketNotEnough": 3102,
"ArenaTicketNpcInCd": 3103,
@ -662,7 +671,7 @@ var File_errorcode_proto protoreflect.FileDescriptor
var file_errorcode_proto_rawDesc = []byte{
0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x2a, 0xcc, 0x21, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x6f, 0x2a, 0x96, 0x22, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12,
0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d,
0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12,
0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
@ -915,23 +924,28 @@ var file_errorcode_proto_rawDesc = []byte{
0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x52, 0x65, 0x73,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x10, 0xc7, 0xea, 0x01, 0x12, 0x17, 0x0a, 0x11, 0x53, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43, 0x61, 0x6e, 0x65, 0x6c, 0x10, 0xc8,
0xea, 0x01, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65,
0x74, 0x42, 0x75, 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x72, 0x65,
0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67,
0x68, 0x10, 0x9e, 0x18, 0x12, 0x17, 0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63,
0x6b, 0x65, 0x74, 0x4e, 0x70, 0x63, 0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12, 0x16, 0x0a,
0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, 0x61,
0x72, 0x6e, 0x10, 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x45,
0x72, 0x72, 0x44, 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c,
0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72,
0x65, 0x10, 0x83, 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65,
0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a, 0x0b, 0x54,
0x72, 0x6f, 0x6c, 0x6c, 0x42, 0x75, 0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12, 0x11, 0x0a,
0x0c, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10, 0xe6, 0x19,
0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x6c, 0x6c,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c,
0x6c, 0x4d, 0x61, 0x78, 0x49, 0x74, 0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe8, 0x19,
0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0xea, 0x01, 0x12, 0x15, 0x0a, 0x0f, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x42, 0x65, 0x6c,
0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x10, 0xc9, 0xea, 0x01, 0x12, 0x14, 0x0a, 0x0e, 0x53, 0x6f, 0x63,
0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x10, 0xca, 0xea, 0x01, 0x12,
0x1b, 0x0a, 0x15, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x79, 0x4c, 0x76,
0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xcb, 0xea, 0x01, 0x12, 0x15, 0x0a, 0x10,
0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70,
0x10, 0x9d, 0x18, 0x12, 0x19, 0x0a, 0x14, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b,
0x65, 0x74, 0x4e, 0x6f, 0x74, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0x9e, 0x18, 0x12, 0x17,
0x0a, 0x12, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x4e, 0x70, 0x63,
0x49, 0x6e, 0x43, 0x64, 0x10, 0x9f, 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e,
0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x10, 0x81, 0x19, 0x12,
0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x45, 0x72, 0x72, 0x44, 0x61, 0x74, 0x61,
0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c,
0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10, 0x83, 0x19, 0x12, 0x15,
0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61,
0x74, 0x65, 0x10, 0x84, 0x19, 0x12, 0x10, 0x0a, 0x0b, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x42, 0x75,
0x79, 0x4d, 0x61, 0x78, 0x10, 0xe5, 0x19, 0x12, 0x11, 0x0a, 0x0c, 0x54, 0x72, 0x6f, 0x6c, 0x6c,
0x53, 0x65, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x10, 0xe6, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72,
0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x53, 0x65, 0x6c, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10,
0xe7, 0x19, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x72, 0x6f, 0x6c, 0x6c, 0x4d, 0x61, 0x78, 0x49, 0x74,
0x65, 0x6d, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x10, 0xe8, 0x19, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (

861
pb/sociaty_db.pb.go Normal file
View File

@ -0,0 +1,861 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.0
// protoc v3.20.0
// source: sociaty/sociaty_db.proto
package pb
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
//职位
type SociatyJob int32
const (
SociatyJob_NOJOB SociatyJob = 0 //无职位/权限
SociatyJob_MEMBER SociatyJob = 1 //成员
SociatyJob_ADMIN SociatyJob = 2 //管理员
SociatyJob_VICEPRESIDENT SociatyJob = 3 //副会长
SociatyJob_PRESIDENT SociatyJob = 4 //会长
)
// Enum value maps for SociatyJob.
var (
SociatyJob_name = map[int32]string{
0: "NOJOB",
1: "MEMBER",
2: "ADMIN",
3: "VICEPRESIDENT",
4: "PRESIDENT",
}
SociatyJob_value = map[string]int32{
"NOJOB": 0,
"MEMBER": 1,
"ADMIN": 2,
"VICEPRESIDENT": 3,
"PRESIDENT": 4,
}
)
func (x SociatyJob) Enum() *SociatyJob {
p := new(SociatyJob)
*p = x
return p
}
func (x SociatyJob) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (SociatyJob) Descriptor() protoreflect.EnumDescriptor {
return file_sociaty_sociaty_db_proto_enumTypes[0].Descriptor()
}
func (SociatyJob) Type() protoreflect.EnumType {
return &file_sociaty_sociaty_db_proto_enumTypes[0]
}
func (x SociatyJob) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use SociatyJob.Descriptor instead.
func (SociatyJob) EnumDescriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{0}
}
type DBSociaty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
Creater string `protobuf:"bytes,2,opt,name=creater,proto3" json:"creater" bson:"creater"` //创建人
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name" bson:"name"` //公会名称
Icon string `protobuf:"bytes,4,opt,name=icon,proto3" json:"icon" bson:"icon"` //公会图标
Notice string `protobuf:"bytes,5,opt,name=notice,proto3" json:"notice" bson:"notice"` //公告
Exp int32 `protobuf:"varint,6,opt,name=exp,proto3" json:"exp" bson:"exp"` //经验
Lv int32 `protobuf:"varint,7,opt,name=lv,proto3" json:"lv" bson:"lv"` //等级
IsApplyCheck bool `protobuf:"varint,8,opt,name=isApplyCheck,proto3" json:"isApplyCheck" bson:"isApplyCheck"` //是否必须审批
ApplyLv int32 `protobuf:"varint,9,opt,name=applyLv,proto3" json:"applyLv" bson:"applyLv"` // 等级限制
Ctime int64 `protobuf:"varint,10,opt,name=ctime,proto3" json:"ctime" bson:"ctime"` //创建时间
ApplyRecord []*ApplyRecord `protobuf:"bytes,11,rep,name=applyRecord,proto3" json:"applyRecord" bson:"applyRecord"` //收到的玩家入会申请
Members []*SociatyMember `protobuf:"bytes,12,rep,name=members,proto3" json:"members"` //@go_tags(`bson:"members"` 公会成员
Activity int32 `protobuf:"varint,13,opt,name=activity,proto3" json:"activity" bson:"activity"` //活跃度
Logs []*SociatyLog `protobuf:"bytes,14,rep,name=logs,proto3" json:"logs" bson:"logs"` //日志
AccuseTime int64 `protobuf:"varint,15,opt,name=accuseTime,proto3" json:"accuseTime" bson:"accuseTime"` //会长弹劾时间
LastSignCount int32 `protobuf:"varint,16,opt,name=lastSignCount,proto3" json:"lastSignCount" bson:"lastSignCount"` //昨日签到的人数
SignIds []string `protobuf:"bytes,17,rep,name=signIds,proto3" json:"signIds" bson:"signIds"` // 今日签到的玩家IDs
}
func (x *DBSociaty) Reset() {
*x = DBSociaty{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBSociaty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBSociaty) ProtoMessage() {}
func (x *DBSociaty) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[0]
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 DBSociaty.ProtoReflect.Descriptor instead.
func (*DBSociaty) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{0}
}
func (x *DBSociaty) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *DBSociaty) GetCreater() string {
if x != nil {
return x.Creater
}
return ""
}
func (x *DBSociaty) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DBSociaty) GetIcon() string {
if x != nil {
return x.Icon
}
return ""
}
func (x *DBSociaty) GetNotice() string {
if x != nil {
return x.Notice
}
return ""
}
func (x *DBSociaty) GetExp() int32 {
if x != nil {
return x.Exp
}
return 0
}
func (x *DBSociaty) GetLv() int32 {
if x != nil {
return x.Lv
}
return 0
}
func (x *DBSociaty) GetIsApplyCheck() bool {
if x != nil {
return x.IsApplyCheck
}
return false
}
func (x *DBSociaty) GetApplyLv() int32 {
if x != nil {
return x.ApplyLv
}
return 0
}
func (x *DBSociaty) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
func (x *DBSociaty) GetApplyRecord() []*ApplyRecord {
if x != nil {
return x.ApplyRecord
}
return nil
}
func (x *DBSociaty) GetMembers() []*SociatyMember {
if x != nil {
return x.Members
}
return nil
}
func (x *DBSociaty) GetActivity() int32 {
if x != nil {
return x.Activity
}
return 0
}
func (x *DBSociaty) GetLogs() []*SociatyLog {
if x != nil {
return x.Logs
}
return nil
}
func (x *DBSociaty) GetAccuseTime() int64 {
if x != nil {
return x.AccuseTime
}
return 0
}
func (x *DBSociaty) GetLastSignCount() int32 {
if x != nil {
return x.LastSignCount
}
return 0
}
func (x *DBSociaty) GetSignIds() []string {
if x != nil {
return x.SignIds
}
return nil
}
//申请记录
type ApplyRecord struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` // 申请的玩家ID
Ctime int64 `protobuf:"varint,2,opt,name=ctime,proto3" json:"ctime" bson:"ctime"` // 申请时间
}
func (x *ApplyRecord) Reset() {
*x = ApplyRecord{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ApplyRecord) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ApplyRecord) ProtoMessage() {}
func (x *ApplyRecord) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[1]
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 ApplyRecord.ProtoReflect.Descriptor instead.
func (*ApplyRecord) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{1}
}
func (x *ApplyRecord) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *ApplyRecord) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
// 公会成员
type SociatyMember struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid" bson:"uid"` //成员ID
Job SociatyJob `protobuf:"varint,2,opt,name=job,proto3,enum=SociatyJob" json:"job" bson:"job"` //职位
Ctime int64 `protobuf:"varint,3,opt,name=ctime,proto3" json:"ctime" bson:"ctime"` //入会时间
Contribution int32 `protobuf:"varint,4,opt,name=contribution,proto3" json:"contribution" bson:"contribution"` //贡献值
}
func (x *SociatyMember) Reset() {
*x = SociatyMember{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SociatyMember) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SociatyMember) ProtoMessage() {}
func (x *SociatyMember) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[2]
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 SociatyMember.ProtoReflect.Descriptor instead.
func (*SociatyMember) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{2}
}
func (x *SociatyMember) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *SociatyMember) GetJob() SociatyJob {
if x != nil {
return x.Job
}
return SociatyJob_NOJOB
}
func (x *SociatyMember) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
func (x *SociatyMember) GetContribution() int32 {
if x != nil {
return x.Contribution
}
return 0
}
// 日志
type SociatyLog struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content" bson:"content"` // 日志内容
Ctime int64 `protobuf:"varint,2,opt,name=ctime,proto3" json:"ctime" bson:"ctime"` //创建时间
}
func (x *SociatyLog) Reset() {
*x = SociatyLog{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SociatyLog) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SociatyLog) ProtoMessage() {}
func (x *SociatyLog) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[3]
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 SociatyLog.ProtoReflect.Descriptor instead.
func (*SociatyLog) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{3}
}
func (x *SociatyLog) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *SociatyLog) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
// 公会成员任务
type DBSociatyTask struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId"` //@go_tags(`bson:"sociatyId") 公会ID
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
List []*SociatyTask `protobuf:"bytes,3,rep,name=list,proto3" json:"list" bson:"list"` //任务列表
}
func (x *DBSociatyTask) Reset() {
*x = DBSociatyTask{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBSociatyTask) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBSociatyTask) ProtoMessage() {}
func (x *DBSociatyTask) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[4]
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 DBSociatyTask.ProtoReflect.Descriptor instead.
func (*DBSociatyTask) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{4}
}
func (x *DBSociatyTask) GetSociatyId() string {
if x != nil {
return x.SociatyId
}
return ""
}
func (x *DBSociatyTask) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *DBSociatyTask) GetList() []*SociatyTask {
if x != nil {
return x.List
}
return nil
}
type SociatyTask struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TaskId int32 `protobuf:"varint,1,opt,name=taskId,proto3" json:"taskId" bson:"taskId"` //任务ID
Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status" bson:"status"` //领取状态:0未领取 1已领取
}
func (x *SociatyTask) Reset() {
*x = SociatyTask{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SociatyTask) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SociatyTask) ProtoMessage() {}
func (x *SociatyTask) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[5]
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 SociatyTask.ProtoReflect.Descriptor instead.
func (*SociatyTask) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{5}
}
func (x *SociatyTask) GetTaskId() int32 {
if x != nil {
return x.TaskId
}
return 0
}
func (x *SociatyTask) GetStatus() int32 {
if x != nil {
return x.Status
}
return 0
}
//排行榜
type DBSociatyRank struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
SociatyId string `protobuf:"bytes,1,opt,name=sociatyId,proto3" json:"sociatyId" bson:"sociatyId"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name" bson:"name"` //公会名称
Lv int32 `protobuf:"varint,3,opt,name=lv,proto3" json:"lv" bson:"lv"` //等级
Activity int32 `protobuf:"varint,4,opt,name=activity,proto3" json:"activity" bson:"activity"` //活跃度
Ctime int64 `protobuf:"varint,5,opt,name=ctime,proto3" json:"ctime" bson:"ctime"` //公会创建时间
}
func (x *DBSociatyRank) Reset() {
*x = DBSociatyRank{}
if protoimpl.UnsafeEnabled {
mi := &file_sociaty_sociaty_db_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DBSociatyRank) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DBSociatyRank) ProtoMessage() {}
func (x *DBSociatyRank) ProtoReflect() protoreflect.Message {
mi := &file_sociaty_sociaty_db_proto_msgTypes[6]
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 DBSociatyRank.ProtoReflect.Descriptor instead.
func (*DBSociatyRank) Descriptor() ([]byte, []int) {
return file_sociaty_sociaty_db_proto_rawDescGZIP(), []int{6}
}
func (x *DBSociatyRank) GetSociatyId() string {
if x != nil {
return x.SociatyId
}
return ""
}
func (x *DBSociatyRank) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *DBSociatyRank) GetLv() int32 {
if x != nil {
return x.Lv
}
return 0
}
func (x *DBSociatyRank) GetActivity() int32 {
if x != nil {
return x.Activity
}
return 0
}
func (x *DBSociatyRank) GetCtime() int64 {
if x != nil {
return x.Ctime
}
return 0
}
var File_sociaty_sociaty_db_proto protoreflect.FileDescriptor
var file_sociaty_sociaty_db_proto_rawDesc = []byte{
0x0a, 0x18, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x2f, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74,
0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe2, 0x03, 0x0a, 0x09, 0x44,
0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x72, 0x65, 0x61,
0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x72, 0x65, 0x61, 0x74,
0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x6f,
0x74, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69,
0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x78, 0x70, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
0x03, 0x65, 0x78, 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
0x52, 0x02, 0x6c, 0x76, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x73, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x43,
0x68, 0x65, 0x63, 0x6b, 0x18, 0x08, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x69, 0x73, 0x41, 0x70,
0x70, 0x6c, 0x79, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x6c,
0x79, 0x4c, 0x76, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x61, 0x70, 0x70, 0x6c, 0x79,
0x4c, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x2e, 0x0a, 0x0b, 0x61, 0x70, 0x70, 0x6c,
0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e,
0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x0b, 0x61, 0x70, 0x70,
0x6c, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x28, 0x0a, 0x07, 0x6d, 0x65, 0x6d, 0x62,
0x65, 0x72, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x07, 0x6d, 0x65, 0x6d, 0x62, 0x65,
0x72, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x18, 0x0d,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x1f,
0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x0e, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x53,
0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12,
0x1e, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0f, 0x20,
0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x63, 0x63, 0x75, 0x73, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x24, 0x0a, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x69, 0x67, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74,
0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x6c, 0x61, 0x73, 0x74, 0x53, 0x69, 0x67, 0x6e,
0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x49, 0x64, 0x73,
0x18, 0x11, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x49, 0x64, 0x73, 0x22,
0x35, 0x0a, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x10,
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x7a, 0x0a, 0x0d, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74,
0x79, 0x4d, 0x65, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01,
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1d, 0x0a, 0x03, 0x6a, 0x6f, 0x62,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0b, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x4a, 0x6f, 0x62, 0x52, 0x03, 0x6a, 0x6f, 0x62, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d,
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x22,
0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x04,
0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x69,
0x6f, 0x6e, 0x22, 0x3c, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4c, 0x6f, 0x67,
0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65,
0x22, 0x61, 0x0a, 0x0d, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73,
0x6b, 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, 0x12,
0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69,
0x64, 0x12, 0x20, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0c, 0x2e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x04, 0x6c,
0x69, 0x73, 0x74, 0x22, 0x3d, 0x0a, 0x0b, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x54, 0x61,
0x73, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74,
0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x22, 0x83, 0x01, 0x0a, 0x0d, 0x44, 0x42, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79,
0x52, 0x61, 0x6e, 0x6b, 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, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01,
0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69,
0x74, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x69,
0x74, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28,
0x03, 0x52, 0x05, 0x63, 0x74, 0x69, 0x6d, 0x65, 0x2a, 0x50, 0x0a, 0x0a, 0x53, 0x6f, 0x63, 0x69,
0x61, 0x74, 0x79, 0x4a, 0x6f, 0x62, 0x12, 0x09, 0x0a, 0x05, 0x4e, 0x4f, 0x4a, 0x4f, 0x42, 0x10,
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4d, 0x45, 0x4d, 0x42, 0x45, 0x52, 0x10, 0x01, 0x12, 0x09, 0x0a,
0x05, 0x41, 0x44, 0x4d, 0x49, 0x4e, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x56, 0x49, 0x43, 0x45,
0x50, 0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x12, 0x0d, 0x0a, 0x09, 0x50,
0x52, 0x45, 0x53, 0x49, 0x44, 0x45, 0x4e, 0x54, 0x10, 0x04, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_sociaty_sociaty_db_proto_rawDescOnce sync.Once
file_sociaty_sociaty_db_proto_rawDescData = file_sociaty_sociaty_db_proto_rawDesc
)
func file_sociaty_sociaty_db_proto_rawDescGZIP() []byte {
file_sociaty_sociaty_db_proto_rawDescOnce.Do(func() {
file_sociaty_sociaty_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_sociaty_sociaty_db_proto_rawDescData)
})
return file_sociaty_sociaty_db_proto_rawDescData
}
var file_sociaty_sociaty_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_sociaty_sociaty_db_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
var file_sociaty_sociaty_db_proto_goTypes = []interface{}{
(SociatyJob)(0), // 0: SociatyJob
(*DBSociaty)(nil), // 1: DBSociaty
(*ApplyRecord)(nil), // 2: ApplyRecord
(*SociatyMember)(nil), // 3: SociatyMember
(*SociatyLog)(nil), // 4: SociatyLog
(*DBSociatyTask)(nil), // 5: DBSociatyTask
(*SociatyTask)(nil), // 6: SociatyTask
(*DBSociatyRank)(nil), // 7: DBSociatyRank
}
var file_sociaty_sociaty_db_proto_depIdxs = []int32{
2, // 0: DBSociaty.applyRecord:type_name -> ApplyRecord
3, // 1: DBSociaty.members:type_name -> SociatyMember
4, // 2: DBSociaty.logs:type_name -> SociatyLog
0, // 3: SociatyMember.job:type_name -> SociatyJob
6, // 4: DBSociatyTask.list:type_name -> SociatyTask
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_sociaty_sociaty_db_proto_init() }
func file_sociaty_sociaty_db_proto_init() {
if File_sociaty_sociaty_db_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_sociaty_sociaty_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBSociaty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_sociaty_sociaty_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ApplyRecord); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_sociaty_sociaty_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SociatyMember); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_sociaty_sociaty_db_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SociatyLog); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_sociaty_sociaty_db_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBSociatyTask); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_sociaty_sociaty_db_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SociatyTask); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_sociaty_sociaty_db_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DBSociatyRank); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_sociaty_sociaty_db_proto_rawDesc,
NumEnums: 1,
NumMessages: 7,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_sociaty_sociaty_db_proto_goTypes,
DependencyIndexes: file_sociaty_sociaty_db_proto_depIdxs,
EnumInfos: file_sociaty_sociaty_db_proto_enumTypes,
MessageInfos: file_sociaty_sociaty_db_proto_msgTypes,
}.Build()
File_sociaty_sociaty_db_proto = out.File
file_sociaty_sociaty_db_proto_rawDesc = nil
file_sociaty_sociaty_db_proto_goTypes = nil
file_sociaty_sociaty_db_proto_depIdxs = nil
}

3318
pb/sociaty_msg.pb.go Normal file

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@ import (
"go_dreamfactory/modules/rtask"
"go_dreamfactory/modules/shop"
"go_dreamfactory/modules/smithy"
"go_dreamfactory/modules/sociaty"
"go_dreamfactory/modules/sys"
"go_dreamfactory/modules/task"
"go_dreamfactory/modules/troll"
@ -92,6 +93,7 @@ func main() {
library.NewModule(),
arena.NewModule(),
troll.NewModule(),
sociaty.NewModule(),
)
}

View 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 GameGuildActivity struct {
_dataMap map[int32]*GameGuildActivityData
_dataList []*GameGuildActivityData
}
func NewGameGuildActivity(_buf []map[string]interface{}) (*GameGuildActivity, error) {
_dataList := make([]*GameGuildActivityData, 0, len(_buf))
dataMap := make(map[int32]*GameGuildActivityData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGuildActivityData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameGuildActivity{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGuildActivity) GetDataMap() map[int32]*GameGuildActivityData {
return table._dataMap
}
func (table *GameGuildActivity) GetDataList() []*GameGuildActivityData {
return table._dataList
}
func (table *GameGuildActivity) Get(key int32) *GameGuildActivityData {
return table._dataMap[key]
}

View File

@ -0,0 +1,52 @@
//------------------------------------------------------------------------------
// <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 GameGuildActivityData struct {
Id int32
Activity int32
Reward []*Gameatn
}
const TypeId_GameGuildActivityData = 1556214768
func (*GameGuildActivityData) GetTypeId() int32 {
return 1556214768
}
func (_v *GameGuildActivityData)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; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["activity"].(float64); !_ok_ { err = errors.New("activity error"); return }; _v.Activity = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = 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.Reward = append(_v.Reward, _list_v_)
}
}
return
}
func DeserializeGameGuildActivityData(_buf map[string]interface{}) (*GameGuildActivityData, error) {
v := &GameGuildActivityData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameGuildLv struct {
_dataMap map[int32]*GameGuildLvData
_dataList []*GameGuildLvData
}
func NewGameGuildLv(_buf []map[string]interface{}) (*GameGuildLv, error) {
_dataList := make([]*GameGuildLvData, 0, len(_buf))
dataMap := make(map[int32]*GameGuildLvData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGuildLvData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Lv] = _v
}
}
return &GameGuildLv{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGuildLv) GetDataMap() map[int32]*GameGuildLvData {
return table._dataMap
}
func (table *GameGuildLv) GetDataList() []*GameGuildLvData {
return table._dataList
}
func (table *GameGuildLv) Get(key int32) *GameGuildLvData {
return table._dataMap[key]
}

View File

@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <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 GameGuildLvData struct {
Lv int32
Exp int32
MemberMax int32
}
const TypeId_GameGuildLvData = 150033963
func (*GameGuildLvData) GetTypeId() int32 {
return 150033963
}
func (_v *GameGuildLvData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["member_max"].(float64); !_ok_ { err = errors.New("member_max error"); return }; _v.MemberMax = int32(_tempNum_) }
return
}
func DeserializeGameGuildLvData(_buf map[string]interface{}) (*GameGuildLvData, error) {
v := &GameGuildLvData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameGuildPng struct {
_dataMap map[int32]*GameGuildPngData
_dataList []*GameGuildPngData
}
func NewGameGuildPng(_buf []map[string]interface{}) (*GameGuildPng, error) {
_dataList := make([]*GameGuildPngData, 0, len(_buf))
dataMap := make(map[int32]*GameGuildPngData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGuildPngData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameGuildPng{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGuildPng) GetDataMap() map[int32]*GameGuildPngData {
return table._dataMap
}
func (table *GameGuildPng) GetDataList() []*GameGuildPngData {
return table._dataList
}
func (table *GameGuildPng) Get(key int32) *GameGuildPngData {
return table._dataMap[key]
}

View 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 GameGuildPngData struct {
Id int32
Png string
}
const TypeId_GameGuildPngData = -586458500
func (*GameGuildPngData) GetTypeId() int32 {
return -586458500
}
func (_v *GameGuildPngData)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.Png, _ok_ = _buf["png"].(string); !_ok_ { err = errors.New("png error"); return } }
return
}
func DeserializeGameGuildPngData(_buf map[string]interface{}) (*GameGuildPngData, error) {
v := &GameGuildPngData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameGuildSign struct {
_dataMap map[int32]*GameGuildSignData
_dataList []*GameGuildSignData
}
func NewGameGuildSign(_buf []map[string]interface{}) (*GameGuildSign, error) {
_dataList := make([]*GameGuildSignData, 0, len(_buf))
dataMap := make(map[int32]*GameGuildSignData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGuildSignData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameGuildSign{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGuildSign) GetDataMap() map[int32]*GameGuildSignData {
return table._dataMap
}
func (table *GameGuildSign) GetDataList() []*GameGuildSignData {
return table._dataList
}
func (table *GameGuildSign) Get(key int32) *GameGuildSignData {
return table._dataMap[key]
}

View File

@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
// <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 GameGuildSignData struct {
Id int32
Down int32
Up int32
SignInText string
Reward []*Gameatn
Exp *Gameatn
}
const TypeId_GameGuildSignData = -171525346
func (*GameGuildSignData) GetTypeId() int32 {
return -171525346
}
func (_v *GameGuildSignData)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; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["down"].(float64); !_ok_ { err = errors.New("down error"); return }; _v.Down = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["up"].(float64); !_ok_ { err = errors.New("up error"); return }; _v.Up = int32(_tempNum_) }
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["SignIn_text"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.SignInText error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.SignInText, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = 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.Reward = append(_v.Reward, _list_v_)
}
}
{ var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["exp"].(map[string]interface{}); !_ok_ { err = errors.New("exp error"); return }; if _v.Exp, err = DeserializeGameatn(_x_); err != nil { return } }
return
}
func DeserializeGameGuildSignData(_buf map[string]interface{}) (*GameGuildSignData, error) {
v := &GameGuildSignData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameGuildTask struct {
_dataMap map[int32]*GameGuildTaskData
_dataList []*GameGuildTaskData
}
func NewGameGuildTask(_buf []map[string]interface{}) (*GameGuildTask, error) {
_dataList := make([]*GameGuildTaskData, 0, len(_buf))
dataMap := make(map[int32]*GameGuildTaskData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGuildTaskData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameGuildTask{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGuildTask) GetDataMap() map[int32]*GameGuildTaskData {
return table._dataMap
}
func (table *GameGuildTask) GetDataList() []*GameGuildTaskData {
return table._dataList
}
func (table *GameGuildTask) Get(key int32) *GameGuildTaskData {
return table._dataMap[key]
}

View File

@ -0,0 +1,69 @@
//------------------------------------------------------------------------------
// <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 GameGuildTaskData struct {
Id int32
Weight int32
Reward []*Gameatn
SociatyReward []*Gameatn
Contribution int32
}
const TypeId_GameGuildTaskData = -892997914
func (*GameGuildTaskData) GetTypeId() int32 {
return -892997914
}
func (_v *GameGuildTaskData)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; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["weight"].(float64); !_ok_ { err = errors.New("weight error"); return }; _v.Weight = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = 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.Reward = append(_v.Reward, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["sociaty_reward"].([]interface{}); !_ok_ { err = errors.New("sociaty_reward error"); return }
_v.SociatyReward = 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.SociatyReward = append(_v.SociatyReward, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["contribution"].(float64); !_ok_ { err = errors.New("contribution error"); return }; _v.Contribution = int32(_tempNum_) }
return
}
func DeserializeGameGuildTaskData(_buf map[string]interface{}) (*GameGuildTaskData, error) {
v := &GameGuildTaskData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameSociatyActivity struct {
_dataMap map[int32]*GameSociatyActivityData
_dataList []*GameSociatyActivityData
}
func NewGameSociatyActivity(_buf []map[string]interface{}) (*GameSociatyActivity, error) {
_dataList := make([]*GameSociatyActivityData, 0, len(_buf))
dataMap := make(map[int32]*GameSociatyActivityData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSociatyActivityData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameSociatyActivity{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSociatyActivity) GetDataMap() map[int32]*GameSociatyActivityData {
return table._dataMap
}
func (table *GameSociatyActivity) GetDataList() []*GameSociatyActivityData {
return table._dataList
}
func (table *GameSociatyActivity) Get(key int32) *GameSociatyActivityData {
return table._dataMap[key]
}

View File

@ -0,0 +1,52 @@
//------------------------------------------------------------------------------
// <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 GameSociatyActivityData struct {
Id int32
Activity string
Reward []*Gameatn
}
const TypeId_GameSociatyActivityData = 184900897
func (*GameSociatyActivityData) GetTypeId() int32 {
return 184900897
}
func (_v *GameSociatyActivityData)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.Activity, _ok_ = _buf["activity"].(string); !_ok_ { err = errors.New("activity error"); return } }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = 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.Reward = append(_v.Reward, _list_v_)
}
}
return
}
func DeserializeGameSociatyActivityData(_buf map[string]interface{}) (*GameSociatyActivityData, error) {
v := &GameSociatyActivityData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameSociatyLv struct {
_dataMap map[int32]*GameSociatyLvData
_dataList []*GameSociatyLvData
}
func NewGameSociatyLv(_buf []map[string]interface{}) (*GameSociatyLv, error) {
_dataList := make([]*GameSociatyLvData, 0, len(_buf))
dataMap := make(map[int32]*GameSociatyLvData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSociatyLvData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Lv] = _v
}
}
return &GameSociatyLv{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSociatyLv) GetDataMap() map[int32]*GameSociatyLvData {
return table._dataMap
}
func (table *GameSociatyLv) GetDataList() []*GameSociatyLvData {
return table._dataList
}
func (table *GameSociatyLv) Get(key int32) *GameSociatyLvData {
return table._dataMap[key]
}

View File

@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <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 GameSociatyLvData struct {
Lv int32
Exp int32
MemberMax int32
}
const TypeId_GameSociatyLvData = 1669576732
func (*GameSociatyLvData) GetTypeId() int32 {
return 1669576732
}
func (_v *GameSociatyLvData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lv"].(float64); !_ok_ { err = errors.New("lv error"); return }; _v.Lv = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exp"].(float64); !_ok_ { err = errors.New("exp error"); return }; _v.Exp = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["member_max"].(float64); !_ok_ { err = errors.New("member_max error"); return }; _v.MemberMax = int32(_tempNum_) }
return
}
func DeserializeGameSociatyLvData(_buf map[string]interface{}) (*GameSociatyLvData, error) {
v := &GameSociatyLvData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameSociatySign struct {
_dataMap map[int32]*GameSociatySignData
_dataList []*GameSociatySignData
}
func NewGameSociatySign(_buf []map[string]interface{}) (*GameSociatySign, error) {
_dataList := make([]*GameSociatySignData, 0, len(_buf))
dataMap := make(map[int32]*GameSociatySignData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSociatySignData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameSociatySign{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSociatySign) GetDataMap() map[int32]*GameSociatySignData {
return table._dataMap
}
func (table *GameSociatySign) GetDataList() []*GameSociatySignData {
return table._dataList
}
func (table *GameSociatySign) Get(key int32) *GameSociatySignData {
return table._dataMap[key]
}

View File

@ -0,0 +1,69 @@
//------------------------------------------------------------------------------
// <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 GameSociatySignData struct {
Id int32
Down int32
Up int32
Reward []*Gameatn
Exp []*Gameatn
}
const TypeId_GameSociatySignData = -179804977
func (*GameSociatySignData) GetTypeId() int32 {
return -179804977
}
func (_v *GameSociatySignData)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; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["down"].(float64); !_ok_ { err = errors.New("down error"); return }; _v.Down = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["up"].(float64); !_ok_ { err = errors.New("up error"); return }; _v.Up = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = 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.Reward = append(_v.Reward, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["exp"].([]interface{}); !_ok_ { err = errors.New("exp error"); return }
_v.Exp = 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.Exp = append(_v.Exp, _list_v_)
}
}
return
}
func DeserializeGameSociatySignData(_buf map[string]interface{}) (*GameSociatySignData, error) {
v := &GameSociatySignData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View 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 GameSociatyTask struct {
_dataMap map[int32]*GameSociatyTaskData
_dataList []*GameSociatyTaskData
}
func NewGameSociatyTask(_buf []map[string]interface{}) (*GameSociatyTask, error) {
_dataList := make([]*GameSociatyTaskData, 0, len(_buf))
dataMap := make(map[int32]*GameSociatyTaskData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameSociatyTaskData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Id] = _v
}
}
return &GameSociatyTask{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameSociatyTask) GetDataMap() map[int32]*GameSociatyTaskData {
return table._dataMap
}
func (table *GameSociatyTask) GetDataList() []*GameSociatyTaskData {
return table._dataList
}
func (table *GameSociatyTask) Get(key int32) *GameSociatyTaskData {
return table._dataMap[key]
}

View File

@ -0,0 +1,69 @@
//------------------------------------------------------------------------------
// <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 GameSociatyTaskData struct {
Id int32
Weight int32
Reward []*Gameatn
SociatyReword []*Gameatn
Contribution int32
}
const TypeId_GameSociatyTaskData = -901277545
func (*GameSociatyTaskData) GetTypeId() int32 {
return -901277545
}
func (_v *GameSociatyTaskData)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; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["weight"].(float64); !_ok_ { err = errors.New("weight error"); return }; _v.Weight = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["reward"].([]interface{}); !_ok_ { err = errors.New("reward error"); return }
_v.Reward = 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.Reward = append(_v.Reward, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["sociaty_reward"].([]interface{}); !_ok_ { err = errors.New("sociaty_reward error"); return }
_v.SociatyReword = 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.SociatyReword = append(_v.SociatyReword, _list_v_)
}
}
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["contribution"].(float64); !_ok_ { err = errors.New("contribution error"); return }; _v.Contribution = int32(_tempNum_) }
return
}
func DeserializeGameSociatyTaskData(_buf map[string]interface{}) (*GameSociatyTaskData, error) {
v := &GameSociatyTaskData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {
return nil, err
}
}

View File

@ -109,6 +109,9 @@ type GameGlobalData struct {
ArenaTicketPurchaseRrestrictions int32
ArenaInitiaIntegral int32
ArenaRecordMax int32
ArenaRefreshCd int32
ShowMale []int32
ShowFemale []int32
}
const TypeId_GameGlobalData = 477542761
@ -359,6 +362,35 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ArenaTicket_PurchaseRrestrictions"].(float64); !_ok_ { err = errors.New("ArenaTicket_PurchaseRrestrictions error"); return }; _v.ArenaTicketPurchaseRrestrictions = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["arena_InitiaIntegral"].(float64); !_ok_ { err = errors.New("arena_InitiaIntegral error"); return }; _v.ArenaInitiaIntegral = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["arena_RecordMax"].(float64); !_ok_ { err = errors.New("arena_RecordMax error"); return }; _v.ArenaRecordMax = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["arena_RefreshCd"].(float64); !_ok_ { err = errors.New("arena_RefreshCd error"); return }; _v.ArenaRefreshCd = int32(_tempNum_) }
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["show_male"].([]interface{}); !_ok_ { err = errors.New("show_male error"); return }
_v.ShowMale = 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.ShowMale = append(_v.ShowMale, _list_v_)
}
}
{
var _arr_ []interface{}
var _ok_ bool
if _arr_, _ok_ = _buf["show_female"].([]interface{}); !_ok_ { err = errors.New("show_female error"); return }
_v.ShowFemale = 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.ShowFemale = append(_v.ShowFemale, _list_v_)
}
}
return
}