Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
AD-Control-Golang
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陶腾飞
AD-Control-Golang
Commits
fe5d1b5a
Commit
fe5d1b5a
authored
May 14, 2020
by
陶腾飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update menu
parent
93a98aca
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
125 additions
and
81 deletions
+125
-81
adct/adct.exe
+0
-0
daemon/daemon.exe
+0
-0
public/env.go
+4
-3
public/msg_deal.go
+2
-2
public/msg_init.go
+2
-1
public/win.go
+14
-0
users/menu.go
+101
-69
users/users.exe
+0
-0
users/users.go
+2
-6
No files found.
adct/adct.exe
View file @
fe5d1b5a
No preview for this file type
daemon/daemon.exe
View file @
fe5d1b5a
No preview for this file type
public/env.go
View file @
fe5d1b5a
...
...
@@ -40,6 +40,7 @@ const Env_MainADHostname string = "ADSERVER"
const
Env_SMBAdserver
string
=
`\\`
+
Env_MainADHostname
+
`\`
const
Env_ADSoft
string
=
Env_SMBAdserver
+
"software"
const
Env_ADMain
string
=
Env_SMBAdserver
+
"ADMAIN"
var
Env_ADMainDept
string
=
Env_ADMain
+
`\`
+
User_dept_str
var
Env_ADMainDeptShare
string
=
Env_ADMain
+
`\`
+
User_dept_str
+
`\`
+
"部门共享"
const
Env_ADSoftlike
string
=
Env_ADSoft
+
`\`
+
"softlike"
const
Env_ADApplication
string
=
Env_ADSoft
+
`\`
+
"application"
+
`\`
...
...
@@ -65,7 +66,7 @@ const Zhiwei_Dept_TXWJ string = "TXWJ"
const
Zhiwei_Dept_BGYJZX
string
=
"BGYJZX"
const
Zhiwei_Dept_TECH
string
=
"TECH"
const
Zhiwei_Dept_Count
=
8
const
Zhiwei_Dept_Count
=
9
// backup env //////////////////////////////////////////////////////////////
...
...
@@ -100,6 +101,6 @@ const Link_MultiSplit string = Env_ADApplication + "win_MultiSplit.exe"
const
Cmdk
string
=
"cmd /k "
const
Startk
string
=
"cmd /k start "
var
Dir_Windows
string
=
GetEnv
(
"windir"
)
+
`\`
const
z
hiwei_WxDrive_Folder
string
=
"办公室部门内部共享"
var
Zhiwei_WxDrive_Full_Folder
string
=
Reg_Value_WeDriveDir
+
`\`
+
z
hiwei_WxDrive_Folder
const
Z
hiwei_WxDrive_Folder
string
=
"办公室部门内部共享"
var
Zhiwei_WxDrive_Full_Folder
string
=
Reg_Value_WeDriveDir
+
`\`
+
Z
hiwei_WxDrive_Folder
var
CopyStatusWeDrive
map
[
string
]
bool
public/msg_deal.go
View file @
fe5d1b5a
...
...
@@ -160,8 +160,8 @@ func (exec *MJexec)Msg_Deal()interface{}{
}
switch
exec
.
Instruction
{
case
Msg_Exec_CopyWeDrive
:
Reg_Value_WeDriveDir
=
Reg_query_key_one
(
HKCU
,
Reg_Path_achome
,
Reg_Name_achome_dc_WeDriveDir
)
cmd
:=
`cmd /c xcopy `
+
Env_ADMainDeptShare
+
" /D "
+
Reg_Value_WeDriveDir
+
`\`
+
z
hiwei_WxDrive_Folder
+
" /S /T /E /C /y"
reg_Value_WeDriveDir
:
=
Reg_query_key_one
(
HKCU
,
Reg_Path_achome
,
Reg_Name_achome_dc_WeDriveDir
)
cmd
:=
`cmd /c xcopy `
+
Env_ADMainDeptShare
+
" /D "
+
reg_Value_WeDriveDir
+
`\`
+
Z
hiwei_WxDrive_Folder
+
" /S /T /E /C /y"
Execcmd_wait
(
cmd
)
SendServerReport
(
Msg_Report_OverCopyToWeDrive
)
...
...
public/msg_init.go
View file @
fe5d1b5a
...
...
@@ -24,7 +24,7 @@ const Msg_Report_Offwork string = "offwork"
const
Msg_Report_OverBak
string
=
"overbak"
const
Msg_Report_CloseWindows
string
=
"closewindows"
const
Msg_Report_OverCopyToWeDrive
string
=
"overcopytowedrive"
const
Msg_Report_OverCopyToDeptShare
string
=
"OverCopyToDeptShare"
// msg backup status //////////////////////////////////////////////////////////////
const
Msg_Backup_Status_Start
string
=
"start"
...
...
@@ -56,6 +56,7 @@ const Msg_Exec_UpdateVersion string = "updateverion"
const
Msg_Exec_UpdateVersion_cmd
string
=
"Env_ADSoftTool_Update"
const
Msg_Exec_InstallSoftware
string
=
"installsoftware"
const
Msg_Exec_CopyWeDrive
string
=
"copyWeDrive"
const
Msg_Exec_CopyDeptShare
string
=
"copydeptshare"
const
(
Msg_Reg_Query
=
iota
...
...
public/win.go
View file @
fe5d1b5a
...
...
@@ -82,6 +82,11 @@ func ChooseFolder(explain, initDir * string) string {
fg
.
ShowBrowseFolder
(
*
new
(
walk
.
Form
))
return
fg
.
FilePath
}
func
OpenWindow
(
s
string
){
PrintLog
(
s
)
Execcmd_nowait
(
"explorer "
+
s
)
}
//
//
// remote exec
...
...
@@ -99,13 +104,22 @@ func PsExec_sdic(pc ,cmd ,sessionid string) {
Execcmd_nowait
(
psExecCommand
)
}
//
//
// msg show
//
// UI:显示带确定的消息框
func
Msg
(
message
string
)
{
walk
.
MsgBox
(
*
new
(
walk
.
Form
),
"提示"
,
message
,
walk
.
MsgBoxIconInformation
)
}
// UI:显示带确定和取消的消息框
// 点击确定按钮:返回1,
// 点击取消按钮:返回2
func
Msg_YesNo
(
message
string
)
int
{
return
walk
.
MsgBox
(
*
new
(
walk
.
Form
),
"提示"
,
message
,
walk
.
MsgBoxOKCancel
)
}
func
MsgBox
(
message
string
){
Execcmd_nowait
(
"msg * /TIME:60 "
+
message
)
}
...
...
users/menu.go
View file @
fe5d1b5a
...
...
@@ -11,7 +11,7 @@ import (
//---------------------------------------------------------
func
menuInitPower
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"电源"
fa
:=
"电源
选项
"
sub
:=
[
...
]
string
{
"下班咯"
,
"关闭系统"
,
"用户注销"
,
"重启系统"
,
"取消关机计时"
}
// 建立空菜单
...
...
@@ -136,7 +136,7 @@ func siEnter_admin(softname string){
//---------------------------------------------------------------
func
menuInitWxDriveSync
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"微盘同步"
sub
:=
[
...
]
string
{
"初始化"
,
"
手动进行一次同步服务器到微盘"
,
"开启微盘同步到服务器
"
,
"说明"
}
sub
:=
[
...
]
string
{
"初始化"
,
"
同步部门共享盘到微盘(手动)"
,
"同步部门共享盘到服务器(手动)
"
,
"说明"
}
// 建立空菜单
nm
,
err
:=
walk
.
NewMenu
()
if
err
!=
nil
{
...
...
@@ -196,37 +196,74 @@ func wxdsInit(){
public
.
Msg
(
"初始化完毕,请在微盘中创建文件夹(办公室部门内部共享),并分享给同事,创建后,点击开始同步即可。"
)
}
func
wxdsToDrive
(){
if
public
.
Msg_YesNo
(
"确定手动进行一次 -> 从共享盘同步到微盘吗?如果调整过共享盘的文件结构,请先在微盘中同步调整,否则微盘将会混沌。"
)
==
1
{
public
.
SendServer
(
public
.
GJexecCopyWeDrive
(
public
.
Msg_Exec_CopyWeDrive
))
public
.
Msg
(
"同步完成!"
)
}
}
func
wxdsToServer
(){
public
.
Msg
(
"开发ing"
)
reg_Value_WeDriveDir
:=
public
.
Reg_query_key_one
(
public
.
HKCU
,
public
.
Reg_Path_achome
,
public
.
Reg_Name_achome_dc_WeDriveDir
)
weDrive_Share_Dir
:=
reg_Value_WeDriveDir
+
`\`
+
public
.
Zhiwei_WxDrive_Folder
if
reg_Value_WeDriveDir
!=
""
&&
public
.
Exist
(
weDrive_Share_Dir
){
if
public
.
Msg_YesNo
(
"确定手动进行一次 -> 从微盘到共享盘吗?如果俩者文件结构不一致,文件盘将会混沌。"
)
==
1
{
cmd
:=
`cmd /c xcopy `
+
weDrive_Share_Dir
+
" /D "
+
public
.
Env_ADMainDeptShare
+
" /S /T /E /C /y"
public
.
Execcmd_wait
(
cmd
)
public
.
SendServerReport
(
public
.
Msg_Report_OverCopyToDeptShare
)
public
.
Msg
(
"同步完成!"
)
}
}
}
func
wxdsExplain
(){
// 此功能,部门内部的路人甲初始化一次即可,并分享微盘文件夹给炮灰乙、流氓丙即可。
// 当路人甲没有启动这个小工具时,土匪丁想要同步的话,也时需要初始化
// 初始化后,凡是启动了小工具,2小时自动同步一次。
// 但限于微盘的特性,当文件共享盘的文件名发生变化,微盘是依旧保留旧文件夹的。所以微盘的文件时需要定期手动清理的。
public
.
Msg
(
"第一次使用此功能时"
)
msg
:=
`1.此功能,部门内部的路人甲初始化一次即可,并分享微盘文件夹给炮灰乙、流氓丙即可。
2.当路人甲没有启动这个小工具时,土匪丁想要同步的话,也时需要初始化。
5.初始化后,凡是启动了小工具,2小时自动同步一次到微盘。但从微盘同步到部门共享盘中只能是手动的。
7.但限于微盘的特性,当文件共享盘的文件名发生变化,微盘是依旧保留旧文件夹的。所以微盘的文件时需要定期手动清理的。
9.关于初始化中路径选择问题:打开微盘,右键打开已下载的文件。根据该文件所在的路径来确定初始化中的路径。
8.以上,此致,敬礼,望赞!
`
public
.
Msg
(
msg
)
}
//---------------------------------------------------------------
//
//
User
Tools
//
Kinds of
Tools
//
//---------------------------------------------------------------
func
menuInitUserTools
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"用户工具"
sub
:=
[
...
]
string
{
"隐藏桌面图标"
,
"恢复桌面图标"
}
func
menuInitTools
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"工具集合"
sub
:=
[
...
]
string
{
"Excel关键词分割"
,
"隐藏桌面图标"
,
"显示桌面图标"
,
"移动硬盘"
,
"测试"
}
// 建立空菜单
nm
,
err
:=
walk
.
NewMenu
()
if
err
!=
nil
{
public
.
PrintLog
(
err
)
}
lastone
:=
len
(
sub
)
-
1
for
i
,
buttonText
:=
range
sub
{
// 过滤按钮
switch
i
{
case
lastone
-
1
:
if
!
public
.
TheUser
(
public
.
AD_User_huyibo
)
{
continue
}
case
lastone
:
if
!
public
.
AdminUser
()
{
continue
}
}
// 建立 子按钮
na
:=
walk
.
NewAction
()
if
err
:=
na
.
SetText
(
buttonText
);
err
!=
nil
{
...
...
@@ -236,9 +273,17 @@ func menuInitUserTools(ni * walk.NotifyIcon){
// 为子按钮 添加事件
switch
i
{
case
0
:
na
.
Triggered
()
.
Attach
(
utHideIcon
)
na
.
Triggered
()
.
Attach
(
tMultiSplit
)
case
1
:
na
.
Triggered
()
.
Attach
(
utShowIcon
)
na
.
Triggered
()
.
Attach
(
tHideIcon
)
case
2
:
na
.
Triggered
()
.
Attach
(
tShowIcon
)
case
lastone
-
1
:
na
.
Triggered
()
.
Attach
(
tJR_huyibo_movedisk
)
case
lastone
:
na
.
Triggered
()
.
Attach
(
tTest
)
}
...
...
@@ -256,26 +301,34 @@ func menuInitUserTools(ni * walk.NotifyIcon){
sysmenu
.
SetText
(
fa
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
func
tMultiSplit
(){
public
.
Execcmd_nowait
(
public
.
Startk
+
public
.
Link_MultiSplit
)
}
func
tJR_huyibo_movedisk
(){
public
.
SendDaemonExec
(
`F:\SamsungPortableSSD.exe`
)
}
func
u
tHideIcon
(){
func
tHideIcon
(){
public
.
Msg
(
"emmmmmmm,大概下周吧,这周无望哈"
)
}
func
u
tShowIcon
(){
func
tShowIcon
(){
public
.
Msg
(
"仅供参考!!"
)
}
func
tTest
(){
//public.SendDaemonExec(`D:\WXWork.exe`)
}
//---------------------------------------------------------------
//
//
f
ile share
//
F
ile share
//
//---------------------------------------------------------------
func
menuInitFileShares
(
ni
*
walk
.
NotifyIcon
){
// envhs := os.Getenv("HOMESHARE")
// public.PrintLog(envhs)
fa
:=
"文件共享"
// // 建立空菜单
...
...
@@ -294,13 +347,17 @@ func menuInitFileShares(ni * walk.NotifyIcon){
public
.
PrintLog
(
err
)
}
deptshare
:=
memberList
.
Name
()
// 不在 其他共享 里 显示自己部门的共享
if
deptshare
==
public
.
User_dept_str
{
continue
}
member
,
err
:=
public
.
ReadDir
(
public
.
Env_ADMain
+
`\`
+
deptshare
)
if
err
!=
nil
{
public
.
PrintLog
(
err
)
}
for
_
,
mem
:=
range
member
{
wokrer
:=
mem
.
Name
()
// 建立 子按钮
na
:=
walk
.
NewAction
()
if
err
:=
na
.
SetText
(
public
.
TrimSuffix
(
wokrer
,
".lnk"
));
err
!=
nil
{
...
...
@@ -308,7 +365,7 @@ func menuInitFileShares(ni * walk.NotifyIcon){
}
// 为子按钮 添加事件
na
.
Triggered
()
.
Attach
(
func
(){
fs
OpenWindow
(
public
.
Env_ADMain
+
`\`
+
deptshare
+
`\`
+
wokrer
);
return
})
na
.
Triggered
()
.
Attach
(
func
(){
public
.
OpenWindow
(
public
.
Env_ADMain
+
`\`
+
deptshare
+
`\`
+
wokrer
);
return
})
// 将 子按钮 添加到 菜单
nm
.
Actions
()
.
Add
(
na
)
...
...
@@ -336,58 +393,47 @@ func menuInitFileShares(ni * walk.NotifyIcon){
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
func
fsOpenWindow
(
s
string
){
public
.
PrintLog
(
s
)
public
.
Execcmd_nowait
(
"explorer "
+
s
)
}
//---------------------------------------------------------------
//
//
Other
//
My share
//
//---------------------------------------------------------------
func
menuInitOther
(
ni
*
walk
.
NotifyIcon
){
fa
:=
"其他"
func
menuInitMyShares
(
ni
*
walk
.
NotifyIcon
){
// envhs := os.Getenv("HOMESHARE")
// public.PrintLog(envhs)
fa
:=
"我的共享"
sub
:=
[
...
]
string
{
"Excel关键词分割"
,
"移动硬盘"
,
"重新加载"
,
"测试"
}
// 建立空菜单
nm
,
err
:=
walk
.
NewMenu
()
if
err
!=
nil
{
public
.
PrintLog
(
err
)
nm
,
err
2
:=
walk
.
NewMenu
()
if
err
2
!=
nil
{
public
.
PrintLog
(
err
2
)
}
lastone
:=
len
(
sub
)
-
1
for
i
,
buttonText
:=
range
sub
{
switch
i
{
case
1
:
if
!
public
.
TheUser
(
public
.
AD_User_huyibo
)
{
continue
}
case
lastone
:
if
!
public
.
AdminUser
()
{
continue
}
// 读取我的部门共享目录
deptList
,
err3
:=
public
.
ReadDir
(
public
.
Env_ADMainDept
)
if
err3
!=
nil
{
public
.
PrintLog
(
err3
)
}
for
_
,
mem
:=
range
deptList
{
wokrer
:=
mem
.
Name
()
// 建立 子按钮
na
:=
walk
.
NewAction
()
if
err
:=
na
.
SetText
(
buttonText
);
err
!=
nil
{
if
err
:=
na
.
SetText
(
public
.
TrimSuffix
(
wokrer
,
".lnk"
)
);
err
!=
nil
{
public
.
PrintLog
(
err
)
}
// 为子按钮 添加事件
switch
i
{
case
0
:
na
.
Triggered
()
.
Attach
(
oMultiSplit
)
case
1
:
na
.
Triggered
()
.
Attach
(
oJR_huyibo_movedisk
)
case
lastone
:
na
.
Triggered
()
.
Attach
(
oTest
)
}
na
.
Triggered
()
.
Attach
(
func
(){
public
.
OpenWindow
(
public
.
Env_ADMainDept
+
`\`
+
wokrer
);
return
})
// 将 子按钮 添加到 菜单
nm
.
Actions
()
.
Add
(
na
)
}
}
//将菜单添加到托盘
sysmenu
,
err
:=
ni
.
ContextMenu
()
.
Actions
()
.
AddMenu
(
nm
)
if
err
!=
nil
{
...
...
@@ -398,19 +444,5 @@ func menuInitOther(ni * walk.NotifyIcon){
sysmenu
.
SetText
(
fa
)
sysmenu
.
SetVisible
(
true
)
sysmenu
.
SetEnabled
(
true
)
}
func
oMultiSplit
(){
public
.
Execcmd_nowait
(
public
.
Startk
+
public
.
Link_MultiSplit
)
}
func
oJR_huyibo_movedisk
(){
public
.
SendDaemonExec
(
`F:\SamsungPortableSSD.exe`
)
}
func
oRebootUser
(){
//public.Execcmd_nowait(public.Env_ADSoftTool_RebootUser)
}
func
oTest
(){
public
.
SendDaemonExec
(
`D:\WXWork.exe`
)
}
users/users.exe
View file @
fe5d1b5a
No preview for this file type
users/users.go
View file @
fe5d1b5a
// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
main
import
(
...
...
@@ -28,9 +24,9 @@ func menuInit(ni * walk.NotifyIcon){
menuInitPower
(
ni
)
menuInitSoftwareInstall
(
ni
)
menuInitWxDriveSync
(
ni
)
menuInit
User
Tools
(
ni
)
menuInitTools
(
ni
)
menuInitFileShares
(
ni
)
menuInit
Other
(
ni
)
menuInit
MyShares
(
ni
)
}
func
main
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment