Commit 1345e69e by 陶腾飞

v0.8:更新 大屏主机的文件共享,取消TXHD的凌晨关机.

parent 45010501
# AD-Control-Goalng
# 程序简介
# 程序简介
本程序是从[AD-Control](http://git.zhiweidata.top/taotengfei/AD-Control)升级而来,并融合了在AD上经常使用的工具.
# 概念
1. **AD,ADServer**是主控
......@@ -12,24 +13,39 @@
# 程序作用简要
## DCU - Domain Computer User
在DC上以**用户权限****任务栏托盘**的方式启动
使用方式:将需要运行以管理员权限启动的程序,提交到DCD来启动程序;其他程序,直接运行
具体功能:详见(需要个DCU的RedMe.md链接)
UI:在DC上以**用户权限****任务栏托盘**的方式运行
启动说明:由组策略的文件替换功能,从文件共享中复制到C:\Windows\System32下,并运行
具体功能:
1. 电源选项
2. 软件安装
3. 微盘同步
4. 文件共享
## DCD - Domain Computer Daemon
运行方式:在DC上以**管理员权限****前台无窗口**运行的方式启动(以后台运行有问题:DCD无法正常启动其他带有GUI界面的程序)
主要功能运行由DCU和ADU提交的程序和与接受处理发送消息
运行方式:由组策略在计算机启动时运行命令`runad.bat daemon`来进行循环启动DCD。(**管理员权限、无窗口**
主要功能运行由DCU和ADU提交的程序和与接受处理发送消息(通常处理需要管理员权限的消息)
## ADD - ADServer Daemon
运行方式:前后台任意
主要作用:根据ADU的参数设定响应来自DC端的请求
## ADU - ADServer User
其他:使用注册表(HKLM\Software\ADControl)作为数据库的存储
## ADU - ADServer User(未完成)
运行方式: 命令行参数形式
主要作用:设定请求返回的结果
# AD-Control运行模型
# 其他说明
用到了github.com/lxn/walk,但是修改了部分代码
1.在notifyicon.go的notifyIconWndProc()中`if showmenu = !showmenu;!showmenu { return } ``var showmenu bool = false `。来解决托盘菜单中按钮点击一次,会跳出2次的问题
2.解决icon文件没有使用指定的绝对路径问题
# 现有问题
在func (rm *ResourceManager) Icon(name string) (*Icon, error) {
更新
if icon, err := NewIconFromFile(filepath.Join(rm.rootDirPath, name)); err == nil {
if icon, err := NewIconFromFile(name); err == nil {
1. DCD应以服务且能与桌面交互的运行方式运作
2. ADU未完成
3. SlaveAD辅控应启动Daemon,作为备用响应请求程序
4. 托盘中菜单按钮不能实时修改
\ No newline at end of file
# 现有问题
1. ADU未完成
2. SlaveAD辅控应启动Daemon,作为备用响应请求程序
3. 托盘中菜单按钮不能实时修改
\ No newline at end of file
No preview for this file type
......@@ -3,7 +3,7 @@ import (
"AD-Control/public"
"time"
"flag"
"strings"
_ "strings"
)
......@@ -53,34 +53,23 @@ func flag_hour(){
switch nh{
case 0:
if strings.Index(public.User_computername,"TXHD")!=-1{
reboot()
} else{
shutdown()
}
shutdown()
break
case 1:
if strings.Index(public.User_computername,"TXHD")!=-1{
reboot()
} else{
shutdown()
}
shutdown()
break
case 2:
if strings.Index(public.User_computername,"TXHD")!=-1{
reboot()
} else{
shutdown()
}
shutdown()
break
case 3:
public.MsgBox(`5分钟后,即将关机,运行Z:\tools\【工具】取消关机.bat`)
public.Execcmd_nowait("shutdown -s -t 300")
shutdown()
break
case 4:
shutdown()
break
case 5:
shutdown()
break
case 6:
default :
break
......
No preview for this file type
......@@ -9,7 +9,7 @@ const ADServerDaemon string = Env_MainADHostname + DaemonListen
var LocalDaemon string = User_computername + DaemonListen
const DocuBase string = `C:\Users\Public\Documents\AD-Control\`
const RandMax int = 60
const Version string = "0.7"
const Version string = "0.8"
const Application string = "AD-Control-Log"
......
......@@ -83,7 +83,6 @@ func ChooseFolder(explain, initDir * string) string {
return fg.FilePath
}
func OpenWindow(s string){
PrintLog(s)
Execcmd_nowait("explorer "+s)
}
......
......@@ -4,12 +4,14 @@ import (
"AD-Control/public"
)
//---------------------------------------------------------
//
// Power
//
//---------------------------------------------------------
// 电源菜单
func menuInitPower(ni * walk.NotifyIcon){
fa := "电源选项"
sub := [...]string{"下班咯","关闭系统","用户注销","重启系统","取消关机计时"}
......@@ -56,29 +58,37 @@ func menuInitPower(ni * walk.NotifyIcon){
sysmenu.SetVisible(true)
sysmenu.SetEnabled(true)
}
// 电源管理 下班
func pWorkOff(){
public.SendServerReport(public.Msg_Report_Offwork)
}
// 电源管理 关机
func pCloseWindows(){
public.SendServerExec(public.Msg_Exec_CloseWindows)
}
// 电源管理 注销用户
func pLogOffUser(){
public.SendServerExec(public.Msg_Exec_LogOffUser)
}
// 电源管理 重启主机
func pRebootWindows(){
public.SendServerExec(public.Msg_Exec_RebootWindows)
}
// 电源管理 取消自动关机
func pCancelCloseWindows(){
public.SendServerExec(public.Msg_Exec_CancelCloseWindows)
}
//--------------------------------------------------------------------
//
// Software Install
//
//--------------------------------------------------------------------
// 软件安装
func menuInitSoftwareInstall(ni * walk.NotifyIcon){
fa := "软件安装"
// 建立空菜单
......@@ -122,6 +132,7 @@ func menuInitSoftwareInstall(ni * walk.NotifyIcon){
sysmenu.SetVisible(true)
sysmenu.SetEnabled(true)
}
// 软件安装 进行安装
func siEnter_admin(softname string){
go public.Msg("等待弹出安装窗口,请稍等。。")
ifFile := public.Exist(`C:\windows\`+softname)
......@@ -129,11 +140,14 @@ func siEnter_admin(softname string){
}
//---------------------------------------------------------------
//
// WxDrive Sync
//
//---------------------------------------------------------------
// 微盘同步
func menuInitWxDriveSync(ni * walk.NotifyIcon){
fa := "微盘同步"
sub := [...]string{"初始化","同步部门共享盘到微盘(手动)","同步部门共享盘到服务器(手动)","说明"}
......@@ -178,6 +192,7 @@ func menuInitWxDriveSync(ni * walk.NotifyIcon){
sysmenu.SetVisible(true)
sysmenu.SetEnabled(true)
}
// 微盘同步 初始化
func wxdsInit(){
explain := "选择个人ID,请根据微盘的文件夹所在位置进行选择,确定并选择并点击文件夹(一串数字)后,点击确定继续进行下一步!具体操作方法点击说明!"
initDir := public.User_Dir_WeDrive
......@@ -195,6 +210,7 @@ func wxdsInit(){
FullWeDrive)
public.Msg("初始化完毕,请在微盘中创建文件夹(办公室部门内部共享),并分享给同事,创建后,点击开始同步即可。")
}
// 微盘同步 同步到微盘
func wxdsToDrive(){
if public.Msg_YesNo("确定手动进行一次 -> 从共享盘同步到微盘吗?如果调整过共享盘的文件结构,请先在微盘中同步调整,否则微盘将会混沌。")==1{
public.SendServer(public.GJexecCopyWeDrive(public.Msg_Exec_CopyWeDrive))
......@@ -203,6 +219,7 @@ func wxdsToDrive(){
}
}
// 微盘同步 同步到服务器
func wxdsToServer(){
reg_Value_WeDriveDir := public.Reg_query_key_one(
public.HKCU,
......@@ -220,30 +237,33 @@ func wxdsToServer(){
}
}
// 微盘同步 说明
func wxdsExplain(){
msg :=
`1.此功能,部门内部的路人甲初始化一次即可,并分享微盘文件夹给炮灰乙、流氓丙即可。
msg :=`
1.此功能,部门内部的路人甲初始化一次即可,并分享微盘文件夹给炮灰乙、流氓丙即可。
2.当路人甲没有启动这个小工具时,土匪丁想要同步的话,也时需要初始化。
2.当路人甲没有启动这个小工具时,土匪丁想要同步的话,也时需要初始化。
5.初始化后,凡是启动了小工具,2小时自动同步一次到微盘。但从微盘同步到部门共享盘中只能是手动的。
5.初始化后,凡是启动了小工具,2小时自动同步一次到微盘。但从微盘同步到部门共享盘中只能是手动的。
7.但限于微盘的特性,当文件共享盘的文件名发生变化,微盘是依旧保留旧文件夹的。所以微盘的文件时需要定期手动清理的。
7.但限于微盘的特性,当文件共享盘的文件名发生变化,微盘是依旧保留旧文件夹的。所以微盘的文件时需要定期手动清理的。
9.关于初始化中路径选择问题:打开微盘,右键打开已下载的文件。根据该文件所在的路径来确定初始化中的路径。
9.关于初始化中路径选择问题:打开微盘,右键打开已下载的文件。根据该文件所在的路径来确定初始化中的路径。
8.以上,此致,敬礼,望赞!
8.以上,此致,敬礼,望赞!
`
public.Msg(msg)
}
//---------------------------------------------------------------
//
// Kinds of Tools
//
//---------------------------------------------------------------
// 其他工具
func menuInitTools(ni * walk.NotifyIcon){
fa := "工具集合"
......@@ -303,20 +323,23 @@ func menuInitTools(ni * walk.NotifyIcon){
sysmenu.SetEnabled(true)
}
// 其他工具 Excel关键词分割器
func tMultiSplit(){
public.Execcmd_nowait(public.Startk + public.Link_MultiSplit)
}
// 其他工具 移动硬盘(胡一波专用)
func tJR_huyibo_movedisk(){
public.SendDaemonExec(`F:\SamsungPortableSSD.exe`)
}
// 其他工具 隐藏图标
func tHideIcon(){
public.Msg("emmmmmmm,大概下周吧,这周无望哈")
}
// 其他工具 显示图标
func tShowIcon(){
public.Msg("仅供参考!!")
}
// 其他工具 测试
func tTest(){
//public.SendDaemonExec(`D:\WXWork.exe`)
}
......@@ -328,6 +351,7 @@ func tTest(){
//
//---------------------------------------------------------------
// 文件共享 (包含域用户和大屏主机的文件共享)
func menuInitFileShares(ni * walk.NotifyIcon){
fa := "文件共享"
......@@ -337,6 +361,9 @@ func menuInitFileShares(ni * walk.NotifyIcon){
public.PrintLog(err)
}
// 说明:添加 域用户 文件共享
// 方法:列举目录名,生成菜单
// 其次,列举额目录中的名单作为按钮添加到菜单
deptList,err := public.ReadDir(public.Env_ADMain)
if err !=nil {
public.PrintLog(err)
......@@ -371,7 +398,6 @@ func menuInitFileShares(ni * walk.NotifyIcon){
nm.Actions().Add(na)
}
if m,err := mfs.Actions().AddMenu(nm);err != nil{
public.PrintLog(err)
}else{
......@@ -382,16 +408,28 @@ func menuInitFileShares(ni * walk.NotifyIcon){
}
}
//将菜单添加到托盘
sysmenu,err := ni.ContextMenu().Actions().AddMenu(mfs)
if err != nil {
// 添加
na := walk.NewAction()
if err := na.SetText("会议室的大脸机"); err != nil {
public.PrintLog(err)
}else{
//将菜单添加到托盘
na.Triggered().Attach(func(){public.OpenWindow(`ftp://adserver`)})
if err := mfs.Actions().Add(na);err != nil{
public.PrintLog(err)
}
}
//将菜单添加到托盘
sysmenu,err := ni.ContextMenu().Actions().AddMenu(mfs)
if err != nil {
public.PrintLog(err)
}
// 主菜单 属性
sysmenu.SetText(fa)
sysmenu.SetVisible(true)
sysmenu.SetEnabled(true)
}
......
No preview for this file type
......@@ -19,7 +19,7 @@ func userInit() string{
}
}()
}
var icoDir =[]string {`AD-Control.ico`,`C:\Users\Public\Documents\AD-Control\AD-Control.ico`}
var icoDir =[]string {`AD-Control.ico`,`C:\windows\system32\AD-Control.ico`,`C:\Users\Public\Documents\AD-Control\AD-Control.ico`}
for _,i := range icoDir{
if public.Exist(i){
return i
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment