|
@ -1,11 +1,11 @@ |
|
|
// +build windows
|
|
|
// +build windows
|
|
|
//go:generate rsrc -ico main.ico -manifest main.manifest -o main.syso
|
|
|
|
|
|
|
|
|
|
|
|
package main |
|
|
package main |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"bufio" |
|
|
"bufio" |
|
|
"database/sql" |
|
|
"database/sql" |
|
|
|
|
|
"errors" |
|
|
"fmt" |
|
|
"fmt" |
|
|
_ "github.com/go-sql-driver/mysql" |
|
|
_ "github.com/go-sql-driver/mysql" |
|
|
"github.com/lxn/walk" |
|
|
"github.com/lxn/walk" |
|
@ -15,10 +15,13 @@ import ( |
|
|
"golang.org/x/sys/windows" |
|
|
"golang.org/x/sys/windows" |
|
|
"golang.org/x/sys/windows/registry" |
|
|
"golang.org/x/sys/windows/registry" |
|
|
"io" |
|
|
"io" |
|
|
|
|
|
"io/fs" |
|
|
|
|
|
"io/ioutil" |
|
|
"log" |
|
|
"log" |
|
|
"os" |
|
|
"os" |
|
|
"os/exec" |
|
|
"os/exec" |
|
|
"path/filepath" |
|
|
"path/filepath" |
|
|
|
|
|
"runtime" |
|
|
"strings" |
|
|
"strings" |
|
|
"syscall" |
|
|
"syscall" |
|
|
"time" |
|
|
"time" |
|
@ -77,8 +80,20 @@ func init() { |
|
|
func main() { |
|
|
func main() { |
|
|
_ = getWindows() |
|
|
_ = getWindows() |
|
|
|
|
|
|
|
|
|
|
|
if e := HasHzb(); e != nil { |
|
|
|
|
|
walk.MsgBox(app.mw, "错误", "请先下载并安装 组工 软件,才可以正常使用软件!", walk.MsgBoxIconWarning) |
|
|
|
|
|
OpenUrl("https://www.12371.cn/zgrjxz/gwywx/") |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if e := InHzb(); e != nil { |
|
|
|
|
|
walk.MsgBox(app.mw, "错误", "当前工具未在正确的位置,请将工具移至安装软件目录下(如:./hzb2020/HyServer.exe)!", walk.MsgBoxIconWarning) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
walk.App().SetProductName(app.title) |
|
|
walk.App().SetProductName(app.title) |
|
|
walk.App().SetOrganizationName("网新") |
|
|
walk.App().SetOrganizationName("网新") |
|
|
|
|
|
walk.App().SetProductName("网新") |
|
|
|
|
|
|
|
|
showMsg(fmt.Sprintf(" 当前获取的目录为:%s", path)) |
|
|
showMsg(fmt.Sprintf(" 当前获取的目录为:%s", path)) |
|
|
|
|
|
|
|
@ -620,16 +635,19 @@ func dbBak() { |
|
|
QuerySQL(db, dir, "select * from a08 where a0000 in (select a0000 from a01 where status=1)", "a08", []string{}) |
|
|
QuerySQL(db, dir, "select * from a08 where a0000 in (select a0000 from a01 where status=1)", "a08", []string{}) |
|
|
QuerySQL(db, dir, "select * from a14 where a0000 in (select a0000 from a01 where status=1)", "a14", []string{}) |
|
|
QuerySQL(db, dir, "select * from a14 where a0000 in (select a0000 from a01 where status=1)", "a14", []string{}) |
|
|
QuerySQL(db, dir, "select * from a15 where a0000 in (select a0000 from a01 where status=1)", "a15", []string{}) |
|
|
QuerySQL(db, dir, "select * from a15 where a0000 in (select a0000 from a01 where status=1)", "a15", []string{}) |
|
|
|
|
|
QuerySQL(db, dir, "select * from a17 where a0000 in (select a0000 from a01 where status=1)", "a17", []string{}) |
|
|
QuerySQL(db, dir, "select * from a36 where a0000 in (select a0000 from a01 where status=1)", "a36", []string{}) |
|
|
QuerySQL(db, dir, "select * from a36 where a0000 in (select a0000 from a01 where status=1)", "a36", []string{}) |
|
|
QuerySQL(db, dir, "select * from a99z1 where a0000 in (select a0000 from a01 where status=1)", "a99z1", []string{}) |
|
|
|
|
|
QuerySQL(db, dir, "select * from a30 where a0000 in (select a0000 from a01 where status=1)", "a30", []string{}) |
|
|
QuerySQL(db, dir, "select * from a30 where a0000 in (select a0000 from a01 where status=1)", "a30", []string{}) |
|
|
QuerySQL(db, dir, "select * from a33 where a0000 in (select a0000 from a01 where status=1)", "a33", []string{}) |
|
|
QuerySQL(db, dir, "select * from a33 where a0000 in (select a0000 from a01 where status=1)", "a33", []string{}) |
|
|
QuerySQL(db, dir, "select * from a57 where a0000 in (select a0000 from a01 where status=1)", "a57", []string{}) |
|
|
QuerySQL(db, dir, "select * from a57 where a0000 in (select a0000 from a01 where status=1)", "a57", []string{}) |
|
|
|
|
|
QuerySQL(db, dir, "select * from a65 where a0000 in (select a0000 from a01 where status=1)", "a65", []string{}) |
|
|
|
|
|
QuerySQL(db, dir, "select * from a99z1 where a0000 in (select a0000 from a01 where status=1)", "a99z1", []string{}) |
|
|
|
|
|
QuerySQL(db, dir, "select * from b01", "b01", []string{}) |
|
|
|
|
|
|
|
|
// 处理照片信息
|
|
|
// 处理照片信息
|
|
|
copyFileByA57(db, dir) |
|
|
copyFileByA57(db, dir) |
|
|
|
|
|
|
|
|
dirName := fmt.Sprintf("./%s", dir) |
|
|
dirName := fmt.Sprintf("./%s/", dir) |
|
|
fileName := fmt.Sprintf("%s.gz", dir) |
|
|
fileName := fmt.Sprintf("%s.gz", dir) |
|
|
// 进行压缩操作 并 删除压缩前目录
|
|
|
// 进行压缩操作 并 删除压缩前目录
|
|
|
Zip(dirName, fileName) |
|
|
Zip(dirName, fileName) |
|
@ -827,7 +845,7 @@ func QuerySQL(db *sql.DB, dir, sqlStr, tableName string, colNil []string) { |
|
|
for i := range values { |
|
|
for i := range values { |
|
|
scanArgs[i] = &values[i] |
|
|
scanArgs[i] = &values[i] |
|
|
} |
|
|
} |
|
|
aa := "" |
|
|
aa := fmt.Sprintf("truncate table %s;\n", tableName) |
|
|
for rows.Next() { |
|
|
for rows.Next() { |
|
|
_ = rows.Scan(scanArgs...) |
|
|
_ = rows.Scan(scanArgs...) |
|
|
key, value := "(", "(" |
|
|
key, value := "(", "(" |
|
@ -963,3 +981,60 @@ func Zip(srcDir string, zipFileName string) { |
|
|
return nil |
|
|
return nil |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// open opens the specified URL in the default browser of the user.
|
|
|
|
|
|
func OpenUrl(url string) error { |
|
|
|
|
|
var cmd string |
|
|
|
|
|
var args []string |
|
|
|
|
|
|
|
|
|
|
|
switch runtime.GOOS { |
|
|
|
|
|
case "windows": |
|
|
|
|
|
cmd = "cmd" |
|
|
|
|
|
args = []string{"/c", "start"} |
|
|
|
|
|
case "darwin": |
|
|
|
|
|
cmd = "open" |
|
|
|
|
|
default: // "linux", "freebsd", "openbsd", "netbsd"
|
|
|
|
|
|
cmd = "xdg-open" |
|
|
|
|
|
} |
|
|
|
|
|
args = append(args, url) |
|
|
|
|
|
c := exec.Command(cmd, args...) |
|
|
|
|
|
c.SysProcAttr = &syscall.SysProcAttr{HideWindow: true} |
|
|
|
|
|
return c.Start() |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// hasHzb 判断软件是否安装
|
|
|
|
|
|
func HasHzb() error { |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// inHzb 判断当前软件是否在正确的位置
|
|
|
|
|
|
func InHzb() error { |
|
|
|
|
|
pwd, _ := os.Getwd() |
|
|
|
|
|
// 判断依据 为是否存在 360se6、tools、Tomcat8 和 mysql 目录下
|
|
|
|
|
|
fileInfoList, _ := ioutil.ReadDir(pwd) |
|
|
|
|
|
if Contains(fileInfoList, "360se6") == -1 { |
|
|
|
|
|
return errors.New("目录错误") |
|
|
|
|
|
} |
|
|
|
|
|
if Contains(fileInfoList, "mysql") == -1 { |
|
|
|
|
|
return errors.New("目录错误") |
|
|
|
|
|
} |
|
|
|
|
|
if Contains(fileInfoList, "tomcat8") == -1 { |
|
|
|
|
|
return errors.New("目录错误") |
|
|
|
|
|
} |
|
|
|
|
|
if Contains(fileInfoList, "tools") == -1 { |
|
|
|
|
|
return errors.New("目录错误") |
|
|
|
|
|
} |
|
|
|
|
|
return nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func Contains(array []fs.FileInfo, val string) (index int) { |
|
|
|
|
|
index = -1 |
|
|
|
|
|
for i := range array { |
|
|
|
|
|
// fmt.Println(array[i].Name()) //打印当前文件或目录下的文件或目录名
|
|
|
|
|
|
if array[i].Name() == val { |
|
|
|
|
|
index = i |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|