Merge branch 'dev' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev
This commit is contained in:
commit
2a69fe0450
@ -10,6 +10,7 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -115,6 +116,11 @@ func main() {
|
||||
// }
|
||||
}
|
||||
|
||||
// 排序
|
||||
sort.SliceStable(dirs, func(i, j int) bool {
|
||||
return dirs[i].DateTime > dirs[j].DateTime
|
||||
})
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"dirs": dirs,
|
||||
})
|
||||
|
@ -4,5 +4,5 @@ Website = "http://legu.cc"
|
||||
Icon = "app.png"
|
||||
Name = "RobotGUI"
|
||||
ID = "cc.legu.app"
|
||||
Version = "1.0.11"
|
||||
Build = 14
|
||||
Version = "1.0.13"
|
||||
Build = 16
|
||||
|
@ -1,4 +1,7 @@
|
||||
@echo off
|
||||
|
||||
rem build desktop
|
||||
go build -ldflags -H=windowsgui -o robot.exe
|
||||
set input=%1%
|
||||
|
||||
echo build version:%input%
|
||||
|
||||
fyne package --name RobotGUI-%input% -os windows
|
231
cmd/v2/lib/common/itemlist.go
Normal file
231
cmd/v2/lib/common/itemlist.go
Normal file
@ -0,0 +1,231 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/utils"
|
||||
"io/ioutil"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type ItemList struct {
|
||||
SelItemIds []string //选择的ID
|
||||
ItemTotal int //总数
|
||||
TitleLabel *widget.Label
|
||||
CachedList List
|
||||
ItemList *widget.List
|
||||
SearchItem []Item //用于暂存搜索结果
|
||||
}
|
||||
|
||||
func NewItemList() *ItemList {
|
||||
return &ItemList{
|
||||
TitleLabel: &widget.Label{},
|
||||
CachedList: NewList(""),
|
||||
}
|
||||
}
|
||||
|
||||
// 重置
|
||||
func (f *ItemList) Reset() {
|
||||
f.ItemTotal = 0
|
||||
f.SelItemIds = []string{}
|
||||
f.CachedList = NewList("")
|
||||
}
|
||||
|
||||
func (f *ItemList) CreateList() *widget.List {
|
||||
f.ItemList = widget.NewList(
|
||||
func() int {
|
||||
return len(f.CachedList.Items)
|
||||
},
|
||||
func() fyne.CanvasObject {
|
||||
return widget.NewLabel("Template")
|
||||
},
|
||||
func(id widget.ListItemID, item fyne.CanvasObject) {
|
||||
c, _ := item.(*widget.Label)
|
||||
c.Text = f.CachedList.Items[id].Text
|
||||
c.Refresh()
|
||||
},
|
||||
)
|
||||
f.ItemList.OnSelected = func(id widget.ListItemID) {
|
||||
selId := f.CachedList.Items[id].Id
|
||||
f.SelItemIds = append(f.SelItemIds, selId)
|
||||
return
|
||||
}
|
||||
return f.ItemList
|
||||
}
|
||||
|
||||
// 创建默认的列表
|
||||
func (f *ItemList) CreateDefaultCheckList() *widget.List {
|
||||
f.ItemList = widget.NewList(
|
||||
func() int {
|
||||
return len(f.CachedList.Items)
|
||||
},
|
||||
func() fyne.CanvasObject {
|
||||
return widget.NewCheck("Template", func(bool) {})
|
||||
},
|
||||
func(id widget.ListItemID, item fyne.CanvasObject) {
|
||||
c, _ := item.(*widget.Check)
|
||||
c.Text = f.CachedList.Items[id].Text
|
||||
c.Checked = f.CachedList.Items[id].Checked
|
||||
|
||||
c.OnChanged = func(b bool) {
|
||||
if b {
|
||||
f.SelItemIds = append(f.SelItemIds, c.Text)
|
||||
} else {
|
||||
f.SelItemIds = utils.DeleteString(f.SelItemIds, c.Text)
|
||||
}
|
||||
f.TitleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.SelItemIds), f.ItemTotal))
|
||||
f.CachedList.Items[id].Checked = b
|
||||
// sort.Sort(f.cachedList)
|
||||
f.ItemList.Refresh()
|
||||
}
|
||||
c.Refresh()
|
||||
},
|
||||
)
|
||||
return f.ItemList
|
||||
}
|
||||
|
||||
// 创建下载列表
|
||||
func (f *ItemList) CreateDownloadList() *widget.List {
|
||||
f.ItemList = widget.NewList(
|
||||
func() int {
|
||||
return len(f.CachedList.Items)
|
||||
},
|
||||
func() fyne.CanvasObject {
|
||||
chk := widget.NewCheck("Template", func(bool) {})
|
||||
lb := widget.NewLabel("Template")
|
||||
items := container.NewHBox(chk, &layout.Spacer{}, lb)
|
||||
return items
|
||||
},
|
||||
func(id widget.ListItemID, item fyne.CanvasObject) {
|
||||
c, _ := item.(*fyne.Container)
|
||||
chk := c.Objects[0].(*widget.Check)
|
||||
data := f.CachedList.Items[id]
|
||||
chk.Text = data.Text
|
||||
chk.Checked = data.Checked
|
||||
chk.OnChanged = func(b bool) {
|
||||
if b {
|
||||
f.SelItemIds = append(f.SelItemIds, chk.Text)
|
||||
} else {
|
||||
f.SelItemIds = utils.DeleteString(f.SelItemIds, chk.Text)
|
||||
}
|
||||
f.CachedList.Items[id].Checked = b
|
||||
// sort.Sort(f.cachedList)
|
||||
f.ItemList.Refresh()
|
||||
}
|
||||
|
||||
lb := c.Objects[2].(*widget.Label)
|
||||
lb.Text = ConvertFileSize(data.Size)
|
||||
c.Refresh()
|
||||
},
|
||||
)
|
||||
return f.ItemList
|
||||
}
|
||||
|
||||
func (f *ItemList) AddItem(item Item) {
|
||||
f.CachedList.Items = append(f.CachedList.Items, item)
|
||||
// sort.Sort(f.cachedList)
|
||||
f.ItemList.Refresh()
|
||||
}
|
||||
|
||||
func (f *ItemList) AddItemWithText(val string) {
|
||||
val = strings.TrimSpace(val)
|
||||
if len(val) == 0 {
|
||||
return
|
||||
}
|
||||
newItem := Item{
|
||||
Text: val,
|
||||
Quantity: 1,
|
||||
Checked: false, //默认不选中
|
||||
}
|
||||
f.CachedList.Items = append(f.CachedList.Items, newItem)
|
||||
sort.Sort(f.CachedList)
|
||||
f.ItemList.Refresh()
|
||||
}
|
||||
|
||||
func (f *ItemList) LoadItem(dirPath string) {
|
||||
f.Reset()
|
||||
files, err := ioutil.ReadDir(dirPath)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
if !file.IsDir() {
|
||||
f.AddItemWithText(file.Name())
|
||||
// f.selItemIds = append(f.selItemIds, file.Name())
|
||||
f.ItemTotal++
|
||||
// logrus.Debugf("%v", file.Name())
|
||||
}
|
||||
}
|
||||
|
||||
f.SearchItem = f.CachedList.Items
|
||||
}
|
||||
|
||||
// 改变列表项目
|
||||
func (f *ItemList) ChangeItem(tmpDir, projectDir string) {
|
||||
f.ItemTotal = 0
|
||||
f.SelItemIds = []string{}
|
||||
f.CachedList = NewList("")
|
||||
tmpFiles, err := ioutil.ReadDir(tmpDir)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if len(tmpFiles) == 0 || len(f.CachedList.Items) == 0 {
|
||||
ShowTip("没有任何变更的项目")
|
||||
}
|
||||
}()
|
||||
|
||||
projectFiles, err := ioutil.ReadDir(projectDir)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
pfMap := make(map[string]int64)
|
||||
for _, v := range projectFiles {
|
||||
if !v.IsDir() {
|
||||
pfMap[v.Name()] = v.ModTime().Unix()
|
||||
}
|
||||
}
|
||||
|
||||
for _, file := range tmpFiles {
|
||||
if !file.IsDir() {
|
||||
if pfTime, ok := pfMap[file.Name()]; ok {
|
||||
if file.ModTime().Unix() <= pfTime {
|
||||
continue
|
||||
}
|
||||
}
|
||||
f.AddItemWithText(file.Name())
|
||||
f.SelItemIds = append(f.SelItemIds, file.Name())
|
||||
f.ItemTotal++
|
||||
logrus.Debugf("%v", file.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新文件数
|
||||
func (f *ItemList) ChangeFileCount() {
|
||||
f.TitleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.SelItemIds), f.ItemTotal))
|
||||
}
|
||||
|
||||
func (f *ItemList) DeleteItem(name string) {
|
||||
for i, v := range f.CachedList.Items {
|
||||
if v.Text == name {
|
||||
f.SelItemIds = utils.DeleteString(f.SelItemIds, v.Text)
|
||||
f.CachedList.Items = append(f.CachedList.Items[:i], f.CachedList.Items[i+1:]...)
|
||||
if f.ItemTotal > 0 {
|
||||
f.ItemTotal--
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -172,4 +172,6 @@ const (
|
||||
USERINFO_MODINAME = "免费改名次数"
|
||||
USERINFO_ACTIVE_DAY = "日活"
|
||||
USERINFO_ACTIVE_WEEK = "周活"
|
||||
USERINFO_CREATETM = "创建"
|
||||
USERINFO_UPDATETM = "更新"
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ui
|
||||
package common
|
||||
|
||||
import "strings"
|
||||
|
||||
@ -57,10 +57,12 @@ func (l List) Less(i, j int) bool {
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Id string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Text string `json:"text"`
|
||||
Quantity int `json:"quantity"`
|
||||
Checked bool `json:"checked"`
|
||||
Size int64 `json:"size"`
|
||||
}
|
||||
|
||||
func NewList(name string) List {
|
40
cmd/v2/lib/common/tip.go
Normal file
40
cmd/v2/lib/common/tip.go
Normal file
@ -0,0 +1,40 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
"time"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
// 显示Tip
|
||||
func ShowTip(content string) {
|
||||
drv := fyne.CurrentApp().Driver()
|
||||
if drv, ok := drv.(desktop.Driver); ok {
|
||||
w := drv.CreateSplashWindow()
|
||||
w.SetContent(widget.NewLabelWithStyle(content, fyne.TextAlignCenter, fyne.TextStyle{}))
|
||||
w.Show()
|
||||
|
||||
go func() {
|
||||
time.Sleep(time.Millisecond * 1500)
|
||||
w.Close()
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
||||
func ShowCanvasTip(content string) {
|
||||
drv := fyne.CurrentApp().Driver()
|
||||
if drv, ok := drv.(desktop.Driver); ok {
|
||||
w := drv.CreateSplashWindow()
|
||||
w.SetContent(canvas.NewText(content, color.RGBA{255, 0, 0, 255}))
|
||||
w.Show()
|
||||
|
||||
go func() {
|
||||
time.Sleep(time.Millisecond * 1500)
|
||||
w.Close()
|
||||
}()
|
||||
}
|
||||
}
|
@ -4,8 +4,10 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"math"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
@ -117,3 +119,40 @@ func RemoveContents(dir string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func ConvertFileSize(size int64) string {
|
||||
if size == 0 {
|
||||
return "0"
|
||||
}
|
||||
|
||||
kb := float64(size) / float64(1024)
|
||||
|
||||
if kb < 1024 {
|
||||
f := math.Ceil(kb)
|
||||
return strconv.Itoa(int(f)) + " KB"
|
||||
}
|
||||
|
||||
mb := kb / float64(1024)
|
||||
if mb < 1024 {
|
||||
f := math.Ceil(mb)
|
||||
return strconv.Itoa(int(f)) + " MB"
|
||||
}
|
||||
|
||||
gb := mb / float64(1024)
|
||||
if gb < 1024 {
|
||||
f := math.Ceil(mb)
|
||||
return strconv.Itoa(int(f)) + " G"
|
||||
}
|
||||
|
||||
t := gb / float64(1024)
|
||||
if t < 1024 {
|
||||
f := math.Ceil(mb)
|
||||
return strconv.Itoa(int(f)) + " T"
|
||||
}
|
||||
|
||||
if t >= 1024 {
|
||||
return "VeryBig"
|
||||
}
|
||||
|
||||
return "0"
|
||||
}
|
||||
|
@ -10,3 +10,9 @@ func TestSubStr(t *testing.T) {
|
||||
r := SubStr(str, 20, len(str))
|
||||
fmt.Println(r)
|
||||
}
|
||||
|
||||
func TestConver(t *testing.T) {
|
||||
|
||||
s := ConvertFileSize(25325466)
|
||||
fmt.Println(s)
|
||||
}
|
||||
|
@ -81,12 +81,12 @@ func main() {
|
||||
w.SetContent(container.NewGridWithColumns(2,
|
||||
widget.NewButton("工具", func() {
|
||||
toolWindow := ui.NewToolWindow(appUI, w)
|
||||
toolWindow.CreateWindow(common.APP_NAME, 1366, 768, true)
|
||||
toolWindow.CreateWindow(common.APP_NAME, 1499, 800, true)
|
||||
w.Hide()
|
||||
}),
|
||||
widget.NewButton("登服", func() {
|
||||
mainWindow := ui.NewMainWindow(appUI, w)
|
||||
mainWindow.CreateWindow(common.APP_NAME, 1366, 768, true)
|
||||
mainWindow.CreateWindow(common.APP_NAME, 1499, 800, true)
|
||||
w.Hide()
|
||||
})))
|
||||
w.SetFixedSize(true)
|
||||
|
@ -13,4 +13,9 @@ type SSHModel struct {
|
||||
LubanCli string
|
||||
DataDir string
|
||||
JsonDir string
|
||||
|
||||
//
|
||||
SaveDir string //保存目录
|
||||
LogDir string //远程日志目录
|
||||
Editor string //编辑器
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
@ -281,7 +283,91 @@ func (ss *SSHService) Scp(targetDir, srcFileName string) (int, error) {
|
||||
return n, nil
|
||||
}
|
||||
|
||||
//Download
|
||||
func (ss *SSHService) ScpDownload(localDir, remoteFilePath string) error {
|
||||
sftpCli, err = ss.getSftp()
|
||||
if err != nil {
|
||||
return fmt.Errorf("new sftp client error: %w", err)
|
||||
}
|
||||
|
||||
remoteFile, err := sftpCli.Open(remoteFilePath)
|
||||
if err != nil {
|
||||
log.Println("scpCopy:", err)
|
||||
return err
|
||||
}
|
||||
defer remoteFile.Close()
|
||||
|
||||
fileName := path.Base(remoteFile.Name())
|
||||
|
||||
if err := os.MkdirAll(localDir, fs.ModePerm); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
target, err := os.OpenFile(localDir+fileName, os.O_RDWR|os.O_CREATE|os.O_TRUNC, fs.ModePerm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("open local file error: %w", err)
|
||||
}
|
||||
defer target.Close()
|
||||
|
||||
_, err = io.Copy(target, remoteFile)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write file error: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (ss *SSHService) GetRemoteDir(remoteDir string) (files []File, err error) {
|
||||
sftpCli, err = ss.getSftp()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("new sftp client error: %w", err)
|
||||
}
|
||||
|
||||
remoteFiles, err := sftpCli.ReadDir(remoteDir)
|
||||
if err != nil {
|
||||
log.Println("read remote Dir:", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, f := range remoteFiles {
|
||||
fi := File{
|
||||
FileName: f.Name(),
|
||||
FilePath: filepath.Join(remoteDir, f.Name()),
|
||||
Size: f.Size(),
|
||||
}
|
||||
files = append(files, fi)
|
||||
// logrus.WithFields(logrus.Fields{"name": f.Name(), "size": f.Size()}).Debug("远程日志文件")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (ss *SSHService) BatchScpDownload(localDir, remoteDir string) error {
|
||||
sftpCli, err = ss.getSftp()
|
||||
if err != nil {
|
||||
return fmt.Errorf("new sftp client error: %w", err)
|
||||
}
|
||||
|
||||
remoteFiles, err := sftpCli.ReadDir(remoteDir)
|
||||
if err != nil {
|
||||
log.Println("read remote Dir:", err)
|
||||
return err
|
||||
}
|
||||
|
||||
for _, f := range remoteFiles {
|
||||
if err := ss.ScpDownload(localDir, filepath.Join(remoteDir, f.Name())); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type CopyFiles struct {
|
||||
Dir string
|
||||
FileName string
|
||||
}
|
||||
|
||||
type File struct {
|
||||
FileName string
|
||||
FilePath string
|
||||
Size int64
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@ -56,3 +57,31 @@ func TestMath(t *testing.T) {
|
||||
a := float64(10) / float64(3)
|
||||
fmt.Println(a)
|
||||
}
|
||||
|
||||
func TestScpDown(t *testing.T) {
|
||||
ciphers := []string{}
|
||||
ssh := &SSHService{}
|
||||
|
||||
err := ssh.Connect(username, password, ip, "", port, ciphers)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
sftpCli, err = ssh.getSftp()
|
||||
if err != nil {
|
||||
fmt.Errorf("new sftp client error: %w", err)
|
||||
}
|
||||
|
||||
remoteFiles, err := sftpCli.ReadDir("/home/liwei/go_dreamfactory/bin/log")
|
||||
if err != nil {
|
||||
log.Println("scpCopy:", err)
|
||||
}
|
||||
|
||||
for _, v := range remoteFiles {
|
||||
fmt.Println(v.Name())
|
||||
if err := ssh.ScpDownload("G:/log/", "/home/liwei/go_dreamfactory/bin/log/"+v.Name()); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,10 @@ package ui
|
||||
|
||||
import (
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
"net/url"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
@ -14,12 +17,15 @@ type about struct {
|
||||
func newAbout() *about {
|
||||
var a about
|
||||
ver := toolWin.app.Metadata().Version
|
||||
link, _ := url.Parse("http://10.0.0.9:8080")
|
||||
wlink := widget.NewHyperlinkWithStyle("更新包", link, fyne.TextAlignLeading, fyne.TextStyle{})
|
||||
content := widget.NewCard("", "", widget.NewRichTextFromMarkdown(
|
||||
`
|
||||
梦工厂项目辅助工具GUI
|
||||
@v`+ver,
|
||||
))
|
||||
a.aboutDialog = dialog.NewCustom(common.APP_ABOUT_TITLE, common.APP_ABOUT_CONFIRM, content, toolWin.w)
|
||||
a.aboutDialog = dialog.NewCustom(common.APP_ABOUT_TITLE, common.APP_ABOUT_CONFIRM,
|
||||
container.NewVBox(content, wlink), toolWin.w)
|
||||
|
||||
return &a
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ func (this *appMonitor) Run() {
|
||||
data := d.(*model.PushModel)
|
||||
this.monitorData.DataList = append(this.monitorData.DataList, data)
|
||||
this.reloadMonitorData()
|
||||
showTip("收到新的数据推送,请打开[监控]页面")
|
||||
common.ShowCanvasTip("收到新的数据推送,请打开[推送]页面")
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
"go_dreamfactory/cmd/v2/service"
|
||||
@ -107,7 +108,7 @@ func (ui *MainWindowImpl) SetStatusMsg(msg string) {
|
||||
}
|
||||
|
||||
func (ui *MainWindowImpl) quiteHandle() {
|
||||
dialog.ShowConfirm("推出系统", "确定退出吗", func(b bool) {
|
||||
dialog.ShowConfirm("提示", "确定退出吗", func(b bool) {
|
||||
if !b {
|
||||
return
|
||||
}
|
||||
@ -265,6 +266,20 @@ func (ui *MainWindowImpl) createLoginWin(sid, sname string) {
|
||||
// create role
|
||||
ui.createRoleWindowPopUp()
|
||||
}
|
||||
} else if msg.MainType == "notify" && msg.SubType == "errornotify" {
|
||||
push := &pb.NotifyErrorNotifyPush{}
|
||||
if !comm.ProtoUnmarshal(msg, push) {
|
||||
logrus.Error("unmarsh err")
|
||||
return
|
||||
}
|
||||
|
||||
if push.Code == pb.ErrorCode_UserLogined {
|
||||
cf := dialog.NewError(errors.New("【"+account.Text+"】账号已在其它终端登录,退出重新登录"), ui.w)
|
||||
cf.SetOnClosed(func() {
|
||||
ui.app.Quit()
|
||||
})
|
||||
cf.Show()
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
@ -1,24 +0,0 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
// 显示Tip
|
||||
func showTip(content string) {
|
||||
drv := fyne.CurrentApp().Driver()
|
||||
if drv, ok := drv.(desktop.Driver); ok {
|
||||
w := drv.CreateSplashWindow()
|
||||
w.SetContent(widget.NewLabelWithStyle(content, fyne.TextAlignCenter, fyne.TextStyle{}))
|
||||
w.Show()
|
||||
|
||||
go func() {
|
||||
time.Sleep(time.Second * 2)
|
||||
w.Close()
|
||||
}()
|
||||
}
|
||||
}
|
@ -7,13 +7,9 @@ import (
|
||||
"go_dreamfactory/cmd/v2/model"
|
||||
"go_dreamfactory/cmd/v2/service"
|
||||
"go_dreamfactory/cmd/v2/service/observer"
|
||||
"go_dreamfactory/utils"
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
@ -29,14 +25,14 @@ type appGen struct {
|
||||
appAdapter
|
||||
|
||||
obs observer.Observer
|
||||
goList *fileList
|
||||
jsonList *fileList
|
||||
goList *common.ItemList
|
||||
jsonList *common.ItemList
|
||||
}
|
||||
|
||||
func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
this.obs = obs
|
||||
this.goList = NewFileList()
|
||||
this.jsonList = NewFileList()
|
||||
this.goList = common.NewItemList()
|
||||
this.jsonList = common.NewItemList()
|
||||
|
||||
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_GEN, theme.ContentCopyIcon(), nil)
|
||||
|
||||
@ -100,17 +96,17 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
form := widget.NewForm(
|
||||
widget.NewFormItem("服务地址", serverAddr),
|
||||
widget.NewFormItem("项目目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFolder(projectDir)
|
||||
openFolder(projectDir, toolWin.w)
|
||||
}), projectDir)),
|
||||
widget.NewFormItem("工作目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFolder(workDir)
|
||||
openFolder(workDir, toolWin.w)
|
||||
}), workDir)),
|
||||
widget.NewFormItem("LuBan Cli", client),
|
||||
widget.NewFormItem("输入目录", inputDir),
|
||||
widget.NewFormItem("输出Code目录", outputCodeDir),
|
||||
widget.NewFormItem("输出JSON目录", outputJsonDir),
|
||||
widget.NewFormItem("临时目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFolder(tmpDir)
|
||||
openFolder(tmpDir, toolWin.w)
|
||||
}), tmpDir)),
|
||||
widget.NewFormItem("生成类型", genType),
|
||||
)
|
||||
@ -148,10 +144,10 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
})
|
||||
|
||||
//go
|
||||
this.goList.titleLabel = widget.NewLabel("Go文件")
|
||||
this.goList.titleLabel.Hide()
|
||||
this.goList.TitleLabel = widget.NewLabel("Go文件")
|
||||
this.goList.TitleLabel.Hide()
|
||||
// 复选列表
|
||||
this.goList.itemList = this.goList.createList()
|
||||
this.goList.ItemList = this.goList.CreateDefaultCheckList()
|
||||
|
||||
// 覆盖 -go
|
||||
go_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
||||
@ -165,9 +161,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
go_overrideBtn.Disable()
|
||||
defer func() {
|
||||
go_overrideBtn.Enable()
|
||||
this.goList.itemList.Refresh()
|
||||
this.goList.ItemList.Refresh()
|
||||
}()
|
||||
for _, v := range this.goList.selItemIds {
|
||||
for _, v := range this.goList.SelItemIds {
|
||||
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go")
|
||||
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputCodeDir.Text, v)).Debug("copy go")
|
||||
_, err := common.Copy(filepath.Join(tmpDir.Text, "go", v),
|
||||
@ -176,9 +172,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
this.goList.deleteItem(v)
|
||||
this.goList.DeleteItem(v)
|
||||
}
|
||||
this.goList.changeFileCount()
|
||||
this.goList.ChangeFileCount()
|
||||
}
|
||||
|
||||
//取消checked
|
||||
@ -187,13 +183,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
go_allCancelBtn.Hide()
|
||||
go_allSelBtn.Show()
|
||||
}()
|
||||
this.goList.selItemIds = []string{}
|
||||
for i, v := range this.goList.cachedList.Items {
|
||||
this.goList.cachedList.Items[i].Checked = false
|
||||
this.goList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
this.goList.SelItemIds = []string{}
|
||||
for i, v := range this.goList.CachedList.Items {
|
||||
this.goList.CachedList.Items[i].Checked = false
|
||||
this.goList.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
}
|
||||
this.goList.changeFileCount()
|
||||
this.goList.itemList.Refresh()
|
||||
this.goList.ChangeFileCount()
|
||||
this.goList.ItemList.Refresh()
|
||||
}
|
||||
|
||||
//选择所有
|
||||
@ -202,21 +198,21 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
go_allCancelBtn.Show()
|
||||
go_allSelBtn.Hide()
|
||||
}()
|
||||
for i, v := range this.goList.cachedList.Items {
|
||||
this.goList.cachedList.Items[i].Checked = true
|
||||
this.goList.selItemIds = append(this.goList.selItemIds, v.Text)
|
||||
this.goList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
for i, v := range this.goList.CachedList.Items {
|
||||
this.goList.CachedList.Items[i].Checked = true
|
||||
this.goList.SelItemIds = append(this.goList.SelItemIds, v.Text)
|
||||
this.goList.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
}
|
||||
this.goList.changeFileCount()
|
||||
this.goList.ChangeFileCount()
|
||||
// this.goList.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.goList.selItemIds), this.goList.fileTotal))
|
||||
this.goList.itemList.Refresh()
|
||||
this.goList.ItemList.Refresh()
|
||||
}
|
||||
|
||||
// json
|
||||
this.jsonList.titleLabel = widget.NewLabel("Json文件")
|
||||
this.jsonList.titleLabel.Hide()
|
||||
this.jsonList.TitleLabel = widget.NewLabel("Json文件")
|
||||
this.jsonList.TitleLabel.Hide()
|
||||
// 复选列表
|
||||
this.jsonList.itemList = this.jsonList.createList()
|
||||
this.jsonList.ItemList = this.jsonList.CreateDefaultCheckList()
|
||||
|
||||
// 覆盖 -go
|
||||
json_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
||||
@ -228,9 +224,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
json_overrideBtn.Disable()
|
||||
defer func() {
|
||||
json_overrideBtn.Enable()
|
||||
this.jsonList.itemList.Refresh()
|
||||
this.jsonList.ItemList.Refresh()
|
||||
}()
|
||||
for _, v := range this.jsonList.selItemIds {
|
||||
for _, v := range this.jsonList.SelItemIds {
|
||||
// logrus.WithField("path1", filepath.Join(tmpDir.Text, "json", v)).Debug("copy json")
|
||||
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputJsonDir.Text, v)).Debug("copy json")
|
||||
_, err := common.Copy(filepath.Join(tmpDir.Text, "json", v),
|
||||
@ -239,9 +235,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
this.jsonList.deleteItem(v)
|
||||
this.jsonList.DeleteItem(v)
|
||||
}
|
||||
this.jsonList.changeFileCount()
|
||||
this.jsonList.ChangeFileCount()
|
||||
}
|
||||
|
||||
//取消checked
|
||||
@ -251,13 +247,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
json_allSelBtn.Show()
|
||||
}()
|
||||
list := this.jsonList
|
||||
list.selItemIds = []string{}
|
||||
for i, v := range list.cachedList.Items {
|
||||
list.cachedList.Items[i].Checked = false
|
||||
list.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
list.SelItemIds = []string{}
|
||||
for i, v := range list.CachedList.Items {
|
||||
list.CachedList.Items[i].Checked = false
|
||||
list.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
}
|
||||
this.jsonList.changeFileCount()
|
||||
list.itemList.Refresh()
|
||||
this.jsonList.ChangeFileCount()
|
||||
list.ItemList.Refresh()
|
||||
}
|
||||
|
||||
//选择所有
|
||||
@ -267,13 +263,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
json_allSelBtn.Hide()
|
||||
}()
|
||||
list := this.jsonList
|
||||
for i, v := range list.cachedList.Items {
|
||||
list.cachedList.Items[i].Checked = true
|
||||
list.selItemIds = append(list.selItemIds, v.Text)
|
||||
list.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
for i, v := range list.CachedList.Items {
|
||||
list.CachedList.Items[i].Checked = true
|
||||
list.SelItemIds = append(list.SelItemIds, v.Text)
|
||||
list.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
}
|
||||
list.changeFileCount()
|
||||
list.itemList.Refresh()
|
||||
list.ChangeFileCount()
|
||||
list.ItemList.Refresh()
|
||||
}
|
||||
|
||||
genBtn := &widget.Button{Text: "生成", Icon: theme.ConfirmIcon()}
|
||||
@ -316,17 +312,17 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
}
|
||||
|
||||
changeGo := func() {
|
||||
this.goList.changeItem(filepath.Join(tmpDir.Text, "go"), filepath.Join(projectDir.Text, outputCodeDir.Text))
|
||||
this.goList.titleLabel.SetText(fmt.Sprintf("(%d/%d个)", len(this.goList.selItemIds), this.goList.fileTotal))
|
||||
this.goList.ChangeItem(filepath.Join(tmpDir.Text, "go"), filepath.Join(projectDir.Text, outputCodeDir.Text))
|
||||
this.goList.TitleLabel.SetText(fmt.Sprintf("(%d/%d个)", len(this.goList.SelItemIds), this.goList.ItemTotal))
|
||||
go_overrideBtn.Show()
|
||||
this.goList.titleLabel.Show()
|
||||
this.goList.TitleLabel.Show()
|
||||
}
|
||||
|
||||
changeJson := func() {
|
||||
this.jsonList.changeItem(filepath.Join(tmpDir.Text, "json"), filepath.Join(projectDir.Text, outputJsonDir.Text))
|
||||
this.jsonList.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.jsonList.selItemIds), this.jsonList.fileTotal))
|
||||
this.jsonList.ChangeItem(filepath.Join(tmpDir.Text, "json"), filepath.Join(projectDir.Text, outputJsonDir.Text))
|
||||
this.jsonList.TitleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.jsonList.SelItemIds), this.jsonList.ItemTotal))
|
||||
json_overrideBtn.Show()
|
||||
this.jsonList.titleLabel.Show()
|
||||
this.jsonList.TitleLabel.Show()
|
||||
}
|
||||
|
||||
// 更新列表
|
||||
@ -360,13 +356,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
left := container.NewVBox(form, container.NewHBox(&layout.Spacer{}, desBtn, saveBtn, genBtn))
|
||||
right := container.NewGridWithColumns(2,
|
||||
container.NewBorder(
|
||||
container.NewHBox(go_allSelBtn, go_allCancelBtn, go_overrideBtn, widget.NewLabel("Go文件"), this.goList.titleLabel),
|
||||
container.NewHBox(go_allSelBtn, go_allCancelBtn, go_overrideBtn, widget.NewLabel("Go文件"), this.goList.TitleLabel),
|
||||
nil, nil, nil,
|
||||
this.goList.itemList),
|
||||
this.goList.ItemList),
|
||||
container.NewBorder(
|
||||
container.NewHBox(json_allSelBtn, json_allCancelBtn, json_overrideBtn, widget.NewLabel("Json文件"), this.jsonList.titleLabel),
|
||||
container.NewHBox(json_allSelBtn, json_allCancelBtn, json_overrideBtn, widget.NewLabel("Json文件"), this.jsonList.TitleLabel),
|
||||
nil, nil, nil,
|
||||
this.jsonList.itemList))
|
||||
this.jsonList.ItemList))
|
||||
|
||||
content.Objects = append(content.Objects, container.NewGridWithColumns(2, left, right))
|
||||
|
||||
@ -375,14 +371,14 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||
}
|
||||
|
||||
// 打开目录
|
||||
func openFolder(entry *widget.Entry) {
|
||||
func openFolder(entry *widget.Entry, w fyne.Window) {
|
||||
dConf := dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) {
|
||||
if lu == nil {
|
||||
return
|
||||
}
|
||||
entry.Text = lu.Path()
|
||||
entry.Refresh()
|
||||
}, toolWin.w)
|
||||
}, w)
|
||||
luri, _ := storage.ListerForURI(storage.NewFileURI("."))
|
||||
dConf.SetLocation(luri)
|
||||
dConf.SetConfirmText("打开")
|
||||
@ -391,155 +387,19 @@ func openFolder(entry *widget.Entry) {
|
||||
dConf.Show()
|
||||
}
|
||||
|
||||
type fileList struct {
|
||||
selItemIds []string //选择的ID
|
||||
fileTotal int //文件总数
|
||||
titleLabel *widget.Label
|
||||
cachedList List
|
||||
itemList *widget.List
|
||||
}
|
||||
|
||||
func NewFileList() *fileList {
|
||||
return &fileList{
|
||||
titleLabel: &widget.Label{},
|
||||
cachedList: NewList(""),
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fileList) reset() {
|
||||
f.fileTotal = 0
|
||||
f.selItemIds = []string{}
|
||||
f.cachedList = NewList("")
|
||||
}
|
||||
|
||||
func (f *fileList) createList() *widget.List {
|
||||
f.itemList = widget.NewList(
|
||||
func() int {
|
||||
return len(f.cachedList.Items)
|
||||
},
|
||||
func() fyne.CanvasObject {
|
||||
return widget.NewCheck("Template", func(bool) {})
|
||||
},
|
||||
func(id widget.ListItemID, item fyne.CanvasObject) {
|
||||
c, _ := item.(*widget.Check)
|
||||
c.Text = f.cachedList.Items[id].Text
|
||||
c.Checked = f.cachedList.Items[id].Checked
|
||||
|
||||
c.OnChanged = func(b bool) {
|
||||
if b {
|
||||
f.selItemIds = append(f.selItemIds, c.Text)
|
||||
} else {
|
||||
f.selItemIds = utils.DeleteString(f.selItemIds, c.Text)
|
||||
}
|
||||
f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.selItemIds), f.fileTotal))
|
||||
f.cachedList.Items[id].Checked = b
|
||||
// sort.Sort(f.cachedList)
|
||||
f.itemList.Refresh()
|
||||
}
|
||||
c.Refresh()
|
||||
},
|
||||
)
|
||||
return f.itemList
|
||||
}
|
||||
|
||||
func (f *fileList) addItem(val string) {
|
||||
val = strings.TrimSpace(val)
|
||||
if len(val) == 0 {
|
||||
func openFile(entry *widget.Entry, w fyne.Window) {
|
||||
dConf := dialog.NewFileOpen(func(lu fyne.URIReadCloser, err error) {
|
||||
if lu == nil {
|
||||
return
|
||||
}
|
||||
newItem := Item{
|
||||
Text: val,
|
||||
Quantity: 1,
|
||||
Checked: true, //默认选中
|
||||
}
|
||||
f.cachedList.Items = append(f.cachedList.Items, newItem)
|
||||
sort.Sort(f.cachedList)
|
||||
f.itemList.Refresh()
|
||||
}
|
||||
|
||||
func (f *fileList) deleteItem(name string) {
|
||||
for i, v := range f.cachedList.Items {
|
||||
if v.Text == name {
|
||||
f.selItemIds = utils.DeleteString(f.selItemIds, v.Text)
|
||||
f.cachedList.Items = append(f.cachedList.Items[:i], f.cachedList.Items[i+1:]...)
|
||||
if f.fileTotal > 0 {
|
||||
f.fileTotal--
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (f *fileList) loadItem(dirPath string) {
|
||||
f.reset()
|
||||
files, err := ioutil.ReadDir(dirPath)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, file := range files {
|
||||
if !file.IsDir() {
|
||||
f.addItem(file.Name())
|
||||
f.selItemIds = append(f.selItemIds, file.Name())
|
||||
f.fileTotal++
|
||||
logrus.Debugf("%v", file.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 改变列表项目
|
||||
func (f *fileList) changeItem(tmpDir, projectDir string) {
|
||||
f.fileTotal = 0
|
||||
f.selItemIds = []string{}
|
||||
f.cachedList = NewList("")
|
||||
tmpFiles, err := ioutil.ReadDir(tmpDir)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
defer func() {
|
||||
if len(tmpFiles) == 0 || len(f.cachedList.Items) == 0 {
|
||||
showTip("没有任何变更的文件,请确定SVN拉取最新文件")
|
||||
}
|
||||
}()
|
||||
|
||||
projectFiles, err := ioutil.ReadDir(projectDir)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
|
||||
pfMap := make(map[string]int64)
|
||||
for _, v := range projectFiles {
|
||||
if !v.IsDir() {
|
||||
pfMap[v.Name()] = v.ModTime().Unix()
|
||||
}
|
||||
}
|
||||
|
||||
for _, file := range tmpFiles {
|
||||
if !file.IsDir() {
|
||||
if pfTime, ok := pfMap[file.Name()]; ok {
|
||||
if file.ModTime().Unix() <= pfTime {
|
||||
continue
|
||||
}
|
||||
}
|
||||
f.addItem(file.Name())
|
||||
f.selItemIds = append(f.selItemIds, file.Name())
|
||||
f.fileTotal++
|
||||
logrus.Debugf("%v", file.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新文件数
|
||||
func (f *fileList) changeFileCount() {
|
||||
f.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(f.selItemIds), f.fileTotal))
|
||||
}
|
||||
|
||||
type CopyFiles struct {
|
||||
Dir string
|
||||
FileName string
|
||||
entry.SetText(lu.URI().Path())
|
||||
entry.Refresh()
|
||||
}, w)
|
||||
dConf.SetConfirmText("打开")
|
||||
dConf.SetDismissText("取消")
|
||||
dConf.SetFilter(storage.NewExtensionFileFilter([]string{".exe"}))
|
||||
dConf.Resize(fyne.NewSize(750, 500))
|
||||
dConf.Show()
|
||||
}
|
||||
|
||||
func (a *appGen) GetAppName() string {
|
||||
|
@ -54,7 +54,7 @@ func (this *appLock) LazyInit(obs observer.Observer) error {
|
||||
return
|
||||
}
|
||||
toolWin.w.Clipboard().SetContent(text.Text)
|
||||
showTip("已复制到剪贴板")
|
||||
common.ShowTip("已复制到剪贴板")
|
||||
})
|
||||
|
||||
c := container.NewVBox(title, input, text, btn, copybtn)
|
||||
|
@ -15,7 +15,6 @@ import (
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/data/binding"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/storage"
|
||||
@ -27,13 +26,11 @@ import (
|
||||
type appPbGen struct {
|
||||
appAdapter
|
||||
folderList *folderList
|
||||
folderChk *widget.List
|
||||
}
|
||||
|
||||
func (this *appPbGen) LazyInit(obs observer.Observer) error {
|
||||
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_PB, theme.ContentAddIcon(), nil)
|
||||
this.folderList = NewFolderList()
|
||||
this.folderChk = this.folderList.createList()
|
||||
|
||||
countLabel := widget.NewLabel("")
|
||||
|
||||
@ -155,12 +152,15 @@ func (this *appPbGen) LazyInit(obs observer.Observer) error {
|
||||
}
|
||||
logrus.Debug("save pb conf")
|
||||
}
|
||||
|
||||
this.folderList.itemList = this.folderList.createList()
|
||||
|
||||
// layout
|
||||
c := container.NewBorder(
|
||||
form,
|
||||
container.NewHBox(confBtn, genBtn, layout.NewSpacer(), countLabel), nil, nil,
|
||||
container.NewMax(
|
||||
container.NewVScroll(this.folderChk),
|
||||
container.NewVScroll(this.folderList.itemList),
|
||||
),
|
||||
)
|
||||
|
||||
@ -174,46 +174,47 @@ func (a *appPbGen) GetAppName() string {
|
||||
}
|
||||
|
||||
type folderList struct {
|
||||
dataBinding binding.UntypedList
|
||||
selItemIds []string //选择的ID
|
||||
itemListData *model.ItemModelList
|
||||
cachedList common.List
|
||||
itemList *widget.List
|
||||
fileTotal int //文件总数
|
||||
}
|
||||
|
||||
func NewFolderList() *folderList {
|
||||
return &folderList{
|
||||
dataBinding: binding.NewUntypedList(),
|
||||
cachedList: common.NewList(""),
|
||||
}
|
||||
}
|
||||
|
||||
func (f *folderList) createList() *widget.List {
|
||||
return widget.NewListWithData(f.dataBinding,
|
||||
func() fyne.CanvasObject {
|
||||
return container.NewHBox(
|
||||
// &widget.Check{Checked: true},
|
||||
widget.NewCheck("", func(b bool) {}),
|
||||
widget.NewLabelWithStyle("", fyne.TextAlignCenter, fyne.TextStyle{}),
|
||||
widget.NewLabel(""),
|
||||
)
|
||||
return widget.NewList(
|
||||
func() int {
|
||||
return len(f.cachedList.Items)
|
||||
},
|
||||
func(data binding.DataItem, item fyne.CanvasObject) {
|
||||
o, _ := data.(binding.Untyped).Get()
|
||||
pd := o.(*model.ItemModel)
|
||||
item.(*fyne.Container).Objects[0].(*widget.Check).OnChanged = func(b bool) {
|
||||
func() fyne.CanvasObject {
|
||||
return widget.NewCheck("Template", func(b bool) {})
|
||||
},
|
||||
func(id widget.ListItemID, item fyne.CanvasObject) {
|
||||
c, _ := item.(*widget.Check)
|
||||
im := f.cachedList.Items[id]
|
||||
c.Text = im.Text
|
||||
c.Checked = im.Checked
|
||||
|
||||
c.OnChanged = func(b bool) {
|
||||
if b {
|
||||
f.selItemIds = append(f.selItemIds, pd.Id)
|
||||
f.selItemIds = append(f.selItemIds, c.Text)
|
||||
} else {
|
||||
f.selItemIds = utils.DeleteString(f.selItemIds, pd.Id)
|
||||
f.selItemIds = utils.DeleteString(f.selItemIds, c.Text)
|
||||
}
|
||||
f.cachedList.Items[id].Checked = b
|
||||
f.itemList.Refresh()
|
||||
}
|
||||
item.(*fyne.Container).Objects[1].(*widget.Label).SetText(pd.Label)
|
||||
c.Refresh()
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (f *folderList) initItem(dir string) {
|
||||
f.itemListData = model.NewItemModelList()
|
||||
|
||||
files, err := ioutil.ReadDir(dir)
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
@ -225,23 +226,15 @@ func (f *folderList) initItem(dir string) {
|
||||
if file.Name() == ".vscode" {
|
||||
continue
|
||||
}
|
||||
fm := &model.ItemModel{
|
||||
Id: file.Name(),
|
||||
Label: file.Name(),
|
||||
fm := common.Item{
|
||||
Text: file.Name(),
|
||||
Checked: false,
|
||||
}
|
||||
f.itemListData.DataList = append(f.itemListData.DataList, fm)
|
||||
f.cachedList.Items = append(f.cachedList.Items, fm)
|
||||
// f.selItemIds = append(f.selItemIds, fm.Id)
|
||||
f.fileTotal++
|
||||
// logrus.Debugf("%v", fm.Id)
|
||||
}
|
||||
}
|
||||
|
||||
f.reloadListData()
|
||||
}
|
||||
|
||||
func (f *folderList) reloadListData() {
|
||||
if f.itemListData != nil {
|
||||
d := f.itemListData.AsInterfaceArray()
|
||||
f.dataBinding.Set(d)
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
"go_dreamfactory/cmd/v2/model"
|
||||
"go_dreamfactory/cmd/v2/service"
|
||||
"go_dreamfactory/cmd/v2/service/observer"
|
||||
"image/color"
|
||||
"math/rand"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
@ -32,16 +32,18 @@ type appTerm struct {
|
||||
obs observer.Observer
|
||||
sshService *service.SSHService
|
||||
|
||||
jsonList *fileList //json列表
|
||||
jsonList *common.ItemList //json列表
|
||||
cProgress *widget.ProgressBarInfinite //连接进度条进度条
|
||||
upProgress *widget.ProgressBar //上传进度条
|
||||
endProgress sync.WaitGroup
|
||||
|
||||
downloadList *common.ItemList //download列表
|
||||
}
|
||||
|
||||
func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
this.obs = obs
|
||||
this.sshService = &service.SSHService{}
|
||||
this.jsonList = NewFileList()
|
||||
this.jsonList = common.NewItemList()
|
||||
|
||||
//progress
|
||||
this.cProgress = widget.NewProgressBarInfinite()
|
||||
@ -84,7 +86,7 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
&widget.FormItem{Text: "用户名:", Widget: userName},
|
||||
passwordItem,
|
||||
widget.NewFormItem("Json目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFolder(localDir)
|
||||
openFolder(localDir, toolWin.w)
|
||||
}), localDir)),
|
||||
widget.NewFormItem("远程目录", remoteDir),
|
||||
)
|
||||
@ -112,6 +114,16 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
jsonDir := widget.NewEntry()
|
||||
jsonDir.PlaceHolder = "Json目录"
|
||||
|
||||
svnForm := widget.NewForm(
|
||||
&widget.FormItem{Text: "服务地址", Widget: lubanAddr},
|
||||
&widget.FormItem{Text: "工作目录", Widget: container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFolder(workDir, toolWin.w)
|
||||
}), workDir)},
|
||||
&widget.FormItem{Text: "LubanCli", Widget: lubanCli},
|
||||
&widget.FormItem{Text: "Data目录", Widget: dataDir},
|
||||
&widget.FormItem{Text: "JSON目录", Widget: jsonDir},
|
||||
)
|
||||
|
||||
//set input entry
|
||||
if sshConf != nil {
|
||||
ip.Text = sshConf.Ip
|
||||
@ -126,37 +138,40 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
lubanCli.Text = sshConf.LubanCli
|
||||
dataDir.Text = sshConf.DataDir
|
||||
jsonDir.Text = sshConf.JsonDir
|
||||
} else {
|
||||
sshConf = &model.SSHModel{
|
||||
Ip: "10.0.0.9",
|
||||
UserName: "root",
|
||||
Password: "Legu.cc()123",
|
||||
RemoteDir: "/home/liwei/go_dreamfactory/bin/json/",
|
||||
|
||||
ServerIp: "10.0.1.11",
|
||||
LubanCli: `Luban.Client\Luban.Client.exe`,
|
||||
DataDir: "Datas",
|
||||
JsonDir: `output\json`,
|
||||
}
|
||||
}
|
||||
|
||||
svnForm := widget.NewForm(
|
||||
&widget.FormItem{Text: "服务地址", Widget: lubanAddr},
|
||||
&widget.FormItem{Text: "工作目录", Widget: container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFolder(workDir)
|
||||
}), workDir)},
|
||||
&widget.FormItem{Text: "LubanCli", Widget: lubanCli},
|
||||
&widget.FormItem{Text: "Data目录", Widget: dataDir},
|
||||
&widget.FormItem{Text: "JSON目录", Widget: jsonDir},
|
||||
)
|
||||
|
||||
// 非明文显示
|
||||
// 解决文本没显示的问题
|
||||
passwordItem.Widget.Refresh()
|
||||
ip.Refresh()
|
||||
localDir.Refresh()
|
||||
workDir.Refresh()
|
||||
|
||||
// save func
|
||||
saveFunc := func() {
|
||||
if err := service.GetDbService().SaveSSHConf(&model.SSHModel{
|
||||
Ip: ip.Text,
|
||||
UserName: userName.Text,
|
||||
Password: password.Text,
|
||||
Port: port.Text,
|
||||
LocalDir: localDir.Text,
|
||||
RemoteDir: remoteDir.Text,
|
||||
////
|
||||
ServerIp: lubanAddr.Text,
|
||||
WorkDir: workDir.Text,
|
||||
LubanCli: lubanCli.Text,
|
||||
DataDir: dataDir.Text,
|
||||
JsonDir: jsonDir.Text,
|
||||
}); err != nil {
|
||||
sshConf.Ip = ip.Text
|
||||
sshConf.UserName = userName.Text
|
||||
sshConf.Password = password.Text
|
||||
sshConf.Port = port.Text
|
||||
sshConf.LocalDir = localDir.Text
|
||||
sshConf.RemoteDir = remoteDir.Text
|
||||
sshConf.ServerIp = lubanAddr.Text
|
||||
sshConf.WorkDir = workDir.Text
|
||||
sshConf.LubanCli = lubanCli.Text
|
||||
sshConf.DataDir = dataDir.Text
|
||||
sshConf.JsonDir = jsonDir.Text
|
||||
if err := service.GetDbService().SaveSSHConf(sshConf); err != nil {
|
||||
logrus.WithField("err", err).Debug("保存配置")
|
||||
}
|
||||
}
|
||||
@ -170,7 +185,11 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
syncBtn := &widget.Button{Text: "同步JSON", Icon: theme.ConfirmIcon()}
|
||||
refreshBtn := &widget.Button{Text: "刷新", Icon: theme.ViewRefreshIcon()}
|
||||
svnBtn := &widget.Button{Text: "SVN更新", Icon: theme.ConfirmIcon()}
|
||||
excelBtn := &widget.Button{Text: "更新Excel", Icon: theme.FolderIcon()}
|
||||
explorBtn := &widget.Button{Text: "资源管理器", Icon: theme.FolderIcon()}
|
||||
dlBtn := widget.NewButtonWithIcon("", theme.DownloadIcon(), nil)
|
||||
|
||||
searchEntry := widget.NewEntry()
|
||||
|
||||
// 全选/全取消
|
||||
allSelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()}
|
||||
@ -219,55 +238,64 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
connBtn.Enable()
|
||||
return
|
||||
} else {
|
||||
this.jsonList.loadItem(localDir.Text)
|
||||
this.jsonList.LoadItem(localDir.Text)
|
||||
|
||||
this.cProgress.Stop()
|
||||
this.cProgress.Hide()
|
||||
disConnBtn.Enable()
|
||||
syncBtn.Enable()
|
||||
this.upProgress.Hide()
|
||||
allCancelBtn.Hide()
|
||||
allSelBtn.Show()
|
||||
allCancelBtn.Show()
|
||||
allSelBtn.Hide()
|
||||
refreshBtn.Enable()
|
||||
dlBtn.Enable()
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新JSON列表
|
||||
refreshBtn.Disable()
|
||||
refreshBtn.OnTapped = func() {
|
||||
reloadItem := func() {
|
||||
defer func() {
|
||||
syncBtn.Enable()
|
||||
allSelBtn.Show()
|
||||
allCancelBtn.Hide()
|
||||
allSelBtn.Hide()
|
||||
allCancelBtn.Show()
|
||||
}()
|
||||
this.jsonList.loadItem(localDir.Text)
|
||||
this.jsonList.LoadItem(localDir.Text)
|
||||
}
|
||||
refreshBtn.OnTapped = reloadItem
|
||||
|
||||
disConnBtn.Disable()
|
||||
// 断开
|
||||
disConnBtn.Disable()
|
||||
disConnBtn.OnTapped = func() {
|
||||
defer func() {
|
||||
this.jsonList.reset()
|
||||
this.jsonList.Reset()
|
||||
connBtn.Enable()
|
||||
disConnBtn.Disable()
|
||||
syncBtn.Disable()
|
||||
allSelBtn.Hide()
|
||||
allCancelBtn.Show()
|
||||
refreshBtn.Disable()
|
||||
dlBtn.Disable()
|
||||
}()
|
||||
this.sshService.Close()
|
||||
}
|
||||
|
||||
//资源管理器
|
||||
explorBtn.OnTapped = func() {
|
||||
logrus.Debug(localDir.Text)
|
||||
openExplor := func(dir string) {
|
||||
if runtime.GOOS == "windows" {
|
||||
if err := exec.Command("explorer", filepath.Join(localDir.Text)).Start(); err != nil {
|
||||
dialog.ShowError(err, toolWin.w)
|
||||
dialog.ShowError(errors.WithMessage(err, "请确认Json目录是否填写正确"), toolWin.w)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
explorBtn.OnTapped = func() {
|
||||
// logrus.Debug(localDir.Text)
|
||||
if localDir.Text == "" {
|
||||
common.ShowTip("Json目录必须填写")
|
||||
} else {
|
||||
openExplor(localDir.Text)
|
||||
}
|
||||
}
|
||||
|
||||
//使用说明
|
||||
@ -302,7 +330,7 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
* 服务地址:10.0.1.11 (保持一致)
|
||||
* 工作目录:svn下ExcelFile目录全路径
|
||||
* LubanCli:Luban.Client\Luban.Client.exe (保持一致)
|
||||
* Datas:Datas(保持一致)
|
||||
* Data目录:Datas(保持一致)
|
||||
* JSON目录:output\json(保持一致)
|
||||
* 全部填写完点击【保存配置】
|
||||
* 点击【SVN更新】生成json文件
|
||||
@ -317,22 +345,17 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
|
||||
//同步JSON
|
||||
syncBtn.Disable()
|
||||
syncBtn.OnTapped = func() {
|
||||
syncBtn.Disable()
|
||||
syncNext := func() {
|
||||
defer func() {
|
||||
syncBtn.Enable()
|
||||
this.upProgress.Hide()
|
||||
dialog.ShowConfirm("提示", "所有文件均上传完毕,静等1-2分钟", func(b bool) {}, toolWin.w)
|
||||
}()
|
||||
|
||||
if this.sshService.Client == nil {
|
||||
dialog.ShowError(errors.New("请先连接终端"), toolWin.w)
|
||||
return
|
||||
}
|
||||
|
||||
syncBtn.Disable()
|
||||
this.upProgress.Show()
|
||||
this.upProgress.SetValue(0)
|
||||
|
||||
len := len(this.jsonList.selItemIds)
|
||||
len := len(this.jsonList.SelItemIds)
|
||||
num := 0.0
|
||||
|
||||
increment := func(wg *sync.WaitGroup) {
|
||||
@ -341,33 +364,67 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
for _, fileName := range this.jsonList.selItemIds {
|
||||
for _, fileName := range this.jsonList.SelItemIds {
|
||||
this.endProgress.Add(1)
|
||||
go func(fn string) {
|
||||
time.Sleep(time.Second * time.Duration(rand.Intn(3)))
|
||||
// time.Sleep(time.Second * time.Duration(rand.Intn(3)))
|
||||
if err := this.sshService.ScpCopy(filepath.Join(localDir.Text, fn), remoteDir.Text); err != nil {
|
||||
logrus.WithField("err", err).Error("同步json")
|
||||
showTip(err.Error())
|
||||
common.ShowTip(err.Error())
|
||||
}
|
||||
increment(&this.endProgress)
|
||||
// 移除已上传的
|
||||
this.jsonList.deleteItem(fn)
|
||||
this.jsonList.DeleteItem(fn)
|
||||
common.ShowTip(fmt.Sprintf("%s 成功上传", fn))
|
||||
}(fileName)
|
||||
}
|
||||
this.endProgress.Wait()
|
||||
this.upProgress.SetValue(1)
|
||||
}
|
||||
syncBtn.OnTapped = func() {
|
||||
if this.sshService.Client == nil {
|
||||
dialog.ShowError(errors.New("请先连接终端"), toolWin.w)
|
||||
return
|
||||
}
|
||||
|
||||
//SVN更新提示
|
||||
dc := dialog.NewConfirm("提示", "是否要进行SVN更新?", func(b bool) {
|
||||
if b {
|
||||
common.ShowTip("单击【SVN更新】按钮进行更新")
|
||||
svnBtn.FocusGained()
|
||||
return
|
||||
} else {
|
||||
if len(this.jsonList.SelItemIds) == 0 {
|
||||
common.ShowTip("没有选择任何文件,或尝试点击【刷新】")
|
||||
return
|
||||
}
|
||||
syncNext()
|
||||
}
|
||||
}, toolWin.w)
|
||||
dc.SetConfirmText("必须的")
|
||||
dc.SetDismissText("我拿生命担保无需更新")
|
||||
dc.Show()
|
||||
}
|
||||
|
||||
// excel更新
|
||||
excelBtn.OnTapped = func() {
|
||||
if workDir.Text == "" {
|
||||
common.ShowTip("工作目录必须填写")
|
||||
} else {
|
||||
openExplor(workDir.Text)
|
||||
}
|
||||
}
|
||||
|
||||
// SVN更新
|
||||
svnBtn.OnTapped = func() {
|
||||
this.cProgress.Show()
|
||||
this.cProgress.Start()
|
||||
svnBtn.Disable()
|
||||
svnNext := func() {
|
||||
defer func() {
|
||||
this.cProgress.Hide()
|
||||
this.cProgress.Stop()
|
||||
svnBtn.Enable()
|
||||
}()
|
||||
svnBtn.Disable()
|
||||
this.cProgress.Show()
|
||||
this.cProgress.Start()
|
||||
commandStr := `%s -h %s -j cfg -- -d %s --input_data_dir %s --output_data_dir %s --gen_types data_json -s server`
|
||||
arg := fmt.Sprintf(commandStr,
|
||||
filepath.Join(workDir.Text, lubanCli.Text),
|
||||
@ -384,6 +441,22 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
return
|
||||
}
|
||||
}
|
||||
svnBtn.OnTapped = func() {
|
||||
|
||||
//提示更新excel
|
||||
dc := dialog.NewConfirm("提示", "是否要更新excel?", func(b bool) {
|
||||
if b {
|
||||
//打开资源管理器
|
||||
openExplor(workDir.Text)
|
||||
return
|
||||
} else {
|
||||
svnNext()
|
||||
}
|
||||
}, toolWin.w)
|
||||
dc.SetConfirmText("必须的")
|
||||
dc.SetDismissText("我拿生命担保无需更新")
|
||||
dc.Show()
|
||||
}
|
||||
|
||||
// 全部取消
|
||||
allCancelBtn.OnTapped = func() {
|
||||
@ -391,36 +464,73 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||
allCancelBtn.Hide()
|
||||
allSelBtn.Show()
|
||||
}()
|
||||
for i, v := range this.jsonList.cachedList.Items {
|
||||
this.jsonList.cachedList.Items[i].Checked = true
|
||||
this.jsonList.selItemIds = append(this.jsonList.selItemIds, v.Text)
|
||||
this.jsonList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
for i, v := range this.jsonList.CachedList.Items {
|
||||
this.jsonList.CachedList.Items[i].Checked = true
|
||||
this.jsonList.SelItemIds = append(this.jsonList.SelItemIds, v.Text)
|
||||
this.jsonList.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
}
|
||||
this.jsonList.itemList.Refresh()
|
||||
this.jsonList.ItemList.Refresh()
|
||||
}
|
||||
|
||||
// 全选
|
||||
allSelBtn.OnTapped = func() {
|
||||
defer func() {
|
||||
allCancelBtn.Show()
|
||||
allSelBtn.Hide()
|
||||
}()
|
||||
this.jsonList.selItemIds = []string{}
|
||||
for i, v := range this.jsonList.cachedList.Items {
|
||||
this.jsonList.cachedList.Items[i].Checked = false
|
||||
this.jsonList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
this.jsonList.SelItemIds = []string{}
|
||||
for i, v := range this.jsonList.CachedList.Items {
|
||||
this.jsonList.CachedList.Items[i].Checked = false
|
||||
this.jsonList.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||
}
|
||||
// this.jsonList.changeFileCount()
|
||||
this.jsonList.itemList.Refresh()
|
||||
this.jsonList.ItemList.Refresh()
|
||||
}
|
||||
|
||||
// 搜索
|
||||
searchEntry.PlaceHolder = "搜索"
|
||||
searchEntry.OnChanged = func(s string) {
|
||||
if this.sshService.Client == nil {
|
||||
dialog.ShowError(errors.New("请先连接终端"), toolWin.w)
|
||||
return
|
||||
}
|
||||
if s == "" {
|
||||
reloadItem()
|
||||
} else {
|
||||
// go func() {
|
||||
newList := []common.Item{}
|
||||
for _, v := range this.jsonList.SearchItem {
|
||||
if strings.Contains(v.Text, s) {
|
||||
newList = append(newList, v)
|
||||
}
|
||||
}
|
||||
this.jsonList.CachedList.Items = newList
|
||||
this.jsonList.ItemList.Refresh()
|
||||
// }()
|
||||
}
|
||||
}
|
||||
|
||||
// 下载日志
|
||||
dlBtn.Disable()
|
||||
dlBtn.OnTapped = func() {
|
||||
w := this.createDownloadWindow()
|
||||
w.Show()
|
||||
w.SetCloseIntercept(func() {
|
||||
dlBtn.Enable()
|
||||
w.Close()
|
||||
})
|
||||
dlBtn.Disable()
|
||||
}
|
||||
|
||||
// 创建json列表
|
||||
this.jsonList.itemList = this.jsonList.createList()
|
||||
this.jsonList.ItemList = this.jsonList.CreateDefaultCheckList()
|
||||
|
||||
btns1 := container.NewHBox(helpBtn1, &layout.Spacer{}, saveBtn1, connBtn, disConnBtn)
|
||||
btns2 := container.NewHBox(helpBtn2, &layout.Spacer{}, saveBtn2, svnBtn)
|
||||
btns1 := container.NewHBox(helpBtn1, dlBtn, &layout.Spacer{}, saveBtn1, connBtn, disConnBtn)
|
||||
btns2 := container.NewHBox(helpBtn2, &layout.Spacer{}, saveBtn2, excelBtn, svnBtn)
|
||||
|
||||
split := container.NewHSplit(container.NewVBox(canvas.NewText("---只能在非上产环境!!!同步Json的操作仅限于数值热更,非结构热更---", color.RGBA{255, 0, 0, 255}), configForm,
|
||||
btns1, svnForm, btns2, this.cProgress), container.NewBorder(container.NewHBox(allCancelBtn, allSelBtn, syncBtn, refreshBtn, explorBtn), nil, nil, nil, this.jsonList.itemList))
|
||||
btns1, svnForm, btns2, this.cProgress), container.NewBorder(
|
||||
container.NewBorder(nil, nil, container.NewHBox(allCancelBtn, allSelBtn, syncBtn, refreshBtn), container.NewHBox(explorBtn), searchEntry),
|
||||
nil, nil, nil, this.jsonList.ItemList))
|
||||
split.Offset = 0.45
|
||||
content.Objects = append(content.Objects, container.NewBorder(nil, this.upProgress, nil, nil, split))
|
||||
|
||||
@ -433,6 +543,19 @@ func (a *appTerm) GetAppName() string {
|
||||
return common.TOOLBAR_TERM
|
||||
}
|
||||
|
||||
func OpenExplor(dir string) {
|
||||
if dir == "" {
|
||||
common.ShowTip("资源管理器路径错误")
|
||||
return
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
if err := exec.Command("explorer", filepath.Join(dir)).Start(); err != nil {
|
||||
dialog.ShowError(errors.WithMessage(err, "请确认Json目录是否填写正确"), toolWin.w)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (a *appTerm) OnClose() bool {
|
||||
dialog.ShowConfirm("关闭终端", "你希望断开连接吗?", func(b bool) {
|
||||
if !b {
|
||||
@ -444,3 +567,202 @@ func (a *appTerm) OnClose() bool {
|
||||
}, toolWin.w)
|
||||
return true
|
||||
}
|
||||
|
||||
func (a *appTerm) createDownloadWindow() fyne.Window {
|
||||
w := toolWin.app.NewWindow("日志")
|
||||
|
||||
a.downloadList = common.NewItemList()
|
||||
|
||||
a.downloadList.ItemList = a.downloadList.CreateDownloadList()
|
||||
|
||||
remoteLogDirEntry := widget.NewEntry()
|
||||
remoteLogDirEntry.PlaceHolder = "下载到"
|
||||
remoteLogDirEntry.Text = "/home/liwei/go_dreamfactory/bin/log/"
|
||||
|
||||
saveDirEntry := widget.NewEntry()
|
||||
saveDirEntry.PlaceHolder = "保存目录"
|
||||
|
||||
editorEntry := widget.NewEntry()
|
||||
editorEntry.PlaceHolder = "编辑器可执行文件路径"
|
||||
|
||||
// config
|
||||
confForm := widget.NewForm(
|
||||
widget.NewFormItem("远程目录", remoteLogDirEntry),
|
||||
widget.NewFormItem("下载目录", saveDirEntry),
|
||||
widget.NewFormItem("编辑器", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||
openFile(editorEntry, w)
|
||||
}), editorEntry)),
|
||||
)
|
||||
|
||||
// 进度条
|
||||
downloadProgress := widget.NewProgressBarInfinite()
|
||||
|
||||
var sshConf *model.SSHModel
|
||||
defer func() {
|
||||
downloadProgress.Hide()
|
||||
//加载配置
|
||||
sshConf = service.GetDbService().GetSSHConf(common.BUCKET_SSHCONF)
|
||||
if sshConf != nil {
|
||||
if sshConf.LogDir == "" {
|
||||
remoteLogDirEntry.Text = "/home/liwei/go_dreamfactory/bin/log/"
|
||||
} else {
|
||||
remoteLogDirEntry.Text = sshConf.LogDir
|
||||
}
|
||||
|
||||
saveDirEntry.Text = sshConf.SaveDir
|
||||
editorEntry.Text = sshConf.Editor
|
||||
} else {
|
||||
sshConf = &model.SSHModel{}
|
||||
}
|
||||
|
||||
remoteLogDirEntry.Refresh()
|
||||
saveDirEntry.Refresh()
|
||||
editorEntry.Refresh()
|
||||
|
||||
//load list
|
||||
if remoteLogDirEntry.Text == "" {
|
||||
return
|
||||
}
|
||||
files, err := a.sshService.GetRemoteDir(remoteLogDirEntry.Text)
|
||||
if err != nil {
|
||||
dialog.ShowError(err, toolWin.w)
|
||||
return
|
||||
}
|
||||
|
||||
for _, f := range files {
|
||||
a.downloadList.AddItem(common.Item{Text: f.FileName, Size: f.Size})
|
||||
}
|
||||
}()
|
||||
|
||||
//下载
|
||||
allDownloadBtn := widget.NewButtonWithIcon("下载", theme.DownloadIcon(), nil)
|
||||
DownloadDirBtn := widget.NewButtonWithIcon("打开下载目录", theme.FolderIcon(), nil)
|
||||
EditorBtn := widget.NewButtonWithIcon("打开编辑器", theme.FolderIcon(), nil)
|
||||
saveConfBtn := widget.NewButtonWithIcon("保存配置", theme.DocumentSaveIcon(), func() {
|
||||
// 保存配置
|
||||
sshConf.LogDir = remoteLogDirEntry.Text
|
||||
sshConf.SaveDir = saveDirEntry.Text
|
||||
sshConf.Editor = editorEntry.Text
|
||||
if err := service.GetDbService().SaveSSHConf(sshConf); err != nil {
|
||||
logrus.WithField("err", err).Debug("保存日志配置")
|
||||
}
|
||||
})
|
||||
|
||||
allSelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()}
|
||||
allCancelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
||||
allSelBtn.Hide()
|
||||
|
||||
// 全部取消
|
||||
allCancelBtn.OnTapped = func() {
|
||||
defer func() {
|
||||
allCancelBtn.Hide()
|
||||
allSelBtn.Show()
|
||||
}()
|
||||
dlist := a.downloadList
|
||||
for i, v := range dlist.CachedList.Items {
|
||||
dlist.CachedList.Items[i].Checked = true
|
||||
dlist.SelItemIds = append(dlist.SelItemIds, v.Text)
|
||||
dlist.ItemList.UpdateItem(i, container.NewHBox(
|
||||
widget.NewCheck(v.Text, nil),
|
||||
&layout.Spacer{},
|
||||
widget.NewLabel(common.ConvertFileSize(v.Size))))
|
||||
}
|
||||
dlist.ItemList.Refresh()
|
||||
}
|
||||
|
||||
// 全选
|
||||
allSelBtn.OnTapped = func() {
|
||||
defer func() {
|
||||
allCancelBtn.Show()
|
||||
allSelBtn.Hide()
|
||||
}()
|
||||
dlist := a.downloadList
|
||||
dlist.SelItemIds = []string{}
|
||||
for i, v := range dlist.CachedList.Items {
|
||||
dlist.CachedList.Items[i].Checked = false
|
||||
dlist.ItemList.UpdateItem(i, container.NewHBox(
|
||||
widget.NewCheck(v.Text, nil),
|
||||
&layout.Spacer{},
|
||||
widget.NewLabel(common.ConvertFileSize(v.Size))))
|
||||
}
|
||||
dlist.ItemList.Refresh()
|
||||
}
|
||||
|
||||
// 打开下载目录
|
||||
DownloadDirBtn.OnTapped = func() {
|
||||
OpenExplor(saveDirEntry.Text)
|
||||
}
|
||||
|
||||
EditorBtn.OnTapped = func() {
|
||||
if editorEntry.Text == "" {
|
||||
common.ShowTip("请配置编辑器")
|
||||
return
|
||||
}
|
||||
if runtime.GOOS == "windows" {
|
||||
for _, v := range a.downloadList.SelItemIds {
|
||||
if err := exec.Command(editorEntry.Text, filepath.Join(saveDirEntry.Text, v)).Start(); err != nil {
|
||||
dialog.ShowError(errors.WithMessage(err, "请确认编辑器目录是否填写正确"), toolWin.w)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//使用说明
|
||||
helpBtn := widget.NewButtonWithIcon("", theme.QuestionIcon(), func() {
|
||||
quesWin := fyne.CurrentApp().NewWindow("日志使用说明")
|
||||
quesWin.SetContent(widget.NewRichTextFromMarkdown(
|
||||
`
|
||||
* 下载远程服务日志到本地分析
|
||||
* 提示:
|
||||
* 远程目录 (保持一致)
|
||||
* 下载目录:填写本地任意目录
|
||||
* 编辑器:选择已安装的编辑器(例如:notepad++、Sublime)
|
||||
* 操作:
|
||||
* 选择文件,点击【打开编辑器】
|
||||
`))
|
||||
quesWin.Resize(fyne.NewSize(350, 200))
|
||||
quesWin.SetFixedSize(true)
|
||||
quesWin.CenterOnScreen()
|
||||
quesWin.Show()
|
||||
})
|
||||
|
||||
var wg sync.WaitGroup
|
||||
//download
|
||||
allDownloadBtn.OnTapped = func() {
|
||||
downloadProgress.Show()
|
||||
downloadProgress.Start()
|
||||
selItems := a.downloadList.SelItemIds
|
||||
if len(selItems) == 0 {
|
||||
common.ShowTip("请选择下载的文件")
|
||||
return
|
||||
} else {
|
||||
for _, item := range selItems {
|
||||
wg.Add(1)
|
||||
go func(name string) {
|
||||
defer func() {
|
||||
downloadProgress.Hide()
|
||||
wg.Done()
|
||||
}()
|
||||
logrus.WithField("filepath", remoteLogDirEntry.Text+name).Debug("下载")
|
||||
if err := a.sshService.ScpDownload(saveDirEntry.Text, remoteLogDirEntry.Text+name); err != nil {
|
||||
common.ShowTip(name + " 下载失败")
|
||||
}
|
||||
}(item)
|
||||
}
|
||||
wg.Wait()
|
||||
}
|
||||
}
|
||||
|
||||
btns := container.NewHBox(allSelBtn, allCancelBtn, allDownloadBtn, DownloadDirBtn, EditorBtn, helpBtn)
|
||||
//toolbar
|
||||
toolbar := container.NewBorder(nil, btns, nil, saveConfBtn, confForm)
|
||||
|
||||
//layout
|
||||
w.SetContent(container.NewBorder(toolbar, downloadProgress, nil, nil, a.downloadList.ItemList))
|
||||
|
||||
w.Resize(fyne.NewSize(800, 450))
|
||||
w.CenterOnScreen()
|
||||
return w
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/cmd/v2/lib/common"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
@ -64,7 +65,7 @@ func NewToolWindow(ui *UIImpl, parent fyne.Window) ToolWindow {
|
||||
}
|
||||
|
||||
func (ui *ToolWindowImpl) CreateWindow(title string, width, height float32, _ bool) {
|
||||
w := ui.app.NewWindow(title)
|
||||
w := ui.app.NewWindow(fmt.Sprintf("工具箱 %s %s", title, ui.app.Metadata().Version))
|
||||
ui.AddWindow("tool", w)
|
||||
ui.w = w
|
||||
|
||||
|
@ -45,7 +45,7 @@ func (this *toyUserInfo) Init(obs observer.Observer) error {
|
||||
this.copyBtn = widget.NewButtonWithIcon("", theme.ContentCopyIcon(), func() {
|
||||
if this.userInfo != nil && this.userInfo.DbUser != nil {
|
||||
_ = clipboard.WriteAll(this.userInfo.DbUser.Uid)
|
||||
showTip("已复制UID到剪贴板")
|
||||
common.ShowTip("已复制UID到剪贴板")
|
||||
}
|
||||
})
|
||||
this.copyBtn.Disable()
|
||||
@ -115,7 +115,10 @@ func (this *toyUserInfo) dataListener() {
|
||||
_ = this.data.Append(this.getActiveWeek()) //11
|
||||
_ = this.data.Append(this.getFriendPoint()) //12
|
||||
_ = this.data.Append(this.getModiNameCount()) //13
|
||||
_ = this.data.Append(this.getSign()) //14
|
||||
_ = this.data.Append(this.getCreateTime())
|
||||
_ = this.data.Append(this.getSign())
|
||||
|
||||
this.setProp(2, common.USERINFO_NAME, this.userInfo.DbUser.Name)
|
||||
},
|
||||
})
|
||||
|
||||
@ -155,7 +158,6 @@ func (this *toyUserInfo) dataListener() {
|
||||
this.setProp(11, common.USERINFO_ACTIVE_WEEK, rsp.Ex.Activeweek)
|
||||
this.setProp(12, common.USERINFO_FRIENDPOINT, rsp.Ex.FriendPoint)
|
||||
this.setProp(13, common.USERINFO_MODINAME, rsp.Ex.ModifynameCount)
|
||||
this.setProp(14, common.USERINFO_SIGN, rsp.Ex.Sign)
|
||||
}
|
||||
},
|
||||
})
|
||||
@ -171,9 +173,9 @@ func (this *toyUserInfo) dataListener() {
|
||||
logrus.Error("unmarshal err")
|
||||
return
|
||||
}
|
||||
this.setProp(6, common.USERINFO_GOLD, rsp.Gold)
|
||||
this.setProp(7, common.USERINFO_EXP, rsp.Exp)
|
||||
this.setProp(8, common.USERINFO_DIAMOND, rsp.Diamond)
|
||||
// this.setProp(6, common.USERINFO_GOLD, rsp.Gold)
|
||||
// this.setProp(7, common.USERINFO_EXP, rsp.Exp)
|
||||
// this.setProp(8, common.USERINFO_DIAMOND, rsp.Diamond)
|
||||
}
|
||||
// listener exp
|
||||
// if data.Msg.MainType == string(comm.ModuleUser) &&
|
||||
@ -186,9 +188,13 @@ func (this *toyUserInfo) dataListener() {
|
||||
}
|
||||
|
||||
func (this *toyUserInfo) setProp(idx int, label string, val interface{}) {
|
||||
// v, _ := this.data.GetValue(idx)
|
||||
// if v != "" {
|
||||
logrus.WithFields(logrus.Fields{"idx": idx, "lbl": label, "val": val}).Debug("更新Prop")
|
||||
if err := this.data.SetValue(idx, fmt.Sprintf("%-3s\t: %v", label, val)); err != nil {
|
||||
logrus.WithFields(logrus.Fields{"idx": idx, "val": val}).Error(err)
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
func (this *toyUserInfo) getAcc() string {
|
||||
@ -265,3 +271,13 @@ func (this *toyUserInfo) getSign() string {
|
||||
}
|
||||
return fmt.Sprintf("%-3s\t: %s", common.USERINFO_SIGN, cast.ToString(this.userInfo.DbUserExpand.Sign))
|
||||
}
|
||||
|
||||
func (this *toyUserInfo) getCreateTime() string {
|
||||
ctime := this.userInfo.DbUser.Ctime
|
||||
if ctime <= 0 {
|
||||
return ""
|
||||
}
|
||||
tt := time.Unix(ctime, 0)
|
||||
|
||||
return fmt.Sprintf("%-3s\t: %s", common.USERINFO_CREATETM, tt.Format(time.RFC3339))
|
||||
}
|
||||
|
@ -21,15 +21,14 @@ import (
|
||||
)
|
||||
|
||||
type TaskListView struct {
|
||||
ListBaseView
|
||||
BaseformView
|
||||
itemList common.ItemList
|
||||
}
|
||||
|
||||
func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
// init required
|
||||
this.initItemList()
|
||||
this.itemList = *common.NewItemList()
|
||||
|
||||
// create friend list view
|
||||
this.createItemList()
|
||||
this.itemList.ItemList = this.itemList.CreateList()
|
||||
|
||||
// select widget
|
||||
tagSelect := getTaskTagSelect()
|
||||
@ -46,20 +45,20 @@ func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||
|
||||
// task receive button
|
||||
receiveBtn := widget.NewButtonWithIcon("任务领取", theme.ConfirmIcon(), func() {
|
||||
if len(this.selItemIds) != 1 {
|
||||
if len(this.itemList.SelItemIds) != 1 {
|
||||
dialog.ShowError(errors.New("请选择一项"), this.w)
|
||||
return
|
||||
}
|
||||
if err := service.GetPttService().SendToClient(
|
||||
t.MainType, "receive",
|
||||
&pb.TaskReceiveReq{Id: this.selItemIds[0], TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
&pb.TaskReceiveReq{Id: this.itemList.SelItemIds[0], TaskTag: cast.ToInt32(tagSelect.Selected)}); err != nil {
|
||||
logrus.Error(err)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
// layout
|
||||
split := container.NewHSplit(this.dataListWidget, container.NewVBox(this.form, taskListBtn, receiveBtn))
|
||||
split := container.NewHSplit(this.itemList.ItemList, container.NewVBox(this.form, taskListBtn, receiveBtn))
|
||||
split.Offset = 1
|
||||
|
||||
//data listener for
|
||||
@ -83,15 +82,15 @@ func (this *TaskListView) dataListener() {
|
||||
return
|
||||
}
|
||||
|
||||
this.itemListData = model.NewItemModelList()
|
||||
this.itemList.Reset()
|
||||
|
||||
for _, v := range rsp.List {
|
||||
fm := &model.ItemModel{
|
||||
item := common.Item{
|
||||
Id: cast.ToString(v.Id),
|
||||
Label: fmt.Sprintf("%s S:%d R:%d", cast.ToString(v.TaskId), v.Status, v.Received),
|
||||
Text: fmt.Sprintf("%s 是否完成:%d 是否领奖:%d 进度:%d", cast.ToString(v.TaskId), v.Status, v.Received, v.Progress),
|
||||
}
|
||||
this.itemListData.DataList = append(this.itemListData.DataList, fm)
|
||||
this.itemList.AddItem(item)
|
||||
}
|
||||
this.reloadListData()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -85,3 +85,5 @@ func testdefer(data *[]int) {
|
||||
}()
|
||||
*data = append(*data, 0)
|
||||
}
|
||||
|
||||
// 3
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"go_dreamfactory/lego/base"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/event"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/lego/utils/codec/json"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
@ -74,8 +75,9 @@ func (this *Chat) OnInstallComp() {
|
||||
|
||||
//Event------------------------------------------------------------------------------------------------------------
|
||||
func (this *Chat) EventUserOffline(session comm.IUserSession) {
|
||||
err := this.modelChat.RemoveCrossChannelMember(session)
|
||||
this.Debugf("EventUserOffline:%s err:%v", session, err)
|
||||
if err := this.modelChat.RemoveCrossChannelMember(session); err != nil {
|
||||
this.Debug("EventUserOffline:", log.Field{"uid", session.GetUserId()}, log.Field{"err", err})
|
||||
}
|
||||
}
|
||||
|
||||
//对外接口----------------------------------------------------------------------------------------------------------
|
||||
|
@ -3,6 +3,7 @@ package gm
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
@ -69,8 +70,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
}, true)
|
||||
if code == pb.ErrorCode_Success { // 成功直接返回
|
||||
session.SendMsg(string(this.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true})
|
||||
return
|
||||
}
|
||||
this.Debug("使用bingo命令", log.Field{"uid", session.GetUserId()}, log.Field{"A", datas[0]}, log.Field{"T", datas[1]}, log.Field{"N", int32(num)})
|
||||
} else if len(datas) == 2 && (datas[0] == "mapid") {
|
||||
module1, err := this.service.GetModule(comm.ModuleMainline)
|
||||
if err != nil {
|
||||
@ -82,6 +83,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
return
|
||||
}
|
||||
code = module1.(comm.IMainline).ModifyMainlineData(session.GetUserId(), int32(num))
|
||||
this.Debug("使用bingo命令", log.Field{"uid", session.GetUserId()}, log.Field{"0", datas[0]}, log.Field{"N", int32(num)})
|
||||
} else if len(datas) == 2 && (datas[0] == "pataid") {
|
||||
module1, err := this.service.GetModule(comm.ModulePagoda)
|
||||
if err != nil {
|
||||
@ -93,6 +95,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
return
|
||||
}
|
||||
code = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(num))
|
||||
this.Debug("使用bingo命令", log.Field{"uid", session.GetUserId()}, log.Field{"0", datas[0]}, log.Field{"N", int32(num)})
|
||||
} else if len(datas) == 1 && (datas[0] == "Iamyoudad" || datas[0] == "iamyoudad") {
|
||||
var (
|
||||
res []*cfg.Gameatn
|
||||
@ -107,6 +110,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
||||
this.Errorf("资源发放失败,%v", code)
|
||||
}
|
||||
}
|
||||
this.Debugf("使用bingo命令", log.Field{"uid", session.GetUserId()}, datas[0], res)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package library
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/lego/sys/log"
|
||||
"go_dreamfactory/modules"
|
||||
@ -9,27 +10,58 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
game_libraryhero = "game_libraryhero.json"
|
||||
game_libraryfetter = "game_libraryfetter.json"
|
||||
game_libraryhero = "game_libraryhero.json" // 英雄对应的羁绊id信息
|
||||
game_libraryfetter = "game_libraryfetter.json" // 羁绊信息表
|
||||
game_libraryhistory = "game_libraryhistory.json" // 往事id 对应的奖励
|
||||
game_libraryfavor = "game_libraryfavor.json" // 英雄好感度升级所需的经验
|
||||
game_librarystory = "game_librarystory.json" // 羁绊id对应剧情奖励
|
||||
)
|
||||
|
||||
///配置管理基础组件
|
||||
type configureComp struct {
|
||||
modules.MCompConfigure
|
||||
fetter map[int64]*cfg.GameLibraryFetterData
|
||||
}
|
||||
|
||||
//组件初始化接口
|
||||
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.LoadConfigure(game_libraryhero, cfg.NewGameLibraryHero)
|
||||
err = this.LoadMultiConfigure(map[string]interface{}{
|
||||
game_libraryhero: cfg.NewGameLibraryHero,
|
||||
game_libraryfetter: cfg.NewGameLibraryFetter,
|
||||
game_libraryhistory: cfg.NewGameLibraryHistory,
|
||||
game_libraryfavor: cfg.NewGameLibraryFavor,
|
||||
game_librarystory: cfg.NewGameLibraryStory,
|
||||
})
|
||||
|
||||
this.fetter = make(map[int64]*cfg.GameLibraryFetterData, 0)
|
||||
|
||||
configure.RegisterConfigure(game_libraryfetter, cfg.NewGameLibraryFetter, this.SetLibraryFetter)
|
||||
|
||||
// _data := this.GetLibraryStory(101)
|
||||
// fmt.Printf("%v", _data)
|
||||
// _data1 := this.GetLibraryFavor(2)
|
||||
// fmt.Printf("%v", _data1)
|
||||
// _data2 := this.GetLibraryHistory("350011")
|
||||
// fmt.Printf("%v", _data2)
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) SetLibraryFetter() {
|
||||
if v, err := this.GetConfigure(game_libraryfetter); err == nil {
|
||||
if _configure, ok := v.(*cfg.GameLibraryFetter); ok {
|
||||
for _, v := range _configure.GetDataList() {
|
||||
this.fetter[int64(v.Fid<<8)+int64(v.Favorlv)] = v
|
||||
}
|
||||
return
|
||||
}
|
||||
} else {
|
||||
err = fmt.Errorf("%T no is *cfg.GameLibraryFetter", v)
|
||||
}
|
||||
}
|
||||
func (this *configureComp) GetLibraryFetter(fid, favorlv int32) (data *cfg.GameLibraryFetterData) {
|
||||
return this.fetter[int64(fid<<8)+int64(favorlv)]
|
||||
}
|
||||
|
||||
//加载多个配置文件
|
||||
func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err error) {
|
||||
for k, v := range confs {
|
||||
@ -51,22 +83,42 @@ func (this *configureComp) GetLibraryHero(hid string) (data *cfg.GameLibraryHero
|
||||
if v, err := this.GetConfigure(game_libraryhero); err == nil {
|
||||
if configure, ok := v.(*cfg.GameLibraryHero); ok {
|
||||
data = configure.Get(hid)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_challenge conf err:%v", err)
|
||||
log.Errorf("get GetLibraryHero conf err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetLibraryFetter(fid int32) (data *cfg.GameLibraryFetterData) {
|
||||
if v, err := this.GetConfigure(game_libraryfetter); err == nil {
|
||||
if configure, ok := v.(*cfg.GameLibraryFetter); ok {
|
||||
data = configure.Get(fid)
|
||||
return
|
||||
func (this *configureComp) GetLibraryFavor(id int32) (data *cfg.GameLibraryFavorData) {
|
||||
if v, err := this.GetConfigure(game_libraryfavor); err == nil {
|
||||
if configure, ok := v.(*cfg.GameLibraryFavor); ok {
|
||||
data = configure.Get(id)
|
||||
}
|
||||
} else {
|
||||
log.Errorf("get game_challenge conf err:%v", err)
|
||||
log.Errorf("GetLibraryFavor conf err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetLibraryHistory(id string) (data *cfg.GameLibraryHistoryData) {
|
||||
if v, err := this.GetConfigure(game_libraryhistory); err == nil {
|
||||
if configure, ok := v.(*cfg.GameLibraryHistory); ok {
|
||||
data = configure.Get(id)
|
||||
}
|
||||
} else {
|
||||
log.Errorf("GetLibraryHistory conf err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (this *configureComp) GetLibraryStory(fid int32) (data *cfg.GameLibraryStoryData) {
|
||||
if v, err := this.GetConfigure(game_librarystory); err == nil {
|
||||
if configure, ok := v.(*cfg.GameLibraryStory); ok {
|
||||
data = configure.Get(fid)
|
||||
}
|
||||
} else {
|
||||
log.Errorf("GetLibraryStory conf err:%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
61
modules/library/model_fetter.go
Normal file
61
modules/library/model_fetter.go
Normal file
@ -0,0 +1,61 @@
|
||||
package library
|
||||
|
||||
import (
|
||||
"go_dreamfactory/comm"
|
||||
"go_dreamfactory/lego/core"
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/x/bsonx"
|
||||
)
|
||||
|
||||
type modelFetter struct {
|
||||
modules.MCompModel
|
||||
module *Library
|
||||
}
|
||||
|
||||
func (this *modelFetter) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
|
||||
this.TableName = string(comm.TableLibrary)
|
||||
err = this.MCompModel.Init(service, module, comp, options)
|
||||
this.module = module.(*Library)
|
||||
// uid 创建索引
|
||||
this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
|
||||
Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}},
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (this *modelFetter) modifyLibraryDataByObjId(uid string, data map[string]interface{}) error {
|
||||
return this.Change(uid, data)
|
||||
}
|
||||
|
||||
// 获取列表信息
|
||||
func (this *modelFetter) getLibraryList(uid string) []*pb.DBLibrary {
|
||||
libs := make([]*pb.DBLibrary, 0)
|
||||
err := this.GetList(uid, &libs)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return libs
|
||||
}
|
||||
|
||||
//创建一条信息
|
||||
func (this *modelFetter) createLibrary(uid string, fetter *pb.DBLibrary) (err error) {
|
||||
|
||||
if err = this.AddList(uid, fetter.Id, fetter); err != nil {
|
||||
this.module.Errorf("%v", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// 通过objid 找对应的数据
|
||||
func (this *modelFetter) getOneLibrary(uid, oid string) *pb.DBLibrary {
|
||||
fetter := &pb.DBLibrary{}
|
||||
err := this.GetListObj(uid, oid, fetter)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return fetter
|
||||
}
|
@ -64,7 +64,7 @@ func (this *Library) CreateLibrary(uid string, fids []int32, heroConfId string)
|
||||
Fetterlv: 0,
|
||||
}
|
||||
|
||||
conf := this.configure.GetLibraryFetter(fid)
|
||||
conf := this.configure.GetLibraryFetter(fid, 1)
|
||||
if conf == nil {
|
||||
for _, v := range conf.Hid {
|
||||
obj.Hero[v] = 0
|
||||
|
@ -292,19 +292,19 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
||||
|
||||
if len(attrs) > 0 { //用户属性资源
|
||||
code = this.ModuleUser.AddAttributeValues(session, attrs, bPush)
|
||||
this.Debugf("发放用户资源: %v", attrs)
|
||||
this.Debugf("发放用户资源: %v [%v]", attrs, code)
|
||||
}
|
||||
if len(items) > 0 { //道具资源
|
||||
code = this.ModuleItems.AddItems(source, session, items, bPush)
|
||||
this.Debugf("发放道具资源: %v", items)
|
||||
this.Debugf("发放道具资源: %v [%v]", items, code)
|
||||
}
|
||||
if len(heros) > 0 { //卡片资源
|
||||
code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||
this.Debugf("发放英雄资源: %v", heros)
|
||||
this.Debugf("发放英雄资源: %v [%v]", heros, code)
|
||||
}
|
||||
if len(equips) > 0 {
|
||||
code = this.ModuleEquipment.AddNewEquipments(source, session, equips, bPush)
|
||||
this.Debugf("发放装备资源: %v", equips)
|
||||
this.Debugf("发放装备资源: %v [%v]", equips, code)
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -84,7 +84,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
||||
return
|
||||
}
|
||||
pagoda.PagodaId = conf.LayerNum // 更新层数
|
||||
mapData["pagodaId"] = conf.LayerNum
|
||||
code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
||||
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
||||
|
||||
|
@ -28,6 +28,7 @@ func (this *apiComp) List(session comm.IUserSession, req *pb.RtasklistReq) (code
|
||||
|
||||
rsp := &pb.RtasklistResp{
|
||||
RtaskIds: ids,
|
||||
GroupId: req.GroupId,
|
||||
}
|
||||
if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeList, rsp); err != nil {
|
||||
code = pb.ErrorCode_SystemError
|
||||
|
@ -8,6 +8,8 @@ import (
|
||||
"go_dreamfactory/modules"
|
||||
"go_dreamfactory/pb"
|
||||
cfg "go_dreamfactory/sys/configure/structs"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
var _ comm.IRtask = (*ModuleRtask)(nil)
|
||||
@ -195,11 +197,10 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
|
||||
}
|
||||
|
||||
func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
|
||||
this.Debugf("receive Rtask %v params: %v", rtaskType, params)
|
||||
this.Debug("任务事件触发", log.Field{"uid", session.GetUserId()}, log.Field{"taskType", rtaskType}, log.Field{"params", params})
|
||||
var (
|
||||
err error
|
||||
condiId int32
|
||||
// condi *rtaskCondi
|
||||
condis []*rtaskCondi
|
||||
)
|
||||
|
||||
@ -210,30 +211,35 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
|
||||
}
|
||||
|
||||
for _, codi := range this.configure.getRtaskCondis(int32(rtaskType)) {
|
||||
if v, ok := this.handleMap[codi.Id]; ok {
|
||||
v, ok := this.handleMap[codi.Id]
|
||||
if !ok {
|
||||
this.Warn("未注册事件处理器", log.Field{"uid", session.GetUserId()}, log.Field{"condiId", codi.Id})
|
||||
code = pb.ErrorCode_RtaskCondiNoFound
|
||||
return
|
||||
}
|
||||
|
||||
if v.find == nil {
|
||||
return
|
||||
}
|
||||
if condiId, err = v.find(v.cfg, params...); condiId == 0 {
|
||||
if err != nil {
|
||||
this.Error(err.Error())
|
||||
this.Warn(errors.WithMessage(err, session.GetUserId()).Error())
|
||||
}
|
||||
} else {
|
||||
condis = append(condis, v)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// update
|
||||
for _, v := range condis {
|
||||
if v.update != nil {
|
||||
//条件未达成才更新数据
|
||||
if code = this.CheckCondi(user.Id, v.cfg.Id); code != pb.ErrorCode_Success {
|
||||
// if code = this.CheckCondi(user.Id, v.cfg.Id); code != pb.ErrorCode_Success {
|
||||
if err := v.update(session.GetUserId(), v.cfg, params...); err != nil {
|
||||
code = pb.ErrorCode_DBError
|
||||
}
|
||||
}
|
||||
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,10 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
|
||||
} else {
|
||||
//查找任务数据
|
||||
if v, ok := record.Vals[cfg.Id]; ok {
|
||||
newCount := make([]int32, len(vals))
|
||||
srcCount := v.Data[0]
|
||||
vals[0] = srcCount + vals[0]
|
||||
v.Data = toMap(vals...)
|
||||
newCount[0] = srcCount + vals[0]
|
||||
v.Data = toMap(newCount...)
|
||||
v.Timestamp = time.Now().Unix()
|
||||
|
||||
update := map[string]interface{}{
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"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"
|
||||
"sort"
|
||||
@ -280,9 +281,16 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
||||
continue
|
||||
}
|
||||
|
||||
if task, ok := this.checkTask(tl.Uid, conf.Key); ok {
|
||||
update := make(map[string]interface{})
|
||||
var progress int32
|
||||
task, ok := this.checkTask(tl.Uid, conf.Key)
|
||||
if !ok {
|
||||
this.moduleTask.Debug("任务已完成", log.Field{"uid", tl.Uid}, log.Field{"任务ID", conf.Key})
|
||||
continue
|
||||
}
|
||||
|
||||
var (
|
||||
progress int32
|
||||
update map[string]interface{}
|
||||
)
|
||||
if code := this.moduleTask.ModuleRtask.CheckCondi(tl.Uid, conf.TypeId); code == pb.ErrorCode_Success {
|
||||
// update data
|
||||
if ret != nil && len(ret.Data) > 0 {
|
||||
@ -304,7 +312,13 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
||||
if err = this.modifyUserTask(tl.Uid, task.Id, update); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.moduleTask.Debug("更新任务",
|
||||
log.Field{"uid", tl.Uid},
|
||||
log.Field{"任务ID", conf.Key},
|
||||
log.Field{"事件ID", conf.TypeId},
|
||||
log.Field{"progress", update["progress"]},
|
||||
log.Field{"status", update["status"]},
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -151,11 +151,11 @@ type DBHero struct {
|
||||
IsOverlying bool `protobuf:"varint,23,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true
|
||||
EnergyProperty map[string]int32 `protobuf:"bytes,24,rep,name=energyProperty,proto3" json:"energyProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"energyProperty"` //
|
||||
JuexProperty map[string]int32 `protobuf:"bytes,25,rep,name=juexProperty,proto3" json:"juexProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"juexProperty"` ////hp
|
||||
Status HeroType `protobuf:"varint,26,opt,name=status,proto3,enum=HeroType" json:"status" bson:"heroType"` //状态 (1 练功)
|
||||
Suite1Star int32 `protobuf:"varint,27,opt,name=suite1Star,proto3" json:"suite1Star"`
|
||||
Suite2Star int32 `protobuf:"varint,28,opt,name=suite2Star,proto3" json:"suite2Star"`
|
||||
Suite1Lv int32 `protobuf:"varint,29,opt,name=suite1Lv,proto3" json:"suite1Lv"`
|
||||
Suite2Lv int32 `protobuf:"varint,30,opt,name=suite2Lv,proto3" json:"suite2Lv"`
|
||||
Status HeroType `protobuf:"varint,26,opt,name=status,proto3,enum=HeroType" json:"status" bson:"status"` //状态 (1 练功)
|
||||
Suite1Star int32 `protobuf:"varint,27,opt,name=suite1Star,proto3" json:"suite1Star" bson:"suite1Star"` //
|
||||
Suite2Star int32 `protobuf:"varint,28,opt,name=suite2Star,proto3" json:"suite2Star" bson:"suite2Star"`
|
||||
Suite1Lv int32 `protobuf:"varint,29,opt,name=suite1Lv,proto3" json:"suite1Lv" bson:"suite1Lv"`
|
||||
Suite2Lv int32 `protobuf:"varint,30,opt,name=suite2Lv,proto3" json:"suite2Lv" bson:"suite2Lv"`
|
||||
}
|
||||
|
||||
func (x *DBHero) Reset() {
|
||||
|
@ -20,61 +20,6 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type Fetter struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Cid string `protobuf:"bytes,1,opt,name=cid,proto3" json:"cid"`
|
||||
Lv int32 `protobuf:"varint,2,opt,name=lv,proto3" json:"lv"`
|
||||
}
|
||||
|
||||
func (x *Fetter) Reset() {
|
||||
*x = Fetter{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_library_library_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *Fetter) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Fetter) ProtoMessage() {}
|
||||
|
||||
func (x *Fetter) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_library_library_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 Fetter.ProtoReflect.Descriptor instead.
|
||||
func (*Fetter) Descriptor() ([]byte, []int) {
|
||||
return file_library_library_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Fetter) GetCid() string {
|
||||
if x != nil {
|
||||
return x.Cid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Fetter) GetLv() int32 {
|
||||
if x != nil {
|
||||
return x.Lv
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type DBLibrary struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@ -84,7 +29,7 @@ type DBLibrary struct {
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
Fid int32 `protobuf:"varint,3,opt,name=fid,proto3" json:"fid"` // 配置表id 羁绊id
|
||||
Hero map[string]int32 `protobuf:"bytes,4,rep,name=hero,proto3" json:"hero" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key: hid value: favorlv
|
||||
Prize map[int32]int32 `protobuf:"bytes,5,rep,name=prize,proto3" json:"prize" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //是否领奖
|
||||
Prize map[int32]int32 `protobuf:"bytes,5,rep,name=prize,proto3" json:"prize" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //是否领奖 key 好感度等级
|
||||
Fetterlv int32 `protobuf:"varint,6,opt,name=fetterlv,proto3" json:"fetterlv"` // 当前羁绊等级
|
||||
Storyid int32 `protobuf:"varint,7,opt,name=storyid,proto3" json:"storyid"` // 故事id 用来判断是否领奖
|
||||
}
|
||||
@ -92,7 +37,7 @@ type DBLibrary struct {
|
||||
func (x *DBLibrary) Reset() {
|
||||
*x = DBLibrary{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_library_library_db_proto_msgTypes[1]
|
||||
mi := &file_library_library_db_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@ -105,7 +50,7 @@ func (x *DBLibrary) String() string {
|
||||
func (*DBLibrary) ProtoMessage() {}
|
||||
|
||||
func (x *DBLibrary) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_library_library_db_proto_msgTypes[1]
|
||||
mi := &file_library_library_db_proto_msgTypes[0]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@ -118,7 +63,7 @@ func (x *DBLibrary) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use DBLibrary.ProtoReflect.Descriptor instead.
|
||||
func (*DBLibrary) Descriptor() ([]byte, []int) {
|
||||
return file_library_library_db_proto_rawDescGZIP(), []int{1}
|
||||
return file_library_library_db_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *DBLibrary) GetId() string {
|
||||
@ -170,35 +115,130 @@ func (x *DBLibrary) GetStoryid() int32 {
|
||||
return 0
|
||||
}
|
||||
|
||||
// 羁绊英雄数据
|
||||
type DBHeroFetter struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID
|
||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
||||
Heroid string `protobuf:"bytes,3,opt,name=heroid,proto3" json:"heroid"` // 英雄配置表id
|
||||
History int32 `protobuf:"varint,4,opt,name=history,proto3" json:"history"` // 传记往事ID
|
||||
Favorlv int32 `protobuf:"varint,5,opt,name=favorlv,proto3" json:"favorlv"` // 好感度等级
|
||||
Stroyprize int32 `protobuf:"varint,6,opt,name=stroyprize,proto3" json:"stroyprize"` // 剧情奖励
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) Reset() {
|
||||
*x = DBHeroFetter{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_library_library_db_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DBHeroFetter) ProtoMessage() {}
|
||||
|
||||
func (x *DBHeroFetter) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_library_library_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 DBHeroFetter.ProtoReflect.Descriptor instead.
|
||||
func (*DBHeroFetter) Descriptor() ([]byte, []int) {
|
||||
return file_library_library_db_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) GetUid() string {
|
||||
if x != nil {
|
||||
return x.Uid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) GetHeroid() string {
|
||||
if x != nil {
|
||||
return x.Heroid
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) GetHistory() int32 {
|
||||
if x != nil {
|
||||
return x.History
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) GetFavorlv() int32 {
|
||||
if x != nil {
|
||||
return x.Favorlv
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *DBHeroFetter) GetStroyprize() int32 {
|
||||
if x != nil {
|
||||
return x.Stroyprize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_library_library_db_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_library_library_db_proto_rawDesc = []byte{
|
||||
0x0a, 0x18, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72,
|
||||
0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2a, 0x0a, 0x06, 0x46, 0x65,
|
||||
0x74, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0xbf, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x4c, 0x69, 0x62,
|
||||
0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x03, 0x66, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f,
|
||||
0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61,
|
||||
0x72, 0x79, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x68, 0x65,
|
||||
0x72, 0x6f, 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x50, 0x72,
|
||||
0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x18, 0x06, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x73,
|
||||
0x74, 0x6f, 0x72, 0x79, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74,
|
||||
0x6f, 0x72, 0x79, 0x69, 0x64, 0x1a, 0x37, 0x0a, 0x09, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38,
|
||||
0x0a, 0x0a, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76,
|
||||
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x02, 0x0a, 0x09, 0x44,
|
||||
0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x69,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x66, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x04,
|
||||
0x68, 0x65, 0x72, 0x6f, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x4c,
|
||||
0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18,
|
||||
0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72,
|
||||
0x79, 0x2e, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x70, 0x72,
|
||||
0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x69, 0x64, 0x1a, 0x37, 0x0a, 0x09, 0x48, 0x65, 0x72,
|
||||
0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
|
||||
0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9c, 0x01, 0x0a,
|
||||
0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a,
|
||||
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a,
|
||||
0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12,
|
||||
0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f,
|
||||
0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x72,
|
||||
0x79, 0x12, 0x18, 0x0a, 0x07, 0x66, 0x61, 0x76, 0x6f, 0x72, 0x6c, 0x76, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x07, 0x66, 0x61, 0x76, 0x6f, 0x72, 0x6c, 0x76, 0x12, 0x1e, 0x0a, 0x0a, 0x73,
|
||||
0x74, 0x72, 0x6f, 0x79, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x0a, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e,
|
||||
0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -215,8 +255,8 @@ func file_library_library_db_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_library_library_db_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_library_library_db_proto_goTypes = []interface{}{
|
||||
(*Fetter)(nil), // 0: Fetter
|
||||
(*DBLibrary)(nil), // 1: DBLibrary
|
||||
(*DBLibrary)(nil), // 0: DBLibrary
|
||||
(*DBHeroFetter)(nil), // 1: DBHeroFetter
|
||||
nil, // 2: DBLibrary.HeroEntry
|
||||
nil, // 3: DBLibrary.PrizeEntry
|
||||
}
|
||||
@ -237,7 +277,7 @@ func file_library_library_db_proto_init() {
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_library_library_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*Fetter); i {
|
||||
switch v := v.(*DBLibrary); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@ -249,7 +289,7 @@ func file_library_library_db_proto_init() {
|
||||
}
|
||||
}
|
||||
file_library_library_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DBLibrary); i {
|
||||
switch v := v.(*DBHeroFetter); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
@ -177,6 +177,7 @@ type RtasklistResp struct {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
RtaskIds []int32 `protobuf:"varint,1,rep,packed,name=rtaskIds,proto3" json:"rtaskIds"`
|
||||
GroupId int32 `protobuf:"varint,2,opt,name=groupId,proto3" json:"groupId"`
|
||||
}
|
||||
|
||||
func (x *RtasklistResp) Reset() {
|
||||
@ -218,6 +219,13 @@ func (x *RtasklistResp) GetRtaskIds() []int32 {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *RtasklistResp) GetGroupId() int32 {
|
||||
if x != nil {
|
||||
return x.GroupId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// 对话选项
|
||||
type RtaskChooseReq struct {
|
||||
state protoimpl.MessageState
|
||||
@ -972,78 +980,79 @@ var file_rtask_rtask_msg_proto_rawDesc = []byte{
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x28, 0x0a,
|
||||
0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07,
|
||||
0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x45, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x6c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x73, 0x22, 0x66, 0x0a, 0x0e, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x6f,
|
||||
0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49,
|
||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a,
|
||||
0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x0f,
|
||||
0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f,
|
||||
0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f,
|
||||
0x6f, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75,
|
||||
0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69,
|
||||
0x6e, 0x69, 0x73, 0x68, 0x50, 0x75, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x49, 0x64, 0x22, 0x4d, 0x0a, 0x11, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65,
|
||||
0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49,
|
||||
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49,
|
||||
0x64, 0x22, 0x4e, 0x0a, 0x12, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77,
|
||||
0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49,
|
||||
0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49,
|
||||
0x64, 0x22, 0x6d, 0x0a, 0x13, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
||||
0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x74,
|
||||
0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c,
|
||||
0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c,
|
||||
0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x64,
|
||||
0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x64, 0x73,
|
||||
0x22, 0x37, 0x0a, 0x14, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53,
|
||||
0x74, 0x61, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49,
|
||||
0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x6c, 0x0a, 0x14, 0x52, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65,
|
||||
0x6b, 0x49, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x66,
|
||||
0x0a, 0x0e, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68,
|
||||
0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68,
|
||||
0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53,
|
||||
0x75, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43,
|
||||
0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x12,
|
||||
0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22,
|
||||
0x2b, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x75,
|
||||
0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x4d, 0x0a, 0x11,
|
||||
0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
|
||||
0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63,
|
||||
0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63,
|
||||
0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x15, 0x52, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
|
||||
0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22,
|
||||
0x3c, 0x0a, 0x12, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52,
|
||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x94, 0x01,
|
||||
0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c,
|
||||
0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
|
||||
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61,
|
||||
0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73,
|
||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x12, 0x52,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73,
|
||||
0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x6d, 0x0a, 0x13, 0x52,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52,
|
||||
0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f,
|
||||
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x64, 0x73, 0x22, 0x37, 0x0a, 0x14, 0x52, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69,
|
||||
0x6e, 0x66, 0x6f, 0x22, 0x6c, 0x0a, 0x14, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74,
|
||||
0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72,
|
||||
0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75,
|
||||
0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x53, 0x75, 0x62, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49,
|
||||
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49,
|
||||
0x64, 0x22, 0x51, 0x0a, 0x15, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
||||
0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62,
|
||||
0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53,
|
||||
0x75, 0x62, 0x49, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74,
|
||||
0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22, 0x3c, 0x0a, 0x12, 0x52, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x26, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x0e, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52,
|
||||
0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x94, 0x01, 0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x72, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73,
|
||||
0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75,
|
||||
0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70,
|
||||
0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x22, 0x3f,
|
||||
0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x66,
|
||||
0x6c, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x18,
|
||||
0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x73, 0x42,
|
||||
0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"go_dreamfactory/modules/hero"
|
||||
"go_dreamfactory/modules/hunting"
|
||||
"go_dreamfactory/modules/items"
|
||||
"go_dreamfactory/modules/library"
|
||||
"go_dreamfactory/modules/linestory"
|
||||
"go_dreamfactory/modules/mail"
|
||||
"go_dreamfactory/modules/mainline"
|
||||
@ -81,6 +82,7 @@ func main() {
|
||||
hunting.NewModule(),
|
||||
battle.NewModule(),
|
||||
linestory.NewModule(),
|
||||
library.NewModule(),
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user