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"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path"
|
"path"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"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{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"dirs": dirs,
|
"dirs": dirs,
|
||||||
})
|
})
|
||||||
|
@ -4,5 +4,5 @@ Website = "http://legu.cc"
|
|||||||
Icon = "app.png"
|
Icon = "app.png"
|
||||||
Name = "RobotGUI"
|
Name = "RobotGUI"
|
||||||
ID = "cc.legu.app"
|
ID = "cc.legu.app"
|
||||||
Version = "1.0.11"
|
Version = "1.0.13"
|
||||||
Build = 14
|
Build = 16
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
rem build desktop
|
set input=%1%
|
||||||
go build -ldflags -H=windowsgui -o robot.exe
|
|
||||||
|
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_MODINAME = "免费改名次数"
|
||||||
USERINFO_ACTIVE_DAY = "日活"
|
USERINFO_ACTIVE_DAY = "日活"
|
||||||
USERINFO_ACTIVE_WEEK = "周活"
|
USERINFO_ACTIVE_WEEK = "周活"
|
||||||
|
USERINFO_CREATETM = "创建"
|
||||||
|
USERINFO_UPDATETM = "更新"
|
||||||
)
|
)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package ui
|
package common
|
||||||
|
|
||||||
import "strings"
|
import "strings"
|
||||||
|
|
||||||
@ -57,10 +57,12 @@ func (l List) Less(i, j int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Item struct {
|
type Item struct {
|
||||||
Title string `json:"title"`
|
Id string `json:"id"`
|
||||||
Text string `json:"text"`
|
Title string `json:"title"`
|
||||||
Quantity int `json:"quantity"`
|
Text string `json:"text"`
|
||||||
Checked bool `json:"checked"`
|
Quantity int `json:"quantity"`
|
||||||
|
Checked bool `json:"checked"`
|
||||||
|
Size int64 `json:"size"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewList(name string) List {
|
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"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
|
"math"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
@ -117,3 +119,40 @@ func RemoveContents(dir string) error {
|
|||||||
}
|
}
|
||||||
return nil
|
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))
|
r := SubStr(str, 20, len(str))
|
||||||
fmt.Println(r)
|
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,
|
w.SetContent(container.NewGridWithColumns(2,
|
||||||
widget.NewButton("工具", func() {
|
widget.NewButton("工具", func() {
|
||||||
toolWindow := ui.NewToolWindow(appUI, w)
|
toolWindow := ui.NewToolWindow(appUI, w)
|
||||||
toolWindow.CreateWindow(common.APP_NAME, 1366, 768, true)
|
toolWindow.CreateWindow(common.APP_NAME, 1499, 800, true)
|
||||||
w.Hide()
|
w.Hide()
|
||||||
}),
|
}),
|
||||||
widget.NewButton("登服", func() {
|
widget.NewButton("登服", func() {
|
||||||
mainWindow := ui.NewMainWindow(appUI, w)
|
mainWindow := ui.NewMainWindow(appUI, w)
|
||||||
mainWindow.CreateWindow(common.APP_NAME, 1366, 768, true)
|
mainWindow.CreateWindow(common.APP_NAME, 1499, 800, true)
|
||||||
w.Hide()
|
w.Hide()
|
||||||
})))
|
})))
|
||||||
w.SetFixedSize(true)
|
w.SetFixedSize(true)
|
||||||
|
@ -21,4 +21,4 @@ func (s *ItemModelList) AsInterfaceArray() []interface{} {
|
|||||||
rs[i] = v
|
rs[i] = v
|
||||||
}
|
}
|
||||||
return rs
|
return rs
|
||||||
}
|
}
|
@ -13,4 +13,9 @@ type SSHModel struct {
|
|||||||
LubanCli string
|
LubanCli string
|
||||||
DataDir string
|
DataDir string
|
||||||
JsonDir string
|
JsonDir string
|
||||||
|
|
||||||
|
//
|
||||||
|
SaveDir string //保存目录
|
||||||
|
LogDir string //远程日志目录
|
||||||
|
Editor string //编辑器
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,8 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"io/fs"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
@ -281,7 +283,91 @@ func (ss *SSHService) Scp(targetDir, srcFileName string) (int, error) {
|
|||||||
return n, nil
|
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 {
|
type CopyFiles struct {
|
||||||
Dir string
|
Dir string
|
||||||
FileName string
|
FileName string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type File struct {
|
||||||
|
FileName string
|
||||||
|
FilePath string
|
||||||
|
Size int64
|
||||||
|
}
|
||||||
|
@ -2,6 +2,7 @@ package service
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"log"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
@ -56,3 +57,31 @@ func TestMath(t *testing.T) {
|
|||||||
a := float64(10) / float64(3)
|
a := float64(10) / float64(3)
|
||||||
fmt.Println(a)
|
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 (
|
import (
|
||||||
"go_dreamfactory/cmd/v2/lib/common"
|
"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/dialog"
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
)
|
)
|
||||||
@ -14,12 +17,15 @@ type about struct {
|
|||||||
func newAbout() *about {
|
func newAbout() *about {
|
||||||
var a about
|
var a about
|
||||||
ver := toolWin.app.Metadata().Version
|
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(
|
content := widget.NewCard("", "", widget.NewRichTextFromMarkdown(
|
||||||
`
|
`
|
||||||
梦工厂项目辅助工具GUI
|
梦工厂项目辅助工具GUI
|
||||||
@v`+ver,
|
@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
|
return &a
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ func (this *appMonitor) Run() {
|
|||||||
data := d.(*model.PushModel)
|
data := d.(*model.PushModel)
|
||||||
this.monitorData.DataList = append(this.monitorData.DataList, data)
|
this.monitorData.DataList = append(this.monitorData.DataList, data)
|
||||||
this.reloadMonitorData()
|
this.reloadMonitorData()
|
||||||
showTip("收到新的数据推送,请打开[监控]页面")
|
common.ShowCanvasTip("收到新的数据推送,请打开[推送]页面")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/cmd/v2/lib/common"
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
"go_dreamfactory/cmd/v2/service"
|
"go_dreamfactory/cmd/v2/service"
|
||||||
@ -107,7 +108,7 @@ func (ui *MainWindowImpl) SetStatusMsg(msg string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ui *MainWindowImpl) quiteHandle() {
|
func (ui *MainWindowImpl) quiteHandle() {
|
||||||
dialog.ShowConfirm("推出系统", "确定退出吗", func(b bool) {
|
dialog.ShowConfirm("提示", "确定退出吗", func(b bool) {
|
||||||
if !b {
|
if !b {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -265,6 +266,20 @@ func (ui *MainWindowImpl) createLoginWin(sid, sname string) {
|
|||||||
// create role
|
// create role
|
||||||
ui.createRoleWindowPopUp()
|
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/model"
|
||||||
"go_dreamfactory/cmd/v2/service"
|
"go_dreamfactory/cmd/v2/service"
|
||||||
"go_dreamfactory/cmd/v2/service/observer"
|
"go_dreamfactory/cmd/v2/service/observer"
|
||||||
"go_dreamfactory/utils"
|
|
||||||
"io/ioutil"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"sort"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
@ -29,14 +25,14 @@ type appGen struct {
|
|||||||
appAdapter
|
appAdapter
|
||||||
|
|
||||||
obs observer.Observer
|
obs observer.Observer
|
||||||
goList *fileList
|
goList *common.ItemList
|
||||||
jsonList *fileList
|
jsonList *common.ItemList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *appGen) LazyInit(obs observer.Observer) error {
|
func (this *appGen) LazyInit(obs observer.Observer) error {
|
||||||
this.obs = obs
|
this.obs = obs
|
||||||
this.goList = NewFileList()
|
this.goList = common.NewItemList()
|
||||||
this.jsonList = NewFileList()
|
this.jsonList = common.NewItemList()
|
||||||
|
|
||||||
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_GEN, theme.ContentCopyIcon(), nil)
|
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(
|
form := widget.NewForm(
|
||||||
widget.NewFormItem("服务地址", serverAddr),
|
widget.NewFormItem("服务地址", serverAddr),
|
||||||
widget.NewFormItem("项目目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
widget.NewFormItem("项目目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||||
openFolder(projectDir)
|
openFolder(projectDir, toolWin.w)
|
||||||
}), projectDir)),
|
}), projectDir)),
|
||||||
widget.NewFormItem("工作目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
widget.NewFormItem("工作目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||||
openFolder(workDir)
|
openFolder(workDir, toolWin.w)
|
||||||
}), workDir)),
|
}), workDir)),
|
||||||
widget.NewFormItem("LuBan Cli", client),
|
widget.NewFormItem("LuBan Cli", client),
|
||||||
widget.NewFormItem("输入目录", inputDir),
|
widget.NewFormItem("输入目录", inputDir),
|
||||||
widget.NewFormItem("输出Code目录", outputCodeDir),
|
widget.NewFormItem("输出Code目录", outputCodeDir),
|
||||||
widget.NewFormItem("输出JSON目录", outputJsonDir),
|
widget.NewFormItem("输出JSON目录", outputJsonDir),
|
||||||
widget.NewFormItem("临时目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
widget.NewFormItem("临时目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||||
openFolder(tmpDir)
|
openFolder(tmpDir, toolWin.w)
|
||||||
}), tmpDir)),
|
}), tmpDir)),
|
||||||
widget.NewFormItem("生成类型", genType),
|
widget.NewFormItem("生成类型", genType),
|
||||||
)
|
)
|
||||||
@ -148,10 +144,10 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
//go
|
//go
|
||||||
this.goList.titleLabel = widget.NewLabel("Go文件")
|
this.goList.TitleLabel = widget.NewLabel("Go文件")
|
||||||
this.goList.titleLabel.Hide()
|
this.goList.TitleLabel.Hide()
|
||||||
// 复选列表
|
// 复选列表
|
||||||
this.goList.itemList = this.goList.createList()
|
this.goList.ItemList = this.goList.CreateDefaultCheckList()
|
||||||
|
|
||||||
// 覆盖 -go
|
// 覆盖 -go
|
||||||
go_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
go_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
||||||
@ -165,9 +161,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
go_overrideBtn.Disable()
|
go_overrideBtn.Disable()
|
||||||
defer func() {
|
defer func() {
|
||||||
go_overrideBtn.Enable()
|
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("path1", filepath.Join(tmpDir.Text, "go", v)).Debug("copy go")
|
||||||
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputCodeDir.Text, 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),
|
_, err := common.Copy(filepath.Join(tmpDir.Text, "go", v),
|
||||||
@ -176,9 +172,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.goList.deleteItem(v)
|
this.goList.DeleteItem(v)
|
||||||
}
|
}
|
||||||
this.goList.changeFileCount()
|
this.goList.ChangeFileCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消checked
|
//取消checked
|
||||||
@ -187,13 +183,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
go_allCancelBtn.Hide()
|
go_allCancelBtn.Hide()
|
||||||
go_allSelBtn.Show()
|
go_allSelBtn.Show()
|
||||||
}()
|
}()
|
||||||
this.goList.selItemIds = []string{}
|
this.goList.SelItemIds = []string{}
|
||||||
for i, v := range this.goList.cachedList.Items {
|
for i, v := range this.goList.CachedList.Items {
|
||||||
this.goList.cachedList.Items[i].Checked = false
|
this.goList.CachedList.Items[i].Checked = false
|
||||||
this.goList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
this.goList.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||||
}
|
}
|
||||||
this.goList.changeFileCount()
|
this.goList.ChangeFileCount()
|
||||||
this.goList.itemList.Refresh()
|
this.goList.ItemList.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
//选择所有
|
//选择所有
|
||||||
@ -202,21 +198,21 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
go_allCancelBtn.Show()
|
go_allCancelBtn.Show()
|
||||||
go_allSelBtn.Hide()
|
go_allSelBtn.Hide()
|
||||||
}()
|
}()
|
||||||
for i, v := range this.goList.cachedList.Items {
|
for i, v := range this.goList.CachedList.Items {
|
||||||
this.goList.cachedList.Items[i].Checked = true
|
this.goList.CachedList.Items[i].Checked = true
|
||||||
this.goList.selItemIds = append(this.goList.selItemIds, v.Text)
|
this.goList.SelItemIds = append(this.goList.SelItemIds, v.Text)
|
||||||
this.goList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
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.titleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.goList.selItemIds), this.goList.fileTotal))
|
||||||
this.goList.itemList.Refresh()
|
this.goList.ItemList.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
// json
|
// json
|
||||||
this.jsonList.titleLabel = widget.NewLabel("Json文件")
|
this.jsonList.TitleLabel = widget.NewLabel("Json文件")
|
||||||
this.jsonList.titleLabel.Hide()
|
this.jsonList.TitleLabel.Hide()
|
||||||
// 复选列表
|
// 复选列表
|
||||||
this.jsonList.itemList = this.jsonList.createList()
|
this.jsonList.ItemList = this.jsonList.CreateDefaultCheckList()
|
||||||
|
|
||||||
// 覆盖 -go
|
// 覆盖 -go
|
||||||
json_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
json_allSelBtn := &widget.Button{Icon: theme.CheckButtonIcon()}
|
||||||
@ -228,9 +224,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
json_overrideBtn.Disable()
|
json_overrideBtn.Disable()
|
||||||
defer func() {
|
defer func() {
|
||||||
json_overrideBtn.Enable()
|
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("path1", filepath.Join(tmpDir.Text, "json", v)).Debug("copy json")
|
||||||
// logrus.WithField("path2", filepath.Join(projectDir.Text, outputJsonDir.Text, 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),
|
_, err := common.Copy(filepath.Join(tmpDir.Text, "json", v),
|
||||||
@ -239,9 +235,9 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.jsonList.deleteItem(v)
|
this.jsonList.DeleteItem(v)
|
||||||
}
|
}
|
||||||
this.jsonList.changeFileCount()
|
this.jsonList.ChangeFileCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
//取消checked
|
//取消checked
|
||||||
@ -251,13 +247,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
json_allSelBtn.Show()
|
json_allSelBtn.Show()
|
||||||
}()
|
}()
|
||||||
list := this.jsonList
|
list := this.jsonList
|
||||||
list.selItemIds = []string{}
|
list.SelItemIds = []string{}
|
||||||
for i, v := range list.cachedList.Items {
|
for i, v := range list.CachedList.Items {
|
||||||
list.cachedList.Items[i].Checked = false
|
list.CachedList.Items[i].Checked = false
|
||||||
list.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
list.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||||
}
|
}
|
||||||
this.jsonList.changeFileCount()
|
this.jsonList.ChangeFileCount()
|
||||||
list.itemList.Refresh()
|
list.ItemList.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
//选择所有
|
//选择所有
|
||||||
@ -267,13 +263,13 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
json_allSelBtn.Hide()
|
json_allSelBtn.Hide()
|
||||||
}()
|
}()
|
||||||
list := this.jsonList
|
list := this.jsonList
|
||||||
for i, v := range list.cachedList.Items {
|
for i, v := range list.CachedList.Items {
|
||||||
list.cachedList.Items[i].Checked = true
|
list.CachedList.Items[i].Checked = true
|
||||||
list.selItemIds = append(list.selItemIds, v.Text)
|
list.SelItemIds = append(list.SelItemIds, v.Text)
|
||||||
list.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
list.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||||
}
|
}
|
||||||
list.changeFileCount()
|
list.ChangeFileCount()
|
||||||
list.itemList.Refresh()
|
list.ItemList.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
genBtn := &widget.Button{Text: "生成", Icon: theme.ConfirmIcon()}
|
genBtn := &widget.Button{Text: "生成", Icon: theme.ConfirmIcon()}
|
||||||
@ -316,17 +312,17 @@ func (this *appGen) LazyInit(obs observer.Observer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeGo := func() {
|
changeGo := func() {
|
||||||
this.goList.changeItem(filepath.Join(tmpDir.Text, "go"), filepath.Join(projectDir.Text, outputCodeDir.Text))
|
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.TitleLabel.SetText(fmt.Sprintf("(%d/%d个)", len(this.goList.SelItemIds), this.goList.ItemTotal))
|
||||||
go_overrideBtn.Show()
|
go_overrideBtn.Show()
|
||||||
this.goList.titleLabel.Show()
|
this.goList.TitleLabel.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
changeJson := func() {
|
changeJson := func() {
|
||||||
this.jsonList.changeItem(filepath.Join(tmpDir.Text, "json"), filepath.Join(projectDir.Text, outputJsonDir.Text))
|
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.TitleLabel.SetText(fmt.Sprintf("(%d/%d)", len(this.jsonList.SelItemIds), this.jsonList.ItemTotal))
|
||||||
json_overrideBtn.Show()
|
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))
|
left := container.NewVBox(form, container.NewHBox(&layout.Spacer{}, desBtn, saveBtn, genBtn))
|
||||||
right := container.NewGridWithColumns(2,
|
right := container.NewGridWithColumns(2,
|
||||||
container.NewBorder(
|
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,
|
nil, nil, nil,
|
||||||
this.goList.itemList),
|
this.goList.ItemList),
|
||||||
container.NewBorder(
|
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,
|
nil, nil, nil,
|
||||||
this.jsonList.itemList))
|
this.jsonList.ItemList))
|
||||||
|
|
||||||
content.Objects = append(content.Objects, container.NewGridWithColumns(2, left, right))
|
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) {
|
dConf := dialog.NewFolderOpen(func(lu fyne.ListableURI, err error) {
|
||||||
if lu == nil {
|
if lu == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
entry.Text = lu.Path()
|
entry.Text = lu.Path()
|
||||||
entry.Refresh()
|
entry.Refresh()
|
||||||
}, toolWin.w)
|
}, w)
|
||||||
luri, _ := storage.ListerForURI(storage.NewFileURI("."))
|
luri, _ := storage.ListerForURI(storage.NewFileURI("."))
|
||||||
dConf.SetLocation(luri)
|
dConf.SetLocation(luri)
|
||||||
dConf.SetConfirmText("打开")
|
dConf.SetConfirmText("打开")
|
||||||
@ -391,155 +387,19 @@ func openFolder(entry *widget.Entry) {
|
|||||||
dConf.Show()
|
dConf.Show()
|
||||||
}
|
}
|
||||||
|
|
||||||
type fileList struct {
|
func openFile(entry *widget.Entry, w fyne.Window) {
|
||||||
selItemIds []string //选择的ID
|
dConf := dialog.NewFileOpen(func(lu fyne.URIReadCloser, err error) {
|
||||||
fileTotal int //文件总数
|
if lu == nil {
|
||||||
titleLabel *widget.Label
|
return
|
||||||
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 {
|
|
||||||
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--
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
entry.SetText(lu.URI().Path())
|
||||||
}
|
entry.Refresh()
|
||||||
|
}, w)
|
||||||
func (f *fileList) loadItem(dirPath string) {
|
dConf.SetConfirmText("打开")
|
||||||
f.reset()
|
dConf.SetDismissText("取消")
|
||||||
files, err := ioutil.ReadDir(dirPath)
|
dConf.SetFilter(storage.NewExtensionFileFilter([]string{".exe"}))
|
||||||
if err != nil {
|
dConf.Resize(fyne.NewSize(750, 500))
|
||||||
logrus.Error(err)
|
dConf.Show()
|
||||||
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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *appGen) GetAppName() string {
|
func (a *appGen) GetAppName() string {
|
||||||
|
@ -54,7 +54,7 @@ func (this *appLock) LazyInit(obs observer.Observer) error {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
toolWin.w.Clipboard().SetContent(text.Text)
|
toolWin.w.Clipboard().SetContent(text.Text)
|
||||||
showTip("已复制到剪贴板")
|
common.ShowTip("已复制到剪贴板")
|
||||||
})
|
})
|
||||||
|
|
||||||
c := container.NewVBox(title, input, text, btn, copybtn)
|
c := container.NewVBox(title, input, text, btn, copybtn)
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/container"
|
"fyne.io/fyne/v2/container"
|
||||||
"fyne.io/fyne/v2/data/binding"
|
|
||||||
"fyne.io/fyne/v2/dialog"
|
"fyne.io/fyne/v2/dialog"
|
||||||
"fyne.io/fyne/v2/layout"
|
"fyne.io/fyne/v2/layout"
|
||||||
"fyne.io/fyne/v2/storage"
|
"fyne.io/fyne/v2/storage"
|
||||||
@ -27,13 +26,11 @@ import (
|
|||||||
type appPbGen struct {
|
type appPbGen struct {
|
||||||
appAdapter
|
appAdapter
|
||||||
folderList *folderList
|
folderList *folderList
|
||||||
folderChk *widget.List
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *appPbGen) LazyInit(obs observer.Observer) error {
|
func (this *appPbGen) LazyInit(obs observer.Observer) error {
|
||||||
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_PB, theme.ContentAddIcon(), nil)
|
this.tabItem = container.NewTabItemWithIcon(common.TOOLBAR_PB, theme.ContentAddIcon(), nil)
|
||||||
this.folderList = NewFolderList()
|
this.folderList = NewFolderList()
|
||||||
this.folderChk = this.folderList.createList()
|
|
||||||
|
|
||||||
countLabel := widget.NewLabel("")
|
countLabel := widget.NewLabel("")
|
||||||
|
|
||||||
@ -155,12 +152,15 @@ func (this *appPbGen) LazyInit(obs observer.Observer) error {
|
|||||||
}
|
}
|
||||||
logrus.Debug("save pb conf")
|
logrus.Debug("save pb conf")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.folderList.itemList = this.folderList.createList()
|
||||||
|
|
||||||
// layout
|
// layout
|
||||||
c := container.NewBorder(
|
c := container.NewBorder(
|
||||||
form,
|
form,
|
||||||
container.NewHBox(confBtn, genBtn, layout.NewSpacer(), countLabel), nil, nil,
|
container.NewHBox(confBtn, genBtn, layout.NewSpacer(), countLabel), nil, nil,
|
||||||
container.NewMax(
|
container.NewMax(
|
||||||
container.NewVScroll(this.folderChk),
|
container.NewVScroll(this.folderList.itemList),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -174,46 +174,47 @@ func (a *appPbGen) GetAppName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type folderList struct {
|
type folderList struct {
|
||||||
dataBinding binding.UntypedList
|
selItemIds []string //选择的ID
|
||||||
selItemIds []string //选择的ID
|
cachedList common.List
|
||||||
itemListData *model.ItemModelList
|
itemList *widget.List
|
||||||
fileTotal int //文件总数
|
fileTotal int //文件总数
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFolderList() *folderList {
|
func NewFolderList() *folderList {
|
||||||
return &folderList{
|
return &folderList{
|
||||||
dataBinding: binding.NewUntypedList(),
|
cachedList: common.NewList(""),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *folderList) createList() *widget.List {
|
func (f *folderList) createList() *widget.List {
|
||||||
return widget.NewListWithData(f.dataBinding,
|
return widget.NewList(
|
||||||
func() fyne.CanvasObject {
|
func() int {
|
||||||
return container.NewHBox(
|
return len(f.cachedList.Items)
|
||||||
// &widget.Check{Checked: true},
|
|
||||||
widget.NewCheck("", func(b bool) {}),
|
|
||||||
widget.NewLabelWithStyle("", fyne.TextAlignCenter, fyne.TextStyle{}),
|
|
||||||
widget.NewLabel(""),
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
func(data binding.DataItem, item fyne.CanvasObject) {
|
func() fyne.CanvasObject {
|
||||||
o, _ := data.(binding.Untyped).Get()
|
return widget.NewCheck("Template", func(b bool) {})
|
||||||
pd := o.(*model.ItemModel)
|
},
|
||||||
item.(*fyne.Container).Objects[0].(*widget.Check).OnChanged = 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 {
|
if b {
|
||||||
f.selItemIds = append(f.selItemIds, pd.Id)
|
f.selItemIds = append(f.selItemIds, c.Text)
|
||||||
} else {
|
} 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) {
|
func (f *folderList) initItem(dir string) {
|
||||||
f.itemListData = model.NewItemModelList()
|
|
||||||
|
|
||||||
files, err := ioutil.ReadDir(dir)
|
files, err := ioutil.ReadDir(dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Error(err)
|
logrus.Error(err)
|
||||||
@ -225,23 +226,15 @@ func (f *folderList) initItem(dir string) {
|
|||||||
if file.Name() == ".vscode" {
|
if file.Name() == ".vscode" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
fm := &model.ItemModel{
|
fm := common.Item{
|
||||||
Id: file.Name(),
|
Text: file.Name(),
|
||||||
Label: 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.selItemIds = append(f.selItemIds, fm.Id)
|
||||||
f.fileTotal++
|
f.fileTotal++
|
||||||
// logrus.Debugf("%v", fm.Id)
|
// 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
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"go_dreamfactory/cmd/v2/lib/common"
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
"go_dreamfactory/cmd/v2/model"
|
"go_dreamfactory/cmd/v2/model"
|
||||||
"go_dreamfactory/cmd/v2/service"
|
"go_dreamfactory/cmd/v2/service"
|
||||||
"go_dreamfactory/cmd/v2/service/observer"
|
"go_dreamfactory/cmd/v2/service/observer"
|
||||||
"image/color"
|
"image/color"
|
||||||
"math/rand"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"fyne.io/fyne/v2"
|
||||||
"fyne.io/fyne/v2/canvas"
|
"fyne.io/fyne/v2/canvas"
|
||||||
@ -32,16 +32,18 @@ type appTerm struct {
|
|||||||
obs observer.Observer
|
obs observer.Observer
|
||||||
sshService *service.SSHService
|
sshService *service.SSHService
|
||||||
|
|
||||||
jsonList *fileList //json列表
|
jsonList *common.ItemList //json列表
|
||||||
cProgress *widget.ProgressBarInfinite //连接进度条进度条
|
cProgress *widget.ProgressBarInfinite //连接进度条进度条
|
||||||
upProgress *widget.ProgressBar //上传进度条
|
upProgress *widget.ProgressBar //上传进度条
|
||||||
endProgress sync.WaitGroup
|
endProgress sync.WaitGroup
|
||||||
|
|
||||||
|
downloadList *common.ItemList //download列表
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *appTerm) LazyInit(obs observer.Observer) error {
|
func (this *appTerm) LazyInit(obs observer.Observer) error {
|
||||||
this.obs = obs
|
this.obs = obs
|
||||||
this.sshService = &service.SSHService{}
|
this.sshService = &service.SSHService{}
|
||||||
this.jsonList = NewFileList()
|
this.jsonList = common.NewItemList()
|
||||||
|
|
||||||
//progress
|
//progress
|
||||||
this.cProgress = widget.NewProgressBarInfinite()
|
this.cProgress = widget.NewProgressBarInfinite()
|
||||||
@ -84,7 +86,7 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
&widget.FormItem{Text: "用户名:", Widget: userName},
|
&widget.FormItem{Text: "用户名:", Widget: userName},
|
||||||
passwordItem,
|
passwordItem,
|
||||||
widget.NewFormItem("Json目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
widget.NewFormItem("Json目录", container.NewBorder(nil, nil, nil, widget.NewButtonWithIcon("", theme.FolderIcon(), func() {
|
||||||
openFolder(localDir)
|
openFolder(localDir, toolWin.w)
|
||||||
}), localDir)),
|
}), localDir)),
|
||||||
widget.NewFormItem("远程目录", remoteDir),
|
widget.NewFormItem("远程目录", remoteDir),
|
||||||
)
|
)
|
||||||
@ -112,6 +114,16 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
jsonDir := widget.NewEntry()
|
jsonDir := widget.NewEntry()
|
||||||
jsonDir.PlaceHolder = "Json目录"
|
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
|
//set input entry
|
||||||
if sshConf != nil {
|
if sshConf != nil {
|
||||||
ip.Text = sshConf.Ip
|
ip.Text = sshConf.Ip
|
||||||
@ -126,37 +138,40 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
lubanCli.Text = sshConf.LubanCli
|
lubanCli.Text = sshConf.LubanCli
|
||||||
dataDir.Text = sshConf.DataDir
|
dataDir.Text = sshConf.DataDir
|
||||||
jsonDir.Text = sshConf.JsonDir
|
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()
|
passwordItem.Widget.Refresh()
|
||||||
|
ip.Refresh()
|
||||||
|
localDir.Refresh()
|
||||||
|
workDir.Refresh()
|
||||||
|
|
||||||
// save func
|
// save func
|
||||||
saveFunc := func() {
|
saveFunc := func() {
|
||||||
if err := service.GetDbService().SaveSSHConf(&model.SSHModel{
|
sshConf.Ip = ip.Text
|
||||||
Ip: ip.Text,
|
sshConf.UserName = userName.Text
|
||||||
UserName: userName.Text,
|
sshConf.Password = password.Text
|
||||||
Password: password.Text,
|
sshConf.Port = port.Text
|
||||||
Port: port.Text,
|
sshConf.LocalDir = localDir.Text
|
||||||
LocalDir: localDir.Text,
|
sshConf.RemoteDir = remoteDir.Text
|
||||||
RemoteDir: remoteDir.Text,
|
sshConf.ServerIp = lubanAddr.Text
|
||||||
////
|
sshConf.WorkDir = workDir.Text
|
||||||
ServerIp: lubanAddr.Text,
|
sshConf.LubanCli = lubanCli.Text
|
||||||
WorkDir: workDir.Text,
|
sshConf.DataDir = dataDir.Text
|
||||||
LubanCli: lubanCli.Text,
|
sshConf.JsonDir = jsonDir.Text
|
||||||
DataDir: dataDir.Text,
|
if err := service.GetDbService().SaveSSHConf(sshConf); err != nil {
|
||||||
JsonDir: jsonDir.Text,
|
|
||||||
}); err != nil {
|
|
||||||
logrus.WithField("err", err).Debug("保存配置")
|
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()}
|
syncBtn := &widget.Button{Text: "同步JSON", Icon: theme.ConfirmIcon()}
|
||||||
refreshBtn := &widget.Button{Text: "刷新", Icon: theme.ViewRefreshIcon()}
|
refreshBtn := &widget.Button{Text: "刷新", Icon: theme.ViewRefreshIcon()}
|
||||||
svnBtn := &widget.Button{Text: "SVN更新", Icon: theme.ConfirmIcon()}
|
svnBtn := &widget.Button{Text: "SVN更新", Icon: theme.ConfirmIcon()}
|
||||||
|
excelBtn := &widget.Button{Text: "更新Excel", Icon: theme.FolderIcon()}
|
||||||
explorBtn := &widget.Button{Text: "资源管理器", 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()}
|
allSelBtn := &widget.Button{Icon: theme.CheckButtonCheckedIcon()}
|
||||||
@ -219,55 +238,64 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
connBtn.Enable()
|
connBtn.Enable()
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
this.jsonList.loadItem(localDir.Text)
|
this.jsonList.LoadItem(localDir.Text)
|
||||||
|
|
||||||
this.cProgress.Stop()
|
this.cProgress.Stop()
|
||||||
this.cProgress.Hide()
|
this.cProgress.Hide()
|
||||||
disConnBtn.Enable()
|
disConnBtn.Enable()
|
||||||
syncBtn.Enable()
|
syncBtn.Enable()
|
||||||
this.upProgress.Hide()
|
this.upProgress.Hide()
|
||||||
allCancelBtn.Hide()
|
allCancelBtn.Show()
|
||||||
allSelBtn.Show()
|
allSelBtn.Hide()
|
||||||
refreshBtn.Enable()
|
refreshBtn.Enable()
|
||||||
|
dlBtn.Enable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 刷新JSON列表
|
// 刷新JSON列表
|
||||||
refreshBtn.Disable()
|
refreshBtn.Disable()
|
||||||
refreshBtn.OnTapped = func() {
|
reloadItem := func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
syncBtn.Enable()
|
syncBtn.Enable()
|
||||||
allSelBtn.Show()
|
allSelBtn.Hide()
|
||||||
allCancelBtn.Hide()
|
allCancelBtn.Show()
|
||||||
}()
|
}()
|
||||||
this.jsonList.loadItem(localDir.Text)
|
this.jsonList.LoadItem(localDir.Text)
|
||||||
}
|
}
|
||||||
|
refreshBtn.OnTapped = reloadItem
|
||||||
|
|
||||||
disConnBtn.Disable()
|
|
||||||
// 断开
|
// 断开
|
||||||
|
disConnBtn.Disable()
|
||||||
disConnBtn.OnTapped = func() {
|
disConnBtn.OnTapped = func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
this.jsonList.reset()
|
this.jsonList.Reset()
|
||||||
connBtn.Enable()
|
connBtn.Enable()
|
||||||
disConnBtn.Disable()
|
disConnBtn.Disable()
|
||||||
syncBtn.Disable()
|
syncBtn.Disable()
|
||||||
allSelBtn.Hide()
|
allSelBtn.Hide()
|
||||||
allCancelBtn.Show()
|
allCancelBtn.Show()
|
||||||
refreshBtn.Disable()
|
refreshBtn.Disable()
|
||||||
|
dlBtn.Disable()
|
||||||
}()
|
}()
|
||||||
this.sshService.Close()
|
this.sshService.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
//资源管理器
|
//资源管理器
|
||||||
explorBtn.OnTapped = func() {
|
openExplor := func(dir string) {
|
||||||
logrus.Debug(localDir.Text)
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
if err := exec.Command("explorer", filepath.Join(localDir.Text)).Start(); err != nil {
|
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
|
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 (保持一致)
|
* 服务地址:10.0.1.11 (保持一致)
|
||||||
* 工作目录:svn下ExcelFile目录全路径
|
* 工作目录:svn下ExcelFile目录全路径
|
||||||
* LubanCli:Luban.Client\Luban.Client.exe (保持一致)
|
* LubanCli:Luban.Client\Luban.Client.exe (保持一致)
|
||||||
* Datas:Datas(保持一致)
|
* Data目录:Datas(保持一致)
|
||||||
* JSON目录:output\json(保持一致)
|
* JSON目录:output\json(保持一致)
|
||||||
* 全部填写完点击【保存配置】
|
* 全部填写完点击【保存配置】
|
||||||
* 点击【SVN更新】生成json文件
|
* 点击【SVN更新】生成json文件
|
||||||
@ -317,22 +345,17 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
|
|
||||||
//同步JSON
|
//同步JSON
|
||||||
syncBtn.Disable()
|
syncBtn.Disable()
|
||||||
syncBtn.OnTapped = func() {
|
syncNext := func() {
|
||||||
syncBtn.Disable()
|
|
||||||
defer func() {
|
defer func() {
|
||||||
syncBtn.Enable()
|
syncBtn.Enable()
|
||||||
this.upProgress.Hide()
|
this.upProgress.Hide()
|
||||||
|
dialog.ShowConfirm("提示", "所有文件均上传完毕,静等1-2分钟", func(b bool) {}, toolWin.w)
|
||||||
}()
|
}()
|
||||||
|
syncBtn.Disable()
|
||||||
if this.sshService.Client == nil {
|
|
||||||
dialog.ShowError(errors.New("请先连接终端"), toolWin.w)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
this.upProgress.Show()
|
this.upProgress.Show()
|
||||||
this.upProgress.SetValue(0)
|
this.upProgress.SetValue(0)
|
||||||
|
|
||||||
len := len(this.jsonList.selItemIds)
|
len := len(this.jsonList.SelItemIds)
|
||||||
num := 0.0
|
num := 0.0
|
||||||
|
|
||||||
increment := func(wg *sync.WaitGroup) {
|
increment := func(wg *sync.WaitGroup) {
|
||||||
@ -341,33 +364,67 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
wg.Done()
|
wg.Done()
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, fileName := range this.jsonList.selItemIds {
|
for _, fileName := range this.jsonList.SelItemIds {
|
||||||
this.endProgress.Add(1)
|
this.endProgress.Add(1)
|
||||||
go func(fn string) {
|
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 {
|
if err := this.sshService.ScpCopy(filepath.Join(localDir.Text, fn), remoteDir.Text); err != nil {
|
||||||
logrus.WithField("err", err).Error("同步json")
|
logrus.WithField("err", err).Error("同步json")
|
||||||
showTip(err.Error())
|
common.ShowTip(err.Error())
|
||||||
}
|
}
|
||||||
increment(&this.endProgress)
|
increment(&this.endProgress)
|
||||||
// 移除已上传的
|
// 移除已上传的
|
||||||
this.jsonList.deleteItem(fn)
|
this.jsonList.DeleteItem(fn)
|
||||||
|
common.ShowTip(fmt.Sprintf("%s 成功上传", fn))
|
||||||
}(fileName)
|
}(fileName)
|
||||||
}
|
}
|
||||||
this.endProgress.Wait()
|
this.endProgress.Wait()
|
||||||
this.upProgress.SetValue(1)
|
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更新
|
// SVN更新
|
||||||
svnBtn.OnTapped = func() {
|
svnNext := func() {
|
||||||
this.cProgress.Show()
|
|
||||||
this.cProgress.Start()
|
|
||||||
svnBtn.Disable()
|
|
||||||
defer func() {
|
defer func() {
|
||||||
this.cProgress.Hide()
|
this.cProgress.Hide()
|
||||||
this.cProgress.Stop()
|
this.cProgress.Stop()
|
||||||
svnBtn.Enable()
|
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`
|
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,
|
arg := fmt.Sprintf(commandStr,
|
||||||
filepath.Join(workDir.Text, lubanCli.Text),
|
filepath.Join(workDir.Text, lubanCli.Text),
|
||||||
@ -384,6 +441,22 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
return
|
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() {
|
allCancelBtn.OnTapped = func() {
|
||||||
@ -391,36 +464,73 @@ func (this *appTerm) LazyInit(obs observer.Observer) error {
|
|||||||
allCancelBtn.Hide()
|
allCancelBtn.Hide()
|
||||||
allSelBtn.Show()
|
allSelBtn.Show()
|
||||||
}()
|
}()
|
||||||
for i, v := range this.jsonList.cachedList.Items {
|
for i, v := range this.jsonList.CachedList.Items {
|
||||||
this.jsonList.cachedList.Items[i].Checked = true
|
this.jsonList.CachedList.Items[i].Checked = true
|
||||||
this.jsonList.selItemIds = append(this.jsonList.selItemIds, v.Text)
|
this.jsonList.SelItemIds = append(this.jsonList.SelItemIds, v.Text)
|
||||||
this.jsonList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
this.jsonList.ItemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
||||||
}
|
}
|
||||||
this.jsonList.itemList.Refresh()
|
this.jsonList.ItemList.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 全选
|
// 全选
|
||||||
allSelBtn.OnTapped = func() {
|
allSelBtn.OnTapped = func() {
|
||||||
defer func() {
|
defer func() {
|
||||||
allCancelBtn.Show()
|
allCancelBtn.Show()
|
||||||
allSelBtn.Hide()
|
allSelBtn.Hide()
|
||||||
}()
|
}()
|
||||||
this.jsonList.selItemIds = []string{}
|
this.jsonList.SelItemIds = []string{}
|
||||||
for i, v := range this.jsonList.cachedList.Items {
|
for i, v := range this.jsonList.CachedList.Items {
|
||||||
this.jsonList.cachedList.Items[i].Checked = false
|
this.jsonList.CachedList.Items[i].Checked = false
|
||||||
this.jsonList.itemList.UpdateItem(i, widget.NewCheck(v.Text, nil))
|
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列表
|
// 创建json列表
|
||||||
this.jsonList.itemList = this.jsonList.createList()
|
this.jsonList.ItemList = this.jsonList.CreateDefaultCheckList()
|
||||||
|
|
||||||
btns1 := container.NewHBox(helpBtn1, &layout.Spacer{}, saveBtn1, connBtn, disConnBtn)
|
btns1 := container.NewHBox(helpBtn1, dlBtn, &layout.Spacer{}, saveBtn1, connBtn, disConnBtn)
|
||||||
btns2 := container.NewHBox(helpBtn2, &layout.Spacer{}, saveBtn2, svnBtn)
|
btns2 := container.NewHBox(helpBtn2, &layout.Spacer{}, saveBtn2, excelBtn, svnBtn)
|
||||||
|
|
||||||
split := container.NewHSplit(container.NewVBox(canvas.NewText("---只能在非上产环境!!!同步Json的操作仅限于数值热更,非结构热更---", color.RGBA{255, 0, 0, 255}), configForm,
|
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
|
split.Offset = 0.45
|
||||||
content.Objects = append(content.Objects, container.NewBorder(nil, this.upProgress, nil, nil, split))
|
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
|
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 {
|
func (a *appTerm) OnClose() bool {
|
||||||
dialog.ShowConfirm("关闭终端", "你希望断开连接吗?", func(b bool) {
|
dialog.ShowConfirm("关闭终端", "你希望断开连接吗?", func(b bool) {
|
||||||
if !b {
|
if !b {
|
||||||
@ -444,3 +567,202 @@ func (a *appTerm) OnClose() bool {
|
|||||||
}, toolWin.w)
|
}, toolWin.w)
|
||||||
return true
|
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
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/cmd/v2/lib/common"
|
"go_dreamfactory/cmd/v2/lib/common"
|
||||||
|
|
||||||
"fyne.io/fyne/v2"
|
"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) {
|
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.AddWindow("tool", w)
|
||||||
ui.w = w
|
ui.w = w
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ func (this *toyUserInfo) Init(obs observer.Observer) error {
|
|||||||
this.copyBtn = widget.NewButtonWithIcon("", theme.ContentCopyIcon(), func() {
|
this.copyBtn = widget.NewButtonWithIcon("", theme.ContentCopyIcon(), func() {
|
||||||
if this.userInfo != nil && this.userInfo.DbUser != nil {
|
if this.userInfo != nil && this.userInfo.DbUser != nil {
|
||||||
_ = clipboard.WriteAll(this.userInfo.DbUser.Uid)
|
_ = clipboard.WriteAll(this.userInfo.DbUser.Uid)
|
||||||
showTip("已复制UID到剪贴板")
|
common.ShowTip("已复制UID到剪贴板")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
this.copyBtn.Disable()
|
this.copyBtn.Disable()
|
||||||
@ -115,7 +115,10 @@ func (this *toyUserInfo) dataListener() {
|
|||||||
_ = this.data.Append(this.getActiveWeek()) //11
|
_ = this.data.Append(this.getActiveWeek()) //11
|
||||||
_ = this.data.Append(this.getFriendPoint()) //12
|
_ = this.data.Append(this.getFriendPoint()) //12
|
||||||
_ = this.data.Append(this.getModiNameCount()) //13
|
_ = 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(11, common.USERINFO_ACTIVE_WEEK, rsp.Ex.Activeweek)
|
||||||
this.setProp(12, common.USERINFO_FRIENDPOINT, rsp.Ex.FriendPoint)
|
this.setProp(12, common.USERINFO_FRIENDPOINT, rsp.Ex.FriendPoint)
|
||||||
this.setProp(13, common.USERINFO_MODINAME, rsp.Ex.ModifynameCount)
|
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")
|
logrus.Error("unmarshal err")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.setProp(6, common.USERINFO_GOLD, rsp.Gold)
|
// this.setProp(6, common.USERINFO_GOLD, rsp.Gold)
|
||||||
this.setProp(7, common.USERINFO_EXP, rsp.Exp)
|
// this.setProp(7, common.USERINFO_EXP, rsp.Exp)
|
||||||
this.setProp(8, common.USERINFO_DIAMOND, rsp.Diamond)
|
// this.setProp(8, common.USERINFO_DIAMOND, rsp.Diamond)
|
||||||
}
|
}
|
||||||
// listener exp
|
// listener exp
|
||||||
// if data.Msg.MainType == string(comm.ModuleUser) &&
|
// 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{}) {
|
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 {
|
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)
|
logrus.WithFields(logrus.Fields{"idx": idx, "val": val}).Error(err)
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *toyUserInfo) getAcc() string {
|
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))
|
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 {
|
type TaskListView struct {
|
||||||
ListBaseView
|
BaseformView
|
||||||
|
itemList common.ItemList
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
||||||
// init required
|
this.itemList = *common.NewItemList()
|
||||||
this.initItemList()
|
|
||||||
|
|
||||||
// create friend list view
|
this.itemList.ItemList = this.itemList.CreateList()
|
||||||
this.createItemList()
|
|
||||||
|
|
||||||
// select widget
|
// select widget
|
||||||
tagSelect := getTaskTagSelect()
|
tagSelect := getTaskTagSelect()
|
||||||
@ -46,20 +45,20 @@ func (this *TaskListView) CreateView(t *model.TestCase) fyne.CanvasObject {
|
|||||||
|
|
||||||
// task receive button
|
// task receive button
|
||||||
receiveBtn := widget.NewButtonWithIcon("任务领取", theme.ConfirmIcon(), func() {
|
receiveBtn := widget.NewButtonWithIcon("任务领取", theme.ConfirmIcon(), func() {
|
||||||
if len(this.selItemIds) != 1 {
|
if len(this.itemList.SelItemIds) != 1 {
|
||||||
dialog.ShowError(errors.New("请选择一项"), this.w)
|
dialog.ShowError(errors.New("请选择一项"), this.w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if err := service.GetPttService().SendToClient(
|
if err := service.GetPttService().SendToClient(
|
||||||
t.MainType, "receive",
|
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)
|
logrus.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// layout
|
// 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
|
split.Offset = 1
|
||||||
|
|
||||||
//data listener for
|
//data listener for
|
||||||
@ -83,15 +82,15 @@ func (this *TaskListView) dataListener() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.itemListData = model.NewItemModelList()
|
this.itemList.Reset()
|
||||||
|
|
||||||
for _, v := range rsp.List {
|
for _, v := range rsp.List {
|
||||||
fm := &model.ItemModel{
|
item := common.Item{
|
||||||
Id: cast.ToString(v.Id),
|
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)
|
*data = append(*data, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 3
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/event"
|
"go_dreamfactory/lego/sys/event"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/lego/utils/codec/json"
|
"go_dreamfactory/lego/utils/codec/json"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
@ -74,8 +75,9 @@ func (this *Chat) OnInstallComp() {
|
|||||||
|
|
||||||
//Event------------------------------------------------------------------------------------------------------------
|
//Event------------------------------------------------------------------------------------------------------------
|
||||||
func (this *Chat) EventUserOffline(session comm.IUserSession) {
|
func (this *Chat) EventUserOffline(session comm.IUserSession) {
|
||||||
err := this.modelChat.RemoveCrossChannelMember(session)
|
if err := this.modelChat.RemoveCrossChannelMember(session); err != nil {
|
||||||
this.Debugf("EventUserOffline:%s err:%v", session, err)
|
this.Debug("EventUserOffline:", log.Field{"uid", session.GetUserId()}, log.Field{"err", err})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//对外接口----------------------------------------------------------------------------------------------------------
|
//对外接口----------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3,6 +3,7 @@ package gm
|
|||||||
import (
|
import (
|
||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
@ -69,8 +70,8 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
}, true)
|
}, true)
|
||||||
if code == pb.ErrorCode_Success { // 成功直接返回
|
if code == pb.ErrorCode_Success { // 成功直接返回
|
||||||
session.SendMsg(string(this.GetType()), "cmd", &pb.GMCmdResp{IsSucc: true})
|
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") {
|
} else if len(datas) == 2 && (datas[0] == "mapid") {
|
||||||
module1, err := this.service.GetModule(comm.ModuleMainline)
|
module1, err := this.service.GetModule(comm.ModuleMainline)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -82,6 +83,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
code = module1.(comm.IMainline).ModifyMainlineData(session.GetUserId(), int32(num))
|
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") {
|
} else if len(datas) == 2 && (datas[0] == "pataid") {
|
||||||
module1, err := this.service.GetModule(comm.ModulePagoda)
|
module1, err := this.service.GetModule(comm.ModulePagoda)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -93,6 +95,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
code = module1.(comm.IPagoda).ModifyPagodaFloor(session, int32(num))
|
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") {
|
} else if len(datas) == 1 && (datas[0] == "Iamyoudad" || datas[0] == "iamyoudad") {
|
||||||
var (
|
var (
|
||||||
res []*cfg.Gameatn
|
res []*cfg.Gameatn
|
||||||
@ -107,6 +110,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (code pb.ErrorC
|
|||||||
this.Errorf("资源发放失败,%v", code)
|
this.Errorf("资源发放失败,%v", code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.Debugf("使用bingo命令", log.Field{"uid", session.GetUserId()}, datas[0], res)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package library
|
package library
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
@ -9,27 +10,58 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
game_libraryhero = "game_libraryhero.json"
|
game_libraryhero = "game_libraryhero.json" // 英雄对应的羁绊id信息
|
||||||
game_libraryfetter = "game_libraryfetter.json"
|
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 {
|
type configureComp struct {
|
||||||
modules.MCompConfigure
|
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) {
|
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.MCompConfigure.Init(service, module, comp, options)
|
||||||
|
|
||||||
//err = this.LoadConfigure(game_libraryhero, cfg.NewGameLibraryHero)
|
|
||||||
err = this.LoadMultiConfigure(map[string]interface{}{
|
err = this.LoadMultiConfigure(map[string]interface{}{
|
||||||
game_libraryhero: cfg.NewGameLibraryHero,
|
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
|
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) {
|
func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err error) {
|
||||||
for k, v := range confs {
|
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 v, err := this.GetConfigure(game_libraryhero); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameLibraryHero); ok {
|
if configure, ok := v.(*cfg.GameLibraryHero); ok {
|
||||||
data = configure.Get(hid)
|
data = configure.Get(hid)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Errorf("get game_challenge conf err:%v", err)
|
log.Errorf("get GetLibraryHero conf err:%v", err)
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *configureComp) GetLibraryFetter(fid int32) (data *cfg.GameLibraryFetterData) {
|
func (this *configureComp) GetLibraryFavor(id int32) (data *cfg.GameLibraryFavorData) {
|
||||||
if v, err := this.GetConfigure(game_libraryfetter); err == nil {
|
if v, err := this.GetConfigure(game_libraryfavor); err == nil {
|
||||||
if configure, ok := v.(*cfg.GameLibraryFetter); ok {
|
if configure, ok := v.(*cfg.GameLibraryFavor); ok {
|
||||||
data = configure.Get(fid)
|
data = configure.Get(id)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
} else {
|
} 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
|
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,
|
Fetterlv: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
conf := this.configure.GetLibraryFetter(fid)
|
conf := this.configure.GetLibraryFetter(fid, 1)
|
||||||
if conf == nil {
|
if conf == nil {
|
||||||
for _, v := range conf.Hid {
|
for _, v := range conf.Hid {
|
||||||
obj.Hero[v] = 0
|
obj.Hero[v] = 0
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
"go_dreamfactory/lego/core/cbase"
|
"go_dreamfactory/lego/core/cbase"
|
||||||
|
|
||||||
"go_dreamfactory/lego/sys/log"
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
@ -21,10 +21,10 @@ import (
|
|||||||
*/
|
*/
|
||||||
type ModuleBase struct {
|
type ModuleBase struct {
|
||||||
cbase.ModuleBase
|
cbase.ModuleBase
|
||||||
module core.IModule
|
module core.IModule
|
||||||
service base.IRPCXService
|
service base.IRPCXService
|
||||||
options IOptions
|
options IOptions
|
||||||
scomp comm.ISC_GateRouteComp //网关服务组件
|
scomp comm.ISC_GateRouteComp //网关服务组件
|
||||||
//常用的一些通用模块 在底层注册好
|
//常用的一些通用模块 在底层注册好
|
||||||
ModuleSys comm.ISys //系统
|
ModuleSys comm.ISys //系统
|
||||||
ModuleUser comm.IUser //用户模块
|
ModuleUser comm.IUser //用户模块
|
||||||
@ -292,19 +292,19 @@ func (this *ModuleBase) DispenseRes(session comm.IUserSession, res []*cfg.Gameat
|
|||||||
|
|
||||||
if len(attrs) > 0 { //用户属性资源
|
if len(attrs) > 0 { //用户属性资源
|
||||||
code = this.ModuleUser.AddAttributeValues(session, attrs, bPush)
|
code = this.ModuleUser.AddAttributeValues(session, attrs, bPush)
|
||||||
this.Debugf("发放用户资源: %v", attrs)
|
this.Debugf("发放用户资源: %v [%v]", attrs, code)
|
||||||
}
|
}
|
||||||
if len(items) > 0 { //道具资源
|
if len(items) > 0 { //道具资源
|
||||||
code = this.ModuleItems.AddItems(source, session, items, bPush)
|
code = this.ModuleItems.AddItems(source, session, items, bPush)
|
||||||
this.Debugf("发放道具资源: %v", items)
|
this.Debugf("发放道具资源: %v [%v]", items, code)
|
||||||
}
|
}
|
||||||
if len(heros) > 0 { //卡片资源
|
if len(heros) > 0 { //卡片资源
|
||||||
code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
code = this.ModuleHero.CreateRepeatHeros(session, heros, bPush)
|
||||||
this.Debugf("发放英雄资源: %v", heros)
|
this.Debugf("发放英雄资源: %v [%v]", heros, code)
|
||||||
}
|
}
|
||||||
if len(equips) > 0 {
|
if len(equips) > 0 {
|
||||||
code = this.ModuleEquipment.AddNewEquipments(source, session, equips, bPush)
|
code = this.ModuleEquipment.AddNewEquipments(source, session, equips, bPush)
|
||||||
this.Debugf("发放装备资源: %v", equips)
|
this.Debugf("发放装备资源: %v [%v]", equips, code)
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -84,7 +84,6 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
pagoda.PagodaId = conf.LayerNum // 更新层数
|
pagoda.PagodaId = conf.LayerNum // 更新层数
|
||||||
mapData["pagodaId"] = conf.LayerNum
|
|
||||||
code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
code = this.module.ModifyPagodaData(session.GetUserId(), mapData)
|
||||||
session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda})
|
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{
|
rsp := &pb.RtasklistResp{
|
||||||
RtaskIds: ids,
|
RtaskIds: ids,
|
||||||
|
GroupId: req.GroupId,
|
||||||
}
|
}
|
||||||
if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeList, rsp); err != nil {
|
if err := session.SendMsg(string(this.moduleRtask.GetType()), RtaskSubTypeList, rsp); err != nil {
|
||||||
code = pb.ErrorCode_SystemError
|
code = pb.ErrorCode_SystemError
|
||||||
|
@ -8,6 +8,8 @@ import (
|
|||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
cfg "go_dreamfactory/sys/configure/structs"
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
|
||||||
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ comm.IRtask = (*ModuleRtask)(nil)
|
var _ comm.IRtask = (*ModuleRtask)(nil)
|
||||||
@ -195,12 +197,11 @@ func (this *ModuleRtask) initRtaskVerifyHandle() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.TaskType, params ...int32) (code pb.ErrorCode) {
|
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 (
|
var (
|
||||||
err error
|
err error
|
||||||
condiId int32
|
condiId int32
|
||||||
// condi *rtaskCondi
|
condis []*rtaskCondi
|
||||||
condis []*rtaskCondi
|
|
||||||
)
|
)
|
||||||
|
|
||||||
user := this.ModuleUser.GetUser(session.GetUserId())
|
user := this.ModuleUser.GetUser(session.GetUserId())
|
||||||
@ -210,30 +211,35 @@ func (this *ModuleRtask) SendToRtask(session comm.IUserSession, rtaskType comm.T
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, codi := range this.configure.getRtaskCondis(int32(rtaskType)) {
|
for _, codi := range this.configure.getRtaskCondis(int32(rtaskType)) {
|
||||||
if v, ok := this.handleMap[codi.Id]; ok {
|
v, ok := this.handleMap[codi.Id]
|
||||||
if v.find == nil {
|
if !ok {
|
||||||
return
|
this.Warn("未注册事件处理器", log.Field{"uid", session.GetUserId()}, log.Field{"condiId", codi.Id})
|
||||||
}
|
code = pb.ErrorCode_RtaskCondiNoFound
|
||||||
if condiId, err = v.find(v.cfg, params...); condiId == 0 {
|
return
|
||||||
if err != nil {
|
|
||||||
this.Error(err.Error())
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
condis = append(condis, v)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v.find == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if condiId, err = v.find(v.cfg, params...); condiId == 0 {
|
||||||
|
if err != nil {
|
||||||
|
this.Warn(errors.WithMessage(err, session.GetUserId()).Error())
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
condis = append(condis, v)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update
|
// update
|
||||||
for _, v := range condis {
|
for _, v := range condis {
|
||||||
if v.update != nil {
|
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 {
|
if err := v.update(session.GetUserId(), v.cfg, params...); err != nil {
|
||||||
code = pb.ErrorCode_DBError
|
code = pb.ErrorCode_DBError
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +99,10 @@ func (this *ModelRtaskRecord) addUpdate(uid string, cfg *cfg.GameRdtaskCondiData
|
|||||||
} else {
|
} else {
|
||||||
//查找任务数据
|
//查找任务数据
|
||||||
if v, ok := record.Vals[cfg.Id]; ok {
|
if v, ok := record.Vals[cfg.Id]; ok {
|
||||||
|
newCount := make([]int32, len(vals))
|
||||||
srcCount := v.Data[0]
|
srcCount := v.Data[0]
|
||||||
vals[0] = srcCount + vals[0]
|
newCount[0] = srcCount + vals[0]
|
||||||
v.Data = toMap(vals...)
|
v.Data = toMap(newCount...)
|
||||||
v.Timestamp = time.Now().Unix()
|
v.Timestamp = time.Now().Unix()
|
||||||
|
|
||||||
update := map[string]interface{}{
|
update := map[string]interface{}{
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
event_v2 "go_dreamfactory/lego/sys/event/v2"
|
event_v2 "go_dreamfactory/lego/sys/event/v2"
|
||||||
|
"go_dreamfactory/lego/sys/log"
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
"go_dreamfactory/pb"
|
"go_dreamfactory/pb"
|
||||||
"sort"
|
"sort"
|
||||||
@ -280,31 +281,44 @@ func (this *ModelTask) doTaskHandle(event interface{}, next func(event interface
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if task, ok := this.checkTask(tl.Uid, conf.Key); ok {
|
task, ok := this.checkTask(tl.Uid, conf.Key)
|
||||||
update := make(map[string]interface{})
|
if !ok {
|
||||||
var progress int32
|
this.moduleTask.Debug("任务已完成", log.Field{"uid", tl.Uid}, log.Field{"任务ID", conf.Key})
|
||||||
if code := this.moduleTask.ModuleRtask.CheckCondi(tl.Uid, conf.TypeId); code == pb.ErrorCode_Success {
|
continue
|
||||||
// update data
|
}
|
||||||
if ret != nil && len(ret.Data) > 0 {
|
|
||||||
progress = ret.Data[0]
|
var (
|
||||||
}
|
progress int32
|
||||||
update = map[string]interface{}{
|
update map[string]interface{}
|
||||||
"progress": progress,
|
)
|
||||||
"status": 1,
|
if code := this.moduleTask.ModuleRtask.CheckCondi(tl.Uid, conf.TypeId); code == pb.ErrorCode_Success {
|
||||||
}
|
// update data
|
||||||
// err = this.updateActive(tl.Uid, conf.Key)
|
if ret != nil && len(ret.Data) > 0 {
|
||||||
} else {
|
progress = ret.Data[0]
|
||||||
if ret != nil && len(ret.Data) > 0 {
|
|
||||||
progress = ret.Data[0]
|
|
||||||
}
|
|
||||||
update = map[string]interface{}{
|
|
||||||
"progress": progress,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if err = this.modifyUserTask(tl.Uid, task.Id, update); err != nil {
|
update = map[string]interface{}{
|
||||||
return
|
"progress": progress,
|
||||||
|
"status": 1,
|
||||||
|
}
|
||||||
|
// err = this.updateActive(tl.Uid, conf.Key)
|
||||||
|
} else {
|
||||||
|
if ret != nil && len(ret.Data) > 0 {
|
||||||
|
progress = ret.Data[0]
|
||||||
|
}
|
||||||
|
update = map[string]interface{}{
|
||||||
|
"progress": progress,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
return
|
||||||
}
|
}
|
||||||
|
@ -151,11 +151,11 @@ type DBHero struct {
|
|||||||
IsOverlying bool `protobuf:"varint,23,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true
|
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"` //
|
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
|
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 练功)
|
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"`
|
Suite1Star int32 `protobuf:"varint,27,opt,name=suite1Star,proto3" json:"suite1Star" bson:"suite1Star"` //
|
||||||
Suite2Star int32 `protobuf:"varint,28,opt,name=suite2Star,proto3" json:"suite2Star"`
|
Suite2Star int32 `protobuf:"varint,28,opt,name=suite2Star,proto3" json:"suite2Star" bson:"suite2Star"`
|
||||||
Suite1Lv int32 `protobuf:"varint,29,opt,name=suite1Lv,proto3" json:"suite1Lv"`
|
Suite1Lv int32 `protobuf:"varint,29,opt,name=suite1Lv,proto3" json:"suite1Lv" bson:"suite1Lv"`
|
||||||
Suite2Lv int32 `protobuf:"varint,30,opt,name=suite2Lv,proto3" json:"suite2Lv"`
|
Suite2Lv int32 `protobuf:"varint,30,opt,name=suite2Lv,proto3" json:"suite2Lv" bson:"suite2Lv"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DBHero) Reset() {
|
func (x *DBHero) Reset() {
|
||||||
|
@ -20,61 +20,6 @@ const (
|
|||||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
_ = 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 {
|
type DBLibrary struct {
|
||||||
state protoimpl.MessageState
|
state protoimpl.MessageState
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
@ -84,7 +29,7 @@ type DBLibrary struct {
|
|||||||
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
|
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
|
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
|
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"` // 当前羁绊等级
|
Fetterlv int32 `protobuf:"varint,6,opt,name=fetterlv,proto3" json:"fetterlv"` // 当前羁绊等级
|
||||||
Storyid int32 `protobuf:"varint,7,opt,name=storyid,proto3" json:"storyid"` // 故事id 用来判断是否领奖
|
Storyid int32 `protobuf:"varint,7,opt,name=storyid,proto3" json:"storyid"` // 故事id 用来判断是否领奖
|
||||||
}
|
}
|
||||||
@ -92,7 +37,7 @@ type DBLibrary struct {
|
|||||||
func (x *DBLibrary) Reset() {
|
func (x *DBLibrary) Reset() {
|
||||||
*x = DBLibrary{}
|
*x = DBLibrary{}
|
||||||
if protoimpl.UnsafeEnabled {
|
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 := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -105,7 +50,7 @@ func (x *DBLibrary) String() string {
|
|||||||
func (*DBLibrary) ProtoMessage() {}
|
func (*DBLibrary) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *DBLibrary) ProtoReflect() protoreflect.Message {
|
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 {
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -118,7 +63,7 @@ func (x *DBLibrary) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use DBLibrary.ProtoReflect.Descriptor instead.
|
// Deprecated: Use DBLibrary.ProtoReflect.Descriptor instead.
|
||||||
func (*DBLibrary) Descriptor() ([]byte, []int) {
|
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 {
|
func (x *DBLibrary) GetId() string {
|
||||||
@ -170,35 +115,130 @@ func (x *DBLibrary) GetStoryid() int32 {
|
|||||||
return 0
|
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 protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_library_library_db_proto_rawDesc = []byte{
|
var file_library_library_db_proto_rawDesc = []byte{
|
||||||
0x0a, 0x18, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72,
|
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,
|
0x79, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbf, 0x02, 0x0a, 0x09, 0x44,
|
||||||
0x74, 0x74, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01,
|
||||||
0x09, 0x52, 0x03, 0x63, 0x69, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x02, 0x20, 0x01,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
|
||||||
0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x22, 0xbf, 0x02, 0x0a, 0x09, 0x44, 0x42, 0x4c, 0x69, 0x62,
|
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x69,
|
||||||
0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x66, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x04,
|
||||||
0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
|
0x68, 0x65, 0x72, 0x6f, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x4c,
|
||||||
0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x66, 0x69, 0x64, 0x18, 0x03, 0x20,
|
0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x03, 0x66, 0x69, 0x64, 0x12, 0x28, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f,
|
0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18,
|
||||||
0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61,
|
0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72,
|
||||||
0x72, 0x79, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x68, 0x65,
|
0x79, 0x2e, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x70, 0x72,
|
||||||
0x72, 0x6f, 0x12, 0x2b, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x03, 0x28,
|
0x69, 0x7a, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x18,
|
||||||
0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x2e, 0x50, 0x72,
|
0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x12,
|
||||||
0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x70, 0x72, 0x69, 0x7a, 0x65, 0x12,
|
0x18, 0x0a, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05,
|
||||||
0x1a, 0x0a, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x18, 0x06, 0x20, 0x01, 0x28,
|
0x52, 0x07, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x69, 0x64, 0x1a, 0x37, 0x0a, 0x09, 0x48, 0x65, 0x72,
|
||||||
0x05, 0x52, 0x08, 0x66, 0x65, 0x74, 0x74, 0x65, 0x72, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x73,
|
0x6f, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20,
|
||||||
0x74, 0x6f, 0x72, 0x79, 0x69, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x73, 0x74,
|
0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
|
||||||
0x6f, 0x72, 0x79, 0x69, 0x64, 0x1a, 0x37, 0x0a, 0x09, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x6e, 0x74,
|
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
|
||||||
0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x38, 0x01, 0x1a, 0x38, 0x0a, 0x0a, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79,
|
||||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20,
|
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b,
|
||||||
0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x38,
|
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||||
0x0a, 0x0a, 0x50, 0x72, 0x69, 0x7a, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
|
0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x9c, 0x01, 0x0a,
|
||||||
0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
|
0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x46, 0x65, 0x74, 0x74, 0x65, 0x72, 0x12, 0x0e, 0x0a,
|
||||||
0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76,
|
0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a,
|
||||||
0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
|
0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12,
|
||||||
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
@ -215,10 +255,10 @@ 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_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||||
var file_library_library_db_proto_goTypes = []interface{}{
|
var file_library_library_db_proto_goTypes = []interface{}{
|
||||||
(*Fetter)(nil), // 0: Fetter
|
(*DBLibrary)(nil), // 0: DBLibrary
|
||||||
(*DBLibrary)(nil), // 1: DBLibrary
|
(*DBHeroFetter)(nil), // 1: DBHeroFetter
|
||||||
nil, // 2: DBLibrary.HeroEntry
|
nil, // 2: DBLibrary.HeroEntry
|
||||||
nil, // 3: DBLibrary.PrizeEntry
|
nil, // 3: DBLibrary.PrizeEntry
|
||||||
}
|
}
|
||||||
var file_library_library_db_proto_depIdxs = []int32{
|
var file_library_library_db_proto_depIdxs = []int32{
|
||||||
2, // 0: DBLibrary.hero:type_name -> DBLibrary.HeroEntry
|
2, // 0: DBLibrary.hero:type_name -> DBLibrary.HeroEntry
|
||||||
@ -237,7 +277,7 @@ func file_library_library_db_proto_init() {
|
|||||||
}
|
}
|
||||||
if !protoimpl.UnsafeEnabled {
|
if !protoimpl.UnsafeEnabled {
|
||||||
file_library_library_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
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:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
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{} {
|
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:
|
case 0:
|
||||||
return &v.state
|
return &v.state
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -177,6 +177,7 @@ type RtasklistResp struct {
|
|||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
RtaskIds []int32 `protobuf:"varint,1,rep,packed,name=rtaskIds,proto3" json:"rtaskIds"`
|
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() {
|
func (x *RtasklistResp) Reset() {
|
||||||
@ -218,6 +219,13 @@ func (x *RtasklistResp) GetRtaskIds() []int32 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *RtasklistResp) GetGroupId() int32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GroupId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
// 对话选项
|
// 对话选项
|
||||||
type RtaskChooseReq struct {
|
type RtaskChooseReq struct {
|
||||||
state protoimpl.MessageState
|
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,
|
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,
|
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,
|
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,
|
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, 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,
|
0x6b, 0x49, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18,
|
||||||
0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49,
|
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x22, 0x66,
|
||||||
0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64,
|
0x0a, 0x0e, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71,
|
||||||
0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01,
|
0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||||
0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a,
|
0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68,
|
||||||
0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68,
|
||||||
0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x0f,
|
0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53,
|
||||||
0x52, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12,
|
0x75, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73,
|
||||||
0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
|
0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x43,
|
||||||
0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f,
|
0x68, 0x6f, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61,
|
||||||
0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f,
|
0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73,
|
||||||
0x6f, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75,
|
0x6b, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18,
|
||||||
0x62, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x12,
|
||||||
0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x2b, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69,
|
0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x03, 0x20,
|
||||||
0x6e, 0x69, 0x73, 0x68, 0x50, 0x75, 0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73,
|
0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22,
|
||||||
0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
0x2b, 0x0a, 0x0f, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x50, 0x75,
|
||||||
0x49, 0x64, 0x22, 0x4d, 0x0a, 0x11, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65,
|
0x73, 0x68, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20,
|
||||||
0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x4d, 0x0a, 0x11,
|
||||||
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49,
|
0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65,
|
||||||
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,
|
|
||||||
0x71, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
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,
|
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,
|
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,
|
0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x4e, 0x0a, 0x12, 0x52,
|
||||||
0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63,
|
0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73,
|
||||||
0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49, 0x64, 0x22, 0x51, 0x0a, 0x15, 0x52, 0x74, 0x61, 0x73, 0x6b,
|
0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70,
|
0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72,
|
||||||
0x12, 0x18, 0x0a, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||||
0x05, 0x52, 0x07, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74,
|
0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x6d, 0x0a, 0x13, 0x52,
|
||||||
0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
|
0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52,
|
||||||
0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62, 0x49, 0x64, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x74,
|
0x65, 0x71, 0x12, 0x22, 0x0a, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6e, 0x66,
|
||||||
0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x65, 0x71, 0x22,
|
0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
||||||
0x3c, 0x0a, 0x12, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x47, 0x65, 0x74, 0x72, 0x65, 0x63, 0x6f, 0x72,
|
0x43, 0x6f, 0x6e, 0x66, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f,
|
||||||
0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x26, 0x0a, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x18,
|
0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73,
|
||||||
0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x42, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x52,
|
0x12, 0x18, 0x0a, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x64, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28,
|
||||||
0x65, 0x63, 0x6f, 0x72, 0x64, 0x52, 0x06, 0x72, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x22, 0x94, 0x01,
|
0x09, 0x52, 0x07, 0x74, 0x65, 0x61, 0x6d, 0x69, 0x64, 0x73, 0x22, 0x37, 0x0a, 0x14, 0x52, 0x74,
|
||||||
0x0a, 0x0c, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c,
|
0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x52, 0x65,
|
||||||
0x0a, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
0x73, 0x70, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
|
||||||
0x05, 0x52, 0x09, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06,
|
0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69,
|
||||||
0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x06, 0x70, 0x61,
|
0x6e, 0x66, 0x6f, 0x22, 0x6c, 0x0a, 0x14, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74,
|
||||||
0x72, 0x61, 0x6d, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x18,
|
0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x72,
|
||||||
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x49, 0x64, 0x12, 0x18,
|
0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74,
|
||||||
0x0a, 0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
|
0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75,
|
||||||
0x07, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61, 0x73,
|
0x62, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b,
|
||||||
0x6b, 0x49, 0x64, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x74, 0x61, 0x73,
|
0x53, 0x75, 0x62, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49,
|
||||||
0x6b, 0x49, 0x64, 0x73, 0x22, 0x3f, 0x0a, 0x0d, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x54, 0x65, 0x73,
|
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x68, 0x6f, 0x6f, 0x73, 0x65, 0x49,
|
||||||
0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x18, 0x01, 0x20,
|
0x64, 0x22, 0x51, 0x0a, 0x15, 0x52, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65,
|
||||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x66, 0x6c, 0x61, 0x67, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x74, 0x61,
|
0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x72, 0x74,
|
||||||
0x73, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x72, 0x74, 0x61,
|
0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x72, 0x74, 0x61,
|
||||||
0x73, 0x6b, 0x49, 0x64, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
|
0x73, 0x6b, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x74, 0x61, 0x73, 0x6b, 0x53, 0x75, 0x62,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x33,
|
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 (
|
var (
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"go_dreamfactory/modules/hero"
|
"go_dreamfactory/modules/hero"
|
||||||
"go_dreamfactory/modules/hunting"
|
"go_dreamfactory/modules/hunting"
|
||||||
"go_dreamfactory/modules/items"
|
"go_dreamfactory/modules/items"
|
||||||
|
"go_dreamfactory/modules/library"
|
||||||
"go_dreamfactory/modules/linestory"
|
"go_dreamfactory/modules/linestory"
|
||||||
"go_dreamfactory/modules/mail"
|
"go_dreamfactory/modules/mail"
|
||||||
"go_dreamfactory/modules/mainline"
|
"go_dreamfactory/modules/mainline"
|
||||||
@ -81,6 +82,7 @@ func main() {
|
|||||||
hunting.NewModule(),
|
hunting.NewModule(),
|
||||||
battle.NewModule(),
|
battle.NewModule(),
|
||||||
linestory.NewModule(),
|
linestory.NewModule(),
|
||||||
|
library.NewModule(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user