|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
"flx/Common"
|
|
|
|
"flx/DAL"
|
|
|
|
"flx/Model"
|
|
|
|
"flx/localcache"
|
|
|
|
"os"
|
|
|
|
"os/exec"
|
|
|
|
"runtime"
|
|
|
|
"strings"
|
|
|
|
"syscall"
|
|
|
|
|
|
|
|
"fmt"
|
|
|
|
"image/color"
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"fyne.io/fyne/v2"
|
|
|
|
"fyne.io/fyne/v2/canvas"
|
|
|
|
"fyne.io/fyne/v2/container"
|
|
|
|
"github.com/StackExchange/wmi"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
|
|
|
var Smainview *fyne.Container
|
|
|
|
|
|
|
|
// 会议名称
|
|
|
|
var lblSCongressName *canvas.Text
|
|
|
|
|
|
|
|
// 日程名称
|
|
|
|
var lblSAgendaName *canvas.Text
|
|
|
|
var lblSShoudNum *canvas.Text
|
|
|
|
var lblSArriveNum *canvas.Text
|
|
|
|
var lblSNoNum *canvas.Text
|
|
|
|
var lblSArrivePercent *canvas.Text
|
|
|
|
|
|
|
|
// var lblSCArriveNum *canvas.Text
|
|
|
|
var lblSTime *canvas.Text
|
|
|
|
var lblSPersonContent *canvas.Text
|
|
|
|
|
|
|
|
// 当前报到人图片
|
|
|
|
var imgSCurrentPerson *canvas.Image
|
|
|
|
|
|
|
|
// 图片
|
|
|
|
var imgSPerson1 *canvas.Image
|
|
|
|
var imgSPerson2 *canvas.Image
|
|
|
|
var imgSPerson3 *canvas.Image
|
|
|
|
var imgSPerson4 *canvas.Image
|
|
|
|
var imgSPerson5 *canvas.Image
|
|
|
|
var imgSPerson6 *canvas.Image
|
|
|
|
|
|
|
|
// 应到人员
|
|
|
|
var SShouldNum int
|
|
|
|
|
|
|
|
// 实到人员
|
|
|
|
var SArriveNum int
|
|
|
|
|
|
|
|
// 本机报到人员
|
|
|
|
var SCArriveNum int
|
|
|
|
|
|
|
|
// 未到人员
|
|
|
|
var SNoArriveNum int
|
|
|
|
|
|
|
|
// func SMainWindowControl() {
|
|
|
|
// SFormJsonLoad()
|
|
|
|
// // ScreenWindow = NAPP.NewWindow("飞利信报道门系统")
|
|
|
|
// drv := NAPP.Driver()
|
|
|
|
// if drv, ok := drv.(desktop.Driver); ok {
|
|
|
|
// ScreenWindow = drv.CreateSplashWindow()
|
|
|
|
// }
|
|
|
|
// Smainview = container.NewMax()
|
|
|
|
// //现在设计了两个布局 1080*1920-SDefaultLayout 和 960*720-SDefaultLayout1
|
|
|
|
// SetSCongressStatus(0)
|
|
|
|
// ScreenWindow.SetContent(Smainview)
|
|
|
|
// // MainWindow.Maxwindow()
|
|
|
|
// // ScreenWindow.Resize(fyne.NewSize(960, 720), 1920, 0)
|
|
|
|
// ScreenWindow.Resize(fyne.NewSize(960, 720))
|
|
|
|
// // MainWindow.SetMaster()
|
|
|
|
// ScreenWindow.Show()
|
|
|
|
// go ReLocal()
|
|
|
|
// }
|
|
|
|
var ChromeCmd *exec.Cmd
|
|
|
|
|
|
|
|
func SMainWindowControl() {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SMainWindowControl:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
// SFormJsonLoad()
|
|
|
|
// drv := NAPP.Driver()
|
|
|
|
// if drv, ok := drv.(desktop.Driver); ok {
|
|
|
|
// ScreenWindow = drv.CreateSplashWindow()
|
|
|
|
// }
|
|
|
|
|
|
|
|
// chromePath, err := getChromePath()
|
|
|
|
// if err != nil {
|
|
|
|
// log.Fatal("Unable to find Chrome installation path:", err)
|
|
|
|
// }
|
|
|
|
doorName := Common.LoadConfig().CheckInDoor.DoorName
|
|
|
|
chromePath := Common.LoadConfig().CheckInDoor.ChromePath
|
|
|
|
url := "http://localhost:9999/screen/web/meetingview.html?id=" + doorName
|
|
|
|
windowsize := Common.LoadConfig().CheckInDoor.Windowsize
|
|
|
|
windowposition := Common.LoadConfig().CheckInDoor.Windowposition
|
|
|
|
ChromeCmd = exec.Command(
|
|
|
|
chromePath,
|
|
|
|
// `C:\Program Files\Google\Chrome\Application\chrome.exe`,
|
|
|
|
"--app="+url, // 使用 --app 参数,去掉 UI 控件
|
|
|
|
"--start-fullscreen", // 强制全屏
|
|
|
|
"--force-device-scale-factor=1", // 锁定缩放比例
|
|
|
|
"--high-dpi-support=1", // 启用高DPI兼容 :ml-citation{ref="10,11" data="citationList"}
|
|
|
|
"--window-size="+windowsize, // 设置窗口大小
|
|
|
|
"--window-position="+windowposition, // 设置窗口在第二个屏幕左上角
|
|
|
|
)
|
|
|
|
|
|
|
|
if err := ChromeCmd.Start(); err != nil {
|
|
|
|
log.Fatal("Firefox launch failed:", err)
|
|
|
|
}
|
|
|
|
fmt.Println("Firefox started with PID:", ChromeCmd.Process.Pid)
|
|
|
|
|
|
|
|
// w := webview.NewWindow(true, nil)
|
|
|
|
// defer w.Destroy()
|
|
|
|
|
|
|
|
// // 获取本地HTML文件的绝对路径
|
|
|
|
// htmlPath := filepath.Join("path", "to", "local.html")
|
|
|
|
// url := "file://" + filepath.ToSlash(htmlPath) // 确保路径斜杠兼容
|
|
|
|
|
|
|
|
// w.SetTitle("Local HTML Viewer")
|
|
|
|
// // w.SetSize(800, 600, webview.HintNone)
|
|
|
|
// w.Navigate(url)
|
|
|
|
// w.Run()
|
|
|
|
|
|
|
|
// cmd.Start()
|
|
|
|
|
|
|
|
// 关键关联步骤
|
|
|
|
// window.SetContent(text)
|
|
|
|
// window.Resize(fyne.NewSize(800, 600))
|
|
|
|
// window.Show()
|
|
|
|
|
|
|
|
// webview.Open("Meeting Display", "file://path/to/your/meetingview.html", 800, 600, true)
|
|
|
|
|
|
|
|
// absPath, _ := filepath.Abs("mister/screen/web/meetingview.html")
|
|
|
|
|
|
|
|
// urlStr := "file://" + filepath.ToSlash(absPath)
|
|
|
|
// parsedURL, _ := url.Parse(urlStr)
|
|
|
|
|
|
|
|
// if err := fyne.CurrentApp().OpenURL(parsedURL); err != nil {
|
|
|
|
// dialog.ShowError(err, ScreenWindow) // 增强错误提示:ml-citation{ref="4" data="citationList"}
|
|
|
|
// }
|
|
|
|
|
|
|
|
SetSCongressStatus(0)
|
|
|
|
|
|
|
|
// 窗口尺寸控制
|
|
|
|
// ScreenWindow.SetContent(Smainview)
|
|
|
|
// ScreenWindow.Resize(fyne.NewSize(2500, 1500))
|
|
|
|
// ScreenWindow.Show()
|
|
|
|
// go ReLocal()
|
|
|
|
}
|
|
|
|
|
|
|
|
func closeChromeWindow(cmd *exec.Cmd) error {
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("closeChromeWindow:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
cmd.Process.Kill() // 强制终止
|
|
|
|
// 获取程序名称
|
|
|
|
// programName := os.Args[0] // 使用当前程序的路径
|
|
|
|
// 获取当前线程 ID
|
|
|
|
pid := os.Getpid()
|
|
|
|
fmt.Println(KillProcess)
|
|
|
|
KillProcess(pid)
|
|
|
|
if cmd.Process == nil {
|
|
|
|
return errors.New("process not running")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func KillProcess(pid int) error {
|
|
|
|
switch runtime.GOOS {
|
|
|
|
case "windows":
|
|
|
|
return exec.Command("taskkill", "/F", "/PID", strconv.Itoa(pid)).Run()
|
|
|
|
default:
|
|
|
|
proc, err := os.FindProcess(pid)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return proc.Kill() // 使用os包替代syscall
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
type Chrome struct {
|
|
|
|
Path string
|
|
|
|
}
|
|
|
|
|
|
|
|
func getChromePath() (string, error) {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("getChromePath:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
var dst []Chrome
|
|
|
|
query := "SELECT * FROM Win32_Product WHERE Name = 'Google Chrome'"
|
|
|
|
err := wmi.Query(query, &dst)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(dst) > 0 {
|
|
|
|
fmt.Println("Chrome Path:", dst[0].Path)
|
|
|
|
} else {
|
|
|
|
fmt.Println("Chrome not installed.")
|
|
|
|
}
|
|
|
|
|
|
|
|
return dst[0].Path, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// func SMainWindowControl() {
|
|
|
|
// // 创建应用
|
|
|
|
// myApp := app.New()
|
|
|
|
|
|
|
|
// // 创建主窗口(可控制大小)
|
|
|
|
// mainWindow := myApp.NewWindow("会议视图")
|
|
|
|
// mainWindow.Resize(fyne.NewSize(800, 600)) // 设置初始窗口大小
|
|
|
|
// mainWindow.SetFixedSize(false) // 允许用户调整窗口大小
|
|
|
|
|
|
|
|
// htmlPath, _ := filepath.Abs("mister/screen/web/meetingview.html")
|
|
|
|
|
|
|
|
// // 创建WebView组件加载HTML
|
|
|
|
// webView := widget.NewHyperlink("打开会议视图", &url.URL{
|
|
|
|
// Scheme: "file",
|
|
|
|
// Path: htmlPath, // 确保文件在可执行文件同级目录
|
|
|
|
// })
|
|
|
|
|
|
|
|
// // 设置窗口内容
|
|
|
|
// mainWindow.SetContent(container.NewVBox(
|
|
|
|
// webView,
|
|
|
|
// widget.NewButton("关闭", func() {
|
|
|
|
// mainWindow.Close()
|
|
|
|
// }),
|
|
|
|
// ))
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
func ReLocal() {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("ReLocal:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
time.Sleep(4 * time.Second)
|
|
|
|
|
|
|
|
// ScreenWindow.Resize(fyne.NewSize(1080, 1919), 1920, 0)
|
|
|
|
// ScreenWindow.Resize(fyne.NewSize(1080, 1919), 1920, 0)
|
|
|
|
// ScreenWindow.Resize(fyne.NewSize(960, 720), 1920, 0)
|
|
|
|
ScreenWindow.Resize(fyne.NewSize(960, 720))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetSCongressStatus(Index int) {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SetSCongressStatus:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
SFromLoad(0)
|
|
|
|
return
|
|
|
|
// if Index == 1 {
|
|
|
|
// Smainview.Remove(Smainview.Objects[0])
|
|
|
|
// //现在设计了两个布局 1080*1920-SDefaultLayout 和 960*720-SDefaultLayout1
|
|
|
|
// Smainview.Add(SDefaultLayout1())
|
|
|
|
// lblSCongressName.Text = CurrentCongress.Co_Name
|
|
|
|
// lblSCongressName.Refresh()
|
|
|
|
// lblSAgendaName.Text = CurrentAgenda.Ag_Name
|
|
|
|
// lblSAgendaName.Refresh()
|
|
|
|
// } else if Index == 2 {
|
|
|
|
// Smainview.Remove(Smainview.Objects[0])
|
|
|
|
// //现在设计了两个布局 1080*1920-SReportLayout 和 960*720-SReportLayout1
|
|
|
|
// Smainview.Add(SReportLayout1())
|
|
|
|
// } else {
|
|
|
|
// Smainview.Remove(Smainview.Objects[0])
|
|
|
|
// //现在设计了两个布局 1080*1920-SDefaultLayout 和 960*720-SDefaultLayout1
|
|
|
|
// Smainview.Add(SDefaultLayout1())
|
|
|
|
// lblSCongressName.Text = "报到门系统"
|
|
|
|
// lblSCongressName.Refresh()
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
// 二屏
|
|
|
|
func SDefaultLayout() fyne.CanvasObject {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SDefaultLayout:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
//国徽 图标
|
|
|
|
var imagepath string
|
|
|
|
iconType := Common.LoadConfig().CheckInDoor.IconType
|
|
|
|
if iconType == "1" {
|
|
|
|
imagepath = "./images/guohui.png"
|
|
|
|
}
|
|
|
|
if iconType == "2" {
|
|
|
|
imagepath = "./images/huibiao.png"
|
|
|
|
}
|
|
|
|
imgIcon := canvas.NewImageFromFile(imagepath)
|
|
|
|
imgIcon.Resize(fyne.NewSize(480, 640))
|
|
|
|
imgIcon.Move(fyne.NewPos(300*1.6, 190*1.6))
|
|
|
|
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
lblSCongressName = canvas.NewText("飞利信报道门系统", color.Black)
|
|
|
|
lblSCongressName.TextSize = 100
|
|
|
|
lblSCongressName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSCongressName.Resize(fyne.NewSize(880, 400))
|
|
|
|
lblSCongressName.Move(fyne.NewPos(100*1.6, 900*1.6))
|
|
|
|
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
lblSAgendaName = canvas.NewText("", color.Black)
|
|
|
|
lblSAgendaName.TextSize = 150
|
|
|
|
lblSAgendaName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSAgendaName.Resize(fyne.NewSize(880, 200))
|
|
|
|
lblSAgendaName.Move(fyne.NewPos(100, 1300))
|
|
|
|
|
|
|
|
lblSTime = canvas.NewText("2021年11月22日 16:56", color.Black)
|
|
|
|
lblSTime.TextSize = 20
|
|
|
|
lblSTime.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSTime.Resize(fyne.NewSize(300, 50))
|
|
|
|
lblSTime.Move(fyne.NewPos(50, 1800))
|
|
|
|
go SShowTime(lblSTime)
|
|
|
|
// datebind := binding.NewString()
|
|
|
|
// checkLabel := widget.NewLabelWithData(datebind)
|
|
|
|
// lbltext := widget.NewLabel(time.Now().Format("2006年01月02日 15:04:05"))
|
|
|
|
|
|
|
|
// lblTime := widget.NewLabel(time.Now().Format("2006年01月02日 15:04:05"))
|
|
|
|
|
|
|
|
// lblTime.Alignment = fyne.TextAlignCenter
|
|
|
|
// lblTime.Resize(fyne.NewSize(300, 50))
|
|
|
|
// lblTime.Move(fyne.NewPos(150, 1000))
|
|
|
|
// ShowTime1(lblt)
|
|
|
|
|
|
|
|
content := container.NewWithoutLayout(
|
|
|
|
imgIcon,
|
|
|
|
lblSTime,
|
|
|
|
lblSCongressName,
|
|
|
|
)
|
|
|
|
return content
|
|
|
|
}
|
|
|
|
|
|
|
|
func SDefaultLayout1() fyne.CanvasObject {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SDefaultLayout1:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
//国徽 图标
|
|
|
|
var imagepath string
|
|
|
|
iconType := Common.LoadConfig().CheckInDoor.IconType
|
|
|
|
if iconType == "1" {
|
|
|
|
imagepath = "./images/guohui.png"
|
|
|
|
}
|
|
|
|
if iconType == "2" {
|
|
|
|
imagepath = "./images/huibiao.png"
|
|
|
|
}
|
|
|
|
imgIcon := canvas.NewImageFromFile(imagepath)
|
|
|
|
imgIcon.Resize(fyne.NewSize(360, 360))
|
|
|
|
imgIcon.Move(fyne.NewPos(300, 100))
|
|
|
|
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
lblSCongressName = canvas.NewText("飞利信报道门系统", color.Black)
|
|
|
|
lblSCongressName.TextSize = 100
|
|
|
|
lblSCongressName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSCongressName.Resize(fyne.NewSize(760, 120))
|
|
|
|
lblSCongressName.Move(fyne.NewPos(100, 500))
|
|
|
|
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
lblSAgendaName = canvas.NewText("", color.Black)
|
|
|
|
lblSAgendaName.TextSize = 100
|
|
|
|
lblSAgendaName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSAgendaName.Resize(fyne.NewSize(760, 120))
|
|
|
|
lblSAgendaName.Move(fyne.NewPos(100, 610))
|
|
|
|
|
|
|
|
lblSTime = canvas.NewText("2021年11月22日 16:56", color.Black)
|
|
|
|
lblSTime.TextSize = 20
|
|
|
|
lblSTime.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSTime.Resize(fyne.NewSize(300, 30))
|
|
|
|
lblSTime.Move(fyne.NewPos(50, 680))
|
|
|
|
go SShowTime(lblSTime)
|
|
|
|
// datebind := binding.NewString()
|
|
|
|
// checkLabel := widget.NewLabelWithData(datebind)
|
|
|
|
// lbltext := widget.NewLabel(time.Now().Format("2006年01月02日 15:04:05"))
|
|
|
|
|
|
|
|
// lblTime := widget.NewLabel(time.Now().Format("2006年01月02日 15:04:05"))
|
|
|
|
|
|
|
|
// lblTime.Alignment = fyne.TextAlignCenter
|
|
|
|
// lblTime.Resize(fyne.NewSize(300, 50))
|
|
|
|
// lblTime.Move(fyne.NewPos(150, 1000))
|
|
|
|
// ShowTime1(lblt)
|
|
|
|
|
|
|
|
content := container.NewWithoutLayout(
|
|
|
|
imgIcon,
|
|
|
|
lblSTime,
|
|
|
|
lblSCongressName,
|
|
|
|
)
|
|
|
|
return content
|
|
|
|
}
|
|
|
|
|
|
|
|
// update time show
|
|
|
|
func SShowTime(lblt *canvas.Text) {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SShowTime:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
for {
|
|
|
|
lblt.Text = time.Now().Format("2006年01月02日 15:04:05")
|
|
|
|
lblt.Refresh()
|
|
|
|
time.Sleep(1 * time.Second)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func SReportLayout() fyne.CanvasObject {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SReportLayout:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
//国徽 图标
|
|
|
|
var imagepath string
|
|
|
|
iconType := Common.LoadConfig().CheckInDoor.IconType
|
|
|
|
if iconType == "1" {
|
|
|
|
imagepath = "./images/guohui.png"
|
|
|
|
}
|
|
|
|
if iconType == "2" {
|
|
|
|
imagepath = "./images/huibiao.png"
|
|
|
|
}
|
|
|
|
imgIcon := canvas.NewImageFromFile(imagepath)
|
|
|
|
imgIcon.Resize(fyne.NewSize(180, 200))
|
|
|
|
imgIcon.Move(fyne.NewPos(50, 50))
|
|
|
|
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
lblSCongressName = canvas.NewText(localcache.CurrentCongress.Co_Name, color.Black)
|
|
|
|
lblSCongressName.TextSize = 50
|
|
|
|
lblSCongressName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSCongressName.Resize(fyne.NewSize(750, 80))
|
|
|
|
lblSCongressName.Move(fyne.NewPos(250, 60))
|
|
|
|
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
lblSAgendaName = canvas.NewText(localcache.CurrentAgenda.Ag_Name, color.Black)
|
|
|
|
lblSAgendaName.TextSize = 50
|
|
|
|
lblSAgendaName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSAgendaName.Resize(fyne.NewSize(750, 80))
|
|
|
|
lblSAgendaName.Move(fyne.NewPos(250, 160))
|
|
|
|
|
|
|
|
// 应到
|
|
|
|
lblSShoudNumName := canvas.NewText("应 到", color.Black)
|
|
|
|
lblSShoudNumName.TextSize = 60
|
|
|
|
lblSShoudNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSShoudNumName.Resize(fyne.NewSize(150, 70))
|
|
|
|
lblSShoudNumName.Move(fyne.NewPos(90, 1650))
|
|
|
|
|
|
|
|
lblSShoudNum = canvas.NewText("333", color.Black)
|
|
|
|
lblSShoudNum.TextSize = 60
|
|
|
|
lblSShoudNum.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSShoudNum.Resize(fyne.NewSize(150, 70))
|
|
|
|
lblSShoudNum.Move(fyne.NewPos(240, 1650))
|
|
|
|
|
|
|
|
// 实到
|
|
|
|
lblSArriveNumName := canvas.NewText("实 到", color.Black)
|
|
|
|
lblSArriveNumName.TextSize = 60
|
|
|
|
lblSArriveNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSArriveNumName.Resize(fyne.NewSize(150, 70))
|
|
|
|
lblSArriveNumName.Move(fyne.NewPos(390, 1650))
|
|
|
|
|
|
|
|
lblSArriveNum = canvas.NewText("333", color.Black)
|
|
|
|
lblSArriveNum.TextSize = 60
|
|
|
|
lblSArriveNum.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSArriveNum.Resize(fyne.NewSize(150, 70))
|
|
|
|
lblSArriveNum.Move(fyne.NewPos(540, 1650))
|
|
|
|
|
|
|
|
// 未到
|
|
|
|
lblSNoNumName := canvas.NewText("未 到", color.Black)
|
|
|
|
lblSNoNumName.TextSize = 60
|
|
|
|
lblSNoNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSNoNumName.Resize(fyne.NewSize(150, 70))
|
|
|
|
lblSNoNumName.Move(fyne.NewPos(690, 1650))
|
|
|
|
|
|
|
|
lblSNoNum = canvas.NewText("333", color.Black)
|
|
|
|
lblSNoNum.TextSize = 60
|
|
|
|
lblSNoNum.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSNoNum.Resize(fyne.NewSize(150, 70))
|
|
|
|
lblSNoNum.Move(fyne.NewPos(840, 1650))
|
|
|
|
// // 本机报到
|
|
|
|
// lblSCArriveNumName := canvas.NewText("本机报到", color.Black)
|
|
|
|
// lblSCArriveNumName.TextSize = 65
|
|
|
|
// lblSCArriveNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
// lblSCArriveNumName.Resize(fyne.NewSize(170, 60))
|
|
|
|
// lblSCArriveNumName.Move(fyne.NewPos(95, 850))
|
|
|
|
|
|
|
|
lblSPersonContent = canvas.NewText("", color.Black)
|
|
|
|
lblSPersonContent.TextSize = 75
|
|
|
|
lblSPersonContent.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSPersonContent.Resize(fyne.NewSize(880, 80))
|
|
|
|
lblSPersonContent.Move(fyne.NewPos(0, 1125))
|
|
|
|
|
|
|
|
//当前报到人
|
|
|
|
imgSCurrentPerson = canvas.NewImageFromFile("")
|
|
|
|
imgSCurrentPerson.Resize(fyne.NewSize(525, 735))
|
|
|
|
imgSCurrentPerson.Move(fyne.NewPos(278, 350))
|
|
|
|
|
|
|
|
//历史报到人1
|
|
|
|
imgSPerson1 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson1.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson1.Move(fyne.NewPos(160, 1250))
|
|
|
|
|
|
|
|
//历史报到人2
|
|
|
|
imgSPerson2 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson2.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson2.Move(fyne.NewPos(320, 1250))
|
|
|
|
|
|
|
|
//历史报到人3
|
|
|
|
imgSPerson3 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson3.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson3.Move(fyne.NewPos(480, 1250))
|
|
|
|
|
|
|
|
//历史报到人4
|
|
|
|
imgSPerson4 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson4.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson4.Move(fyne.NewPos(640, 1250))
|
|
|
|
|
|
|
|
//当历史报到人5
|
|
|
|
imgSPerson5 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson5.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson5.Move(fyne.NewPos(800, 1250))
|
|
|
|
|
|
|
|
//历史报到人6
|
|
|
|
imgSPerson6 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson6.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson6.Move(fyne.NewPos(960, 1250))
|
|
|
|
|
|
|
|
//时间
|
|
|
|
lblSTime = canvas.NewText("2021年11月22日 16:56", color.Black)
|
|
|
|
lblSTime.TextSize = 20
|
|
|
|
lblSTime.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSTime.Resize(fyne.NewSize(300, 50))
|
|
|
|
lblSTime.Move(fyne.NewPos(50, 1800))
|
|
|
|
|
|
|
|
content := container.NewWithoutLayout(
|
|
|
|
imgIcon, lblSCongressName, lblSPersonContent, lblSAgendaName, lblSShoudNumName, lblSShoudNum, lblSArriveNumName, lblSArriveNum, lblSNoNumName, lblSNoNum, imgSCurrentPerson, imgSPerson1, imgSPerson2, imgSPerson3, imgSPerson4, imgSPerson5,
|
|
|
|
imgSPerson6, lblSTime,
|
|
|
|
)
|
|
|
|
return content
|
|
|
|
}
|
|
|
|
|
|
|
|
func SReportLayout1() fyne.CanvasObject {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SReportLayout1:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
//国徽 图标
|
|
|
|
var imagepath string
|
|
|
|
iconType := Common.LoadConfig().CheckInDoor.IconType
|
|
|
|
if iconType == "1" {
|
|
|
|
imagepath = "./images/guohui.png"
|
|
|
|
}
|
|
|
|
if iconType == "2" {
|
|
|
|
imagepath = "./images/huibiao.png"
|
|
|
|
}
|
|
|
|
imgIcon := canvas.NewImageFromFile(imagepath)
|
|
|
|
imgIcon.Resize(fyne.NewSize(150, 150))
|
|
|
|
imgIcon.Move(fyne.NewPos(30, 50))
|
|
|
|
// lblSCongressName := widget.NewLabel("政协吉林省第十二届\n委员会常委委员会")
|
|
|
|
// lblSCongressName.TextStyle
|
|
|
|
// vv.Move()
|
|
|
|
// 系统名称 或 会议名称
|
|
|
|
SContent := localcache.CurrentCongress.Co_Name + localcache.CurrentAgenda.Ag_Name
|
|
|
|
if len(SContent) > 36 {
|
|
|
|
lblSCongressName = canvas.NewText(SContent[:36], color.Black)
|
|
|
|
lblSCongressName.TextSize = 50
|
|
|
|
lblSCongressName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSCongressName.Resize(fyne.NewSize(650, 80))
|
|
|
|
lblSCongressName.Move(fyne.NewPos(250, 60))
|
|
|
|
|
|
|
|
lblSAgendaName = canvas.NewText(SContent[36:], color.Black)
|
|
|
|
lblSAgendaName.TextSize = 50
|
|
|
|
lblSAgendaName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSAgendaName.Resize(fyne.NewSize(650, 80))
|
|
|
|
lblSAgendaName.Move(fyne.NewPos(250, 140))
|
|
|
|
} else {
|
|
|
|
lblSCongressName = canvas.NewText(SContent, color.Black)
|
|
|
|
lblSCongressName.TextSize = 50
|
|
|
|
lblSCongressName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSCongressName.Resize(fyne.NewSize(650, 80))
|
|
|
|
lblSCongressName.Move(fyne.NewPos(250, 60))
|
|
|
|
|
|
|
|
lblSAgendaName = canvas.NewText("", color.Black)
|
|
|
|
lblSAgendaName.TextSize = 50
|
|
|
|
lblSAgendaName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSAgendaName.Resize(fyne.NewSize(650, 80))
|
|
|
|
lblSAgendaName.Move(fyne.NewPos(250, 140))
|
|
|
|
}
|
|
|
|
|
|
|
|
// 应到
|
|
|
|
lblSShoudNumName := canvas.NewText("应到人数:", color.Black)
|
|
|
|
lblSShoudNumName.TextSize = 60
|
|
|
|
lblSShoudNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSShoudNumName.Resize(fyne.NewSize(250, 60))
|
|
|
|
lblSShoudNumName.Move(fyne.NewPos(70, 280))
|
|
|
|
|
|
|
|
lblSShoudNum = canvas.NewText("333", color.Black)
|
|
|
|
lblSShoudNum.TextSize = 60
|
|
|
|
lblSShoudNum.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSShoudNum.Resize(fyne.NewSize(240, 60))
|
|
|
|
lblSShoudNum.Move(fyne.NewPos(350, 280))
|
|
|
|
|
|
|
|
// 实到
|
|
|
|
lblSArriveNumName := canvas.NewText("实到人数:", color.Black)
|
|
|
|
lblSArriveNumName.TextSize = 60
|
|
|
|
lblSArriveNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSArriveNumName.Resize(fyne.NewSize(250, 60))
|
|
|
|
lblSArriveNumName.Move(fyne.NewPos(70, 380))
|
|
|
|
|
|
|
|
lblSArriveNum = canvas.NewText("333", color.Black)
|
|
|
|
lblSArriveNum.TextSize = 60
|
|
|
|
lblSArriveNum.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSArriveNum.Resize(fyne.NewSize(240, 60))
|
|
|
|
lblSArriveNum.Move(fyne.NewPos(350, 380))
|
|
|
|
|
|
|
|
// 未到
|
|
|
|
lblSNoNumName := canvas.NewText("未到人数:", color.Black)
|
|
|
|
lblSNoNumName.TextSize = 60
|
|
|
|
lblSNoNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSNoNumName.Resize(fyne.NewSize(250, 60))
|
|
|
|
lblSNoNumName.Move(fyne.NewPos(70, 480))
|
|
|
|
|
|
|
|
lblSNoNum = canvas.NewText("333", color.Black)
|
|
|
|
lblSNoNum.TextSize = 60
|
|
|
|
lblSNoNum.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSNoNum.Resize(fyne.NewSize(240, 60))
|
|
|
|
lblSNoNum.Move(fyne.NewPos(350, 480))
|
|
|
|
|
|
|
|
// 百分比
|
|
|
|
lblSArrivePercentName := canvas.NewText("百 分 比:", color.Black)
|
|
|
|
lblSArrivePercentName.TextSize = 60
|
|
|
|
lblSArrivePercentName.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSArrivePercentName.Resize(fyne.NewSize(250, 60))
|
|
|
|
lblSArrivePercentName.Move(fyne.NewPos(70, 580))
|
|
|
|
|
|
|
|
lblSArrivePercent = canvas.NewText("10", color.Black)
|
|
|
|
lblSArrivePercent.TextSize = 60
|
|
|
|
lblSArrivePercent.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSArrivePercent.Resize(fyne.NewSize(240, 60))
|
|
|
|
lblSArrivePercent.Move(fyne.NewPos(350, 580))
|
|
|
|
// // 本机报到
|
|
|
|
// lblSCArriveNumName := canvas.NewText("本机报到", color.Black)
|
|
|
|
// lblSCArriveNumName.TextSize = 65
|
|
|
|
// lblSCArriveNumName.Alignment = fyne.TextAlignCenter
|
|
|
|
// lblSCArriveNumName.Resize(fyne.NewSize(170, 60))
|
|
|
|
// lblSCArriveNumName.Move(fyne.NewPos(95, 850))
|
|
|
|
|
|
|
|
lblSPersonContent = canvas.NewText("", color.Black)
|
|
|
|
lblSPersonContent.TextSize = 75
|
|
|
|
lblSPersonContent.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSPersonContent.Resize(fyne.NewSize(880, 80))
|
|
|
|
lblSPersonContent.Move(fyne.NewPos(0, 1125))
|
|
|
|
|
|
|
|
//当前报到人
|
|
|
|
imgSCurrentPerson = canvas.NewImageFromFile("")
|
|
|
|
imgSCurrentPerson.Resize(fyne.NewSize(300, 650))
|
|
|
|
imgSCurrentPerson.Move(fyne.NewPos(600, 250))
|
|
|
|
|
|
|
|
//历史报到人1
|
|
|
|
imgSPerson1 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson1.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson1.Move(fyne.NewPos(160, 1250))
|
|
|
|
|
|
|
|
//历史报到人2
|
|
|
|
imgSPerson2 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson2.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson2.Move(fyne.NewPos(320, 1250))
|
|
|
|
|
|
|
|
//历史报到人3
|
|
|
|
imgSPerson3 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson3.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson3.Move(fyne.NewPos(480, 1250))
|
|
|
|
|
|
|
|
//历史报到人4
|
|
|
|
imgSPerson4 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson4.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson4.Move(fyne.NewPos(640, 1250))
|
|
|
|
|
|
|
|
//当历史报到人5
|
|
|
|
imgSPerson5 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson5.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson5.Move(fyne.NewPos(800, 1250))
|
|
|
|
|
|
|
|
//历史报到人6
|
|
|
|
imgSPerson6 = canvas.NewImageFromFile("")
|
|
|
|
imgSPerson6.Resize(fyne.NewSize(160, 224))
|
|
|
|
imgSPerson6.Move(fyne.NewPos(960, 1250))
|
|
|
|
|
|
|
|
//时间
|
|
|
|
lblSTime = canvas.NewText("2021年11月22日 16:56", color.Black)
|
|
|
|
lblSTime.TextSize = 20
|
|
|
|
lblSTime.Alignment = fyne.TextAlignCenter
|
|
|
|
lblSTime.Resize(fyne.NewSize(300, 50))
|
|
|
|
lblSTime.Move(fyne.NewPos(50, 1800))
|
|
|
|
|
|
|
|
content := container.NewWithoutLayout(
|
|
|
|
imgIcon, lblSCongressName, lblSAgendaName, lblSPersonContent, lblSAgendaName, lblSShoudNumName, lblSShoudNum, lblSArriveNumName, lblSArriveNum, lblSNoNumName, lblSNoNum, lblSArrivePercentName, lblSArrivePercent, imgSCurrentPerson,
|
|
|
|
)
|
|
|
|
return content
|
|
|
|
}
|
|
|
|
|
|
|
|
func SUpdateCurrentImg() {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SUpdateCurrentImg:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
if imgSPerson6 != nil {
|
|
|
|
imgSPerson6.File = imgPerson6Path
|
|
|
|
imgSPerson6.Refresh()
|
|
|
|
}
|
|
|
|
if imgSPerson5 != nil {
|
|
|
|
imgSPerson5.File = imgPerson5Path
|
|
|
|
imgSPerson5.Refresh()
|
|
|
|
}
|
|
|
|
if imgSPerson4 != nil {
|
|
|
|
imgSPerson4.File = imgPerson4Path
|
|
|
|
imgSPerson4.Refresh()
|
|
|
|
}
|
|
|
|
if imgSPerson3 != nil {
|
|
|
|
imgSPerson3.File = imgPerson3Path
|
|
|
|
imgSPerson3.Refresh()
|
|
|
|
}
|
|
|
|
if imgSPerson2 != nil {
|
|
|
|
imgSPerson2.File = imgPerson2Path
|
|
|
|
imgSPerson2.Refresh()
|
|
|
|
}
|
|
|
|
if imgSPerson1 != nil {
|
|
|
|
imgSPerson1.File = imgPerson1Path
|
|
|
|
imgSPerson1.Refresh()
|
|
|
|
}
|
|
|
|
if imgSCurrentPerson != nil {
|
|
|
|
imgSCurrentPerson.File = imgCurrentPersonPath
|
|
|
|
imgSCurrentPerson.Refresh()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
func SUpdateStatisticsNumShow() {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SUpdateStatisticsNumShow:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
if lblSShoudNum != nil {
|
|
|
|
lblSShoudNum.Text = strconv.Itoa(localcache.ShouldNum)
|
|
|
|
}
|
|
|
|
if lblSArriveNum != nil {
|
|
|
|
lblSArriveNum.Text = strconv.Itoa(localcache.ArriveNum)
|
|
|
|
}
|
|
|
|
if lblSNoNum != nil {
|
|
|
|
lblSNoNum.Text = strconv.Itoa(localcache.NoArriveNum)
|
|
|
|
}
|
|
|
|
|
|
|
|
if localcache.CurrentPerson != nil {
|
|
|
|
//报到人信息
|
|
|
|
if lblSPersonContent != nil {
|
|
|
|
lblSPersonContent.Text = localcache.CurrentPerson.AP_StaffInfo.St_Name + " " + localcache.CurrentPerson.AP_CodeNum
|
|
|
|
lblSPersonContent.Refresh()
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if lblSArrivePercent != nil {
|
|
|
|
// ArriveNum = 1
|
|
|
|
vv := (localcache.ArriveNum * 100) / (localcache.ShouldNum)
|
|
|
|
|
|
|
|
lblSArrivePercent.Text = strconv.Itoa(vv) + "%"
|
|
|
|
lblSArrivePercent.Refresh()
|
|
|
|
}
|
|
|
|
// lblSCArriveNum.Text = strconv.Itoa(CArriveNum)
|
|
|
|
// lblSCArriveNum.Refresh()
|
|
|
|
lblSShoudNum.Refresh()
|
|
|
|
lblSArriveNum.Refresh()
|
|
|
|
lblSNoNum.Refresh()
|
|
|
|
}
|
|
|
|
|
|
|
|
var ALLScreens []Model.T_Screen
|
|
|
|
var ALLScreenForms []Model.T_ScreenForm
|
|
|
|
var ALLScreenEvent []Model.T_ScreenFormEvent
|
|
|
|
|
|
|
|
func SFormJsonLoad() {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SFormJsonLoad:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
ALLScreens = DAL.GetAllScreen()
|
|
|
|
ALLScreenForms = DAL.GetAllScreenForm()
|
|
|
|
ALLScreenEvent = DAL.GetAllScreenFormEvent()
|
|
|
|
}
|
|
|
|
|
|
|
|
func SFromLoad(index int) {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("SFromLoad:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
//通过index事件查询窗体json 0-默认窗体 1开始会议 2开始报到 3结束报到
|
|
|
|
var json_data []byte
|
|
|
|
// var CSF_ID string
|
|
|
|
// for i := 0; i < len(ALLScreenEvent); i++ {
|
|
|
|
|
|
|
|
// if ALLScreenEvent[i].SFE_Name == "默认屏" {
|
|
|
|
// if index == 0 {
|
|
|
|
// CSF_ID = ALLScreenEvent[i].SFE_SF_ID
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if ALLScreenEvent[i].SFE_Name == "开始会议" {
|
|
|
|
// if index == 1 {
|
|
|
|
// CSF_ID = ALLScreenEvent[i].SFE_SF_ID
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if ALLScreenEvent[i].SFE_Name == "开始报到" {
|
|
|
|
// if index == 2 {
|
|
|
|
// CSF_ID = ALLScreenEvent[i].SFE_SF_ID
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// if ALLScreenEvent[i].SFE_Name == "结束报到" {
|
|
|
|
// if index == 3 {
|
|
|
|
// CSF_ID = ALLScreenEvent[i].SFE_SF_ID
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// for i := 0; i < len(ALLScreenForms); i++ {
|
|
|
|
// if CSF_ID == ALLScreenForms[i].SF_ID {
|
|
|
|
// json_data = []byte(ALLScreenForms[i].SF_Content)
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
json_data = []byte(InitJson())
|
|
|
|
//加载窗体
|
|
|
|
// 使用空接口解析 json
|
|
|
|
fmt.Println("> 2")
|
|
|
|
var i interface{}
|
|
|
|
if err := json.Unmarshal(json_data, &i); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
ndata := i.([]interface{})
|
|
|
|
|
|
|
|
for k, v := range ndata {
|
|
|
|
switch v := v.(type) {
|
|
|
|
case string:
|
|
|
|
fmt.Println(k, v, "(string)")
|
|
|
|
case float64:
|
|
|
|
fmt.Println(k, v, "(float64)")
|
|
|
|
case []interface{}:
|
|
|
|
for i, u := range v {
|
|
|
|
fmt.Println(i, u, " ")
|
|
|
|
}
|
|
|
|
case map[string]interface{}:
|
|
|
|
|
|
|
|
// var ctype string
|
|
|
|
// var cleft float64
|
|
|
|
// var ctop float64
|
|
|
|
// var cwidth float64
|
|
|
|
// var cheight float64
|
|
|
|
// var cfontsize float64
|
|
|
|
// var text string
|
|
|
|
// var typeID string
|
|
|
|
// var cfontcolor color.Color
|
|
|
|
// var ctextalint fyne.TextAlign
|
|
|
|
for i, u := range v {
|
|
|
|
|
|
|
|
switch u := u.(type) {
|
|
|
|
case string:
|
|
|
|
fmt.Println(i, u, "(string)")
|
|
|
|
if i == "type" {
|
|
|
|
// ctype := u
|
|
|
|
} else if i == "id" {
|
|
|
|
|
|
|
|
}
|
|
|
|
case float64:
|
|
|
|
fmt.Println(i, u, "(float64)")
|
|
|
|
case []interface{}:
|
|
|
|
for j, w := range u {
|
|
|
|
fmt.Println(j, w, " ")
|
|
|
|
}
|
|
|
|
case map[string]interface{}:
|
|
|
|
for j, w := range u {
|
|
|
|
|
|
|
|
switch w := w.(type) {
|
|
|
|
case string:
|
|
|
|
fmt.Println(j, w, "(string)")
|
|
|
|
|
|
|
|
case float64:
|
|
|
|
fmt.Println(j, w, "(float64)")
|
|
|
|
case []interface{}:
|
|
|
|
fmt.Println(j, w, "([]interface)")
|
|
|
|
case map[string]interface{}:
|
|
|
|
for k, o := range w {
|
|
|
|
switch o := o.(type) {
|
|
|
|
case string:
|
|
|
|
fmt.Println(k, o, "(string)")
|
|
|
|
|
|
|
|
case float64:
|
|
|
|
fmt.Println(k, o, "(float64)")
|
|
|
|
case []interface{}:
|
|
|
|
fmt.Println(k, o, "([]interface)")
|
|
|
|
case map[string]interface{}:
|
|
|
|
fmt.Println(k, o, "(map[string]interface{})")
|
|
|
|
default:
|
|
|
|
fmt.Println(k, o, "(unkonw)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
fmt.Println(j, w, "(unkonw)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
fmt.Println(i, u, "(unkonw)")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
fmt.Println(k, v, "(unkonw)")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func InitJson() string {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("InitJson:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
var test string
|
|
|
|
test = `[{
|
|
|
|
"id": "屏幕缩放值",
|
|
|
|
"content": "屏幕缩放值,也就是相机未位置z",
|
|
|
|
"type": "屏幕缩放值",
|
|
|
|
"imagePath": "",
|
|
|
|
"position": {
|
|
|
|
"z": 126
|
|
|
|
},
|
|
|
|
"rotation": {},
|
|
|
|
"scale": {
|
|
|
|
"z": 126
|
|
|
|
},
|
|
|
|
"fontColor": "",
|
|
|
|
"userData": {
|
|
|
|
"camera_distance": 126,
|
|
|
|
"camera_position": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"z": 126
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"id": "113FB336-A2F1-428B-9D60-4AF29E4FA4B6",
|
|
|
|
"type": "图片控件",
|
|
|
|
"imagePath": "upload/screenImage/2022012416283613164847003241.png",
|
|
|
|
"position": {
|
|
|
|
"x": 0.10804193489239522,
|
|
|
|
"y": -4.468251768905942,
|
|
|
|
"z": 1
|
|
|
|
},
|
|
|
|
"rotation": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"z": 0
|
|
|
|
},
|
|
|
|
"scale": {
|
|
|
|
"x": 6.183637643838265,
|
|
|
|
"y": 6.198821244380015,
|
|
|
|
"z": 1
|
|
|
|
},
|
|
|
|
"userData": {
|
|
|
|
"type": "图片控件",
|
|
|
|
"id": "113FB336-A2F1-428B-9D60-4AF29E4FA4B6",
|
|
|
|
"fontWidth": 6.183637643838265,
|
|
|
|
"fontHeight": 6.198821244380015,
|
|
|
|
"x_move": 0.5666535046803286,
|
|
|
|
"y_move": -7.035947683114067,
|
|
|
|
"updatedX": 0.10804193489239522,
|
|
|
|
"updatedY": -4.468251768905942,
|
|
|
|
"hasUpdated": true,
|
|
|
|
"actualImageSize": {
|
|
|
|
"width": 1049,
|
|
|
|
"height": 1049
|
|
|
|
},
|
|
|
|
"hasHighlighted": false,
|
|
|
|
"imagePath": "upload/screenImage/2022012416283613164847003241.png",
|
|
|
|
"natureImageSize": {
|
|
|
|
"width": 1049,
|
|
|
|
"height": 1049
|
|
|
|
},
|
|
|
|
"scaleType": "1"
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"id": "70bfd1d0-7cef-11ec-9b07-cfec1bd38189",
|
|
|
|
"content": "请 输 入!!请 输 入!!",
|
|
|
|
"type": "canvas基本文字抬头",
|
|
|
|
"position": {
|
|
|
|
"x": -0.2115506417473101,
|
|
|
|
"y": 8.195320753690003,
|
|
|
|
"z": 1
|
|
|
|
},
|
|
|
|
"rotation": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"z": 0
|
|
|
|
},
|
|
|
|
"scale": {
|
|
|
|
"z": 1
|
|
|
|
},
|
|
|
|
"TextLabelSystemAttributes": 4,
|
|
|
|
"userData": {
|
|
|
|
"id": "70bfd1d0-7cef-11ec-9b07-cfec1bd38189",
|
|
|
|
"width": 1800,
|
|
|
|
"height": 120,
|
|
|
|
"text": "请 输 入!!请 输 入!!",
|
|
|
|
"fontsize": 100,
|
|
|
|
"fontcolor": {
|
|
|
|
"value": 16711680,
|
|
|
|
"label": "红色",
|
|
|
|
"color": "#FF0000",
|
|
|
|
"isFixed": true
|
|
|
|
},
|
|
|
|
"TextLabelHoriAttribute": "",
|
|
|
|
"TextLabelVertAttribute": "",
|
|
|
|
"type": "canvas基本文字抬头",
|
|
|
|
"x_move": 0,
|
|
|
|
"y_move": 0,
|
|
|
|
"updatedX": -0.2115506417473101,
|
|
|
|
"updatedY": 8.195320753690003,
|
|
|
|
"hasUpdated": true,
|
|
|
|
"hasHighlighted": false,
|
|
|
|
"TextLabelSystemAttributes": 4,
|
|
|
|
"isAllowEditContentManually": true,
|
|
|
|
"TextLabelSystemAttribute_Descr": "会议名称",
|
|
|
|
"textVertiAlign": "middle",
|
|
|
|
"textHoriAlign": "center"
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
"id": "73c82fd0-7cef-11ec-9b07-cfec1bd38189",
|
|
|
|
"content": "请 输 入!!请 输 入!!",
|
|
|
|
"type": "canvas基本文字抬头",
|
|
|
|
"position": {
|
|
|
|
"x": -0.1511076012480752,
|
|
|
|
"y": 4.203813466721784,
|
|
|
|
"z": 0
|
|
|
|
},
|
|
|
|
"rotation": {
|
|
|
|
"x": 0,
|
|
|
|
"y": 0,
|
|
|
|
"z": 0
|
|
|
|
},
|
|
|
|
"scale": {
|
|
|
|
"z": 1
|
|
|
|
},
|
|
|
|
"TextLabelSystemAttributes": 6,
|
|
|
|
"userData": {
|
|
|
|
"id": "73c82fd0-7cef-11ec-9b07-cfec1bd38189",
|
|
|
|
"width": 1800,
|
|
|
|
"height": 120,
|
|
|
|
"text": "请 输 入!!请 输 入!!",
|
|
|
|
"fontsize": 100,
|
|
|
|
"fontcolor": {
|
|
|
|
"value": 16711680,
|
|
|
|
"label": "红色",
|
|
|
|
"color": "#FF0000",
|
|
|
|
"isFixed": true
|
|
|
|
},
|
|
|
|
"TextLabelHoriAttribute": "",
|
|
|
|
"TextLabelVertAttribute": "",
|
|
|
|
"type": "canvas基本文字抬头",
|
|
|
|
"x_move": 0,
|
|
|
|
"y_move": 0,
|
|
|
|
"updatedX": -0.1511076012480752,
|
|
|
|
"updatedY": 4.203813466721784,
|
|
|
|
"hasUpdated": true,
|
|
|
|
"hasHighlighted": true,
|
|
|
|
"textHoriAlign": "center",
|
|
|
|
"textVertiAlign": "middle",
|
|
|
|
"TextLabelSystemAttributes": 6,
|
|
|
|
"isAllowEditContentManually": true,
|
|
|
|
"TextLabelSystemAttribute_Descr": "议程名称"
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
`
|
|
|
|
return test
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查找是否有同名进程在运行
|
|
|
|
func findProcessByName(name string) (*os.Process, error) {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("mainfindProcessByName:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
var cmd *exec.Cmd
|
|
|
|
switch runtime.GOOS {
|
|
|
|
case "windows":
|
|
|
|
cmd = exec.Command("tasklist")
|
|
|
|
// cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
|
|
|
|
case "linux":
|
|
|
|
cmd = exec.Command("ps", "-A")
|
|
|
|
default:
|
|
|
|
return nil, fmt.Errorf("unsupported platform")
|
|
|
|
}
|
|
|
|
|
|
|
|
out, err := cmd.Output()
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to list processes: %v", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// 查找进程列表中是否有相同进程名
|
|
|
|
for _, line := range strings.Split(string(out), "\n") {
|
|
|
|
if strings.Contains(line, name) {
|
|
|
|
fields := strings.Fields(line)
|
|
|
|
var pid int
|
|
|
|
if runtime.GOOS == "windows" {
|
|
|
|
// Windows tasklist 输出中 PID 位于第二列
|
|
|
|
if len(fields) >= 2 {
|
|
|
|
pid, err = strconv.Atoi(fields[1])
|
|
|
|
}
|
|
|
|
} else if runtime.GOOS == "linux" {
|
|
|
|
// Linux ps 输出中 PID 位于第一列
|
|
|
|
if len(fields) >= 1 {
|
|
|
|
pid, err = strconv.Atoi(fields[0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to parse process id: %v", err)
|
|
|
|
}
|
|
|
|
process, err := os.FindProcess(pid)
|
|
|
|
if err != nil {
|
|
|
|
return nil, fmt.Errorf("failed to find process by PID: %v", err)
|
|
|
|
}
|
|
|
|
return process, nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// 杀掉已有的进程
|
|
|
|
func killProcess(proc *os.Process) error {
|
|
|
|
|
|
|
|
defer func() {
|
|
|
|
if r := recover(); r != nil {
|
|
|
|
log.Error("mainkillProcess:", r)
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
|
|
|
|
if proc == nil {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
err := proc.Signal(syscall.SIGKILL) // 使用 syscall 发送 SIGKILL 信号来强制杀死进程
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("failed to kill process: %v", err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|