Commit 8eade0b1 by 浔阳陌客

2022/04/26 v2.5.4

parent e47b8496
...@@ -100,6 +100,7 @@ ...@@ -100,6 +100,7 @@
- 2022/04/23 v2.5.1 每月10号和25号提醒新人创建个人账号 - 2022/04/23 v2.5.1 每月10号和25号提醒新人创建个人账号
- 2022/04/23 v2.5.2 添加知微运维平台的"账号管理功能" - 2022/04/23 v2.5.2 添加知微运维平台的"账号管理功能"
- 2022/04/25 v2.5.3 更新powershell函数 - 2022/04/25 v2.5.3 更新powershell函数
- 2022/04/26 v2.5.4 更新powershell函数
## 四、其他说明 ## 四、其他说明
......
...@@ -108,7 +108,7 @@ func (cir *CIRecordStartup) GetHardWare() { ...@@ -108,7 +108,7 @@ func (cir *CIRecordStartup) GetHardWare() {
// cpu // cpu
go func() { go func() {
defer wg.Done() defer wg.Done()
cpuCount, cpuName, cpuCores, cpuLogicalProcessors := getHardwareCPUForPS() cpuCount, cpuName, cpuCores, cpuLogicalProcessors := GetHardwareCPUForPS()
cir.Cpu = fmt.Sprintf("%s * %s %s核 %s线程", cpuCount, cpuName, cpuCores, cpuLogicalProcessors) cir.Cpu = fmt.Sprintf("%s * %s %s核 %s线程", cpuCount, cpuName, cpuCores, cpuLogicalProcessors)
}() }()
...@@ -116,7 +116,7 @@ func (cir *CIRecordStartup) GetHardWare() { ...@@ -116,7 +116,7 @@ func (cir *CIRecordStartup) GetHardWare() {
go func() { go func() {
defer wg.Done() defer wg.Done()
Capacity, Speed, MemoryType, mCount := getHardwareMemoryForPS() Capacity, Speed, MemoryType, mCount := GetHardwareMemoryForPS()
for i := 0; i <= mCount; i++ { for i := 0; i <= mCount; i++ {
cir.Memory += fmt.Sprintf("%dGB %sMhz %s,", Capacity[i], Speed[i], MemoryType[i]) cir.Memory += fmt.Sprintf("%dGB %sMhz %s,", Capacity[i], Speed[i], MemoryType[i])
} }
...@@ -126,7 +126,7 @@ func (cir *CIRecordStartup) GetHardWare() { ...@@ -126,7 +126,7 @@ func (cir *CIRecordStartup) GetHardWare() {
// 硬盘 // 硬盘
go func() { go func() {
defer wg.Done() defer wg.Done()
_, Sizen, MediaType, hCount := getHardwareHardDiskForPS(false) _, Sizen, MediaType, hCount := GetHardwareHardDiskForPS(false)
for i := 0; i <= hCount; i++ { for i := 0; i <= hCount; i++ {
cir.Disk += fmt.Sprintf("%dGB %s,", Sizen[i], MediaType[i]) cir.Disk += fmt.Sprintf("%dGB %s,", Sizen[i], MediaType[i])
} }
......
...@@ -11,7 +11,7 @@ const SymbolHostname = "-" ...@@ -11,7 +11,7 @@ const SymbolHostname = "-"
// AD-Control // // AD-Control //
const Version string = "2.5.3" const Version string = "2.5.4"
const Host_adserver string = "ADSERVER" const Host_adserver string = "ADSERVER"
const Host_adserver_ip string = "192.168.0.20" const Host_adserver_ip string = "192.168.0.20"
const Host_thserver string = "THSERVER" const Host_thserver string = "THSERVER"
......
...@@ -48,6 +48,13 @@ func DealMsg(msgtype, url string, unmsg []byte) []byte { ...@@ -48,6 +48,13 @@ func DealMsg(msgtype, url string, unmsg []byte) []byte {
ice := msg.MsgDeal() ice := msg.MsgDeal()
ret = ReParseJson(&ice) ret = ReParseJson(&ice)
// CMDB 消息
case Msg_CMDB:
var msg MJcmdb
ParseJson(unmsg, &msg)
ice := msg.MsgDeal()
ret = ReParseJson(&ice)
default: default:
msg := ParseWX(url, &unmsg) msg := ParseWX(url, &unmsg)
go msg.MsgDealSend() go msg.MsgDealSend()
...@@ -422,6 +429,12 @@ func (wake *MJwake) MsgDeal() interface{} { ...@@ -422,6 +429,12 @@ func (wake *MJwake) MsgDeal() interface{} {
return wake return wake
} }
// 关于 CMDB 的消息处理
func (cmdb *MJcmdb) MsgDeal() interface{} {
fmt.Println("cmdb")
return cmdb
}
// 关于 wxwork 企业微信 的 消息处理 // 关于 wxwork 企业微信 的 消息处理
func (wxwork *MJwxwork) MsgDealSend() { func (wxwork *MJwxwork) MsgDealSend() {
......
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
const EndSign byte = 125 const EndSign byte = 125
// msg status ////////////////////////////////////////////////////////////// // msg status //////////////////////////////////////////////////////////////
const Msg_status_commit string = "commit" const Msg_status_commit string = "commit"
const Msg_status_deal string = "deal" const Msg_status_deal string = "deal"
...@@ -16,36 +17,23 @@ const Msg_status_deal string = "deal" ...@@ -16,36 +17,23 @@ const Msg_status_deal string = "deal"
const Msg_Report string = "report" const Msg_Report string = "report"
const Msg_Exec string = "exec" const Msg_Exec string = "exec"
const Msg_Wxwork string = "wxwork"
const Msg_Wake string = "wake" const Msg_Wake string = "wake"
const Msg_CMDB string = "cmdb"
// base word //////////////////////////////////////////////////////////////// const Msg_Wxwork string = "wxwork"
const LogInUser string = "LogInUser"
const LogOutUser string = "LogOutUser"
const WillLogInUser string = "WillLogInUser"
const WillLogOutUser string = "WillLogOutUser"
const TurnOnPC string = "TurnOnPC"
const TurnOffPC string = "TurnOffPC"
const WillTurnOnPC string = "WillTurnOnPC"
const WillTurnOffPC string = "WillTurnOffPC"
const UpdatePrimaryHost string = "UpdatePrimaryHost"
const SignUPUser string = "SignUPUser"
const Dimission string = "Dimission"
// msg report type /////////////////////////////////////////////////////////// // msg report type ///////////////////////////////////////////////////////////
const Msg_Report_LoginInUser string = LogInUser const Msg_Report_LoginInUser string = "LogInUser"
const Msg_Report_LogOutUser string = LogInUser const Msg_Report_LogOutUser string = "LogOutUser"
const Msg_Report_WillLogInUser string = WillLogInUser const Msg_Report_WillLogInUser string = "WillLogInUser"
const Msg_Report_WillLogOutUser string = WillLogOutUser const Msg_Report_WillLogOutUser string = "WillLogOutUser"
const Msg_Report_TurnOnPC string = TurnOnPC const Msg_Report_TurnOnPC string = "TurnOnPC"
const Msg_Report_TurnOffPC string = TurnOffPC const Msg_Report_TurnOffPC string = "TurnOffPC"
const Msg_Report_WillTurnOnPC string = WillTurnOnPC const Msg_Report_WillTurnOnPC string = "WillTurnOnPC"
const Msg_Report_WillTurnOffPC string = WillTurnOffPC const Msg_Report_WillTurnOffPC string = "WillTurnOffPC"
const Msg_Report_UpdatePrimaryHost string = UpdatePrimaryHost const Msg_Report_UpdatePrimaryHost string = "UpdatePrimaryHost"
const Msg_Report_SignUPUser string = SignUPUser const Msg_Report_SignUPUser string = "SignUPUser"
const Msg_Report_Dimission string = Dimission const Msg_Report_Dimission string = "Dimission"
// msg exec type //////////////////////////////////////////////////////////////// // msg exec type ////////////////////////////////////////////////////////////////
...@@ -53,9 +41,9 @@ const Msg_Exec_State_Request string = "request" ...@@ -53,9 +41,9 @@ const Msg_Exec_State_Request string = "request"
const Msg_Exec_State_Ack string = "ack" const Msg_Exec_State_Ack string = "ack"
const Msg_Exec_State_Over string = "over" const Msg_Exec_State_Over string = "over"
const Msg_Exec_UserActivitydetection string = "UserActivitydetection" const Msg_Exec_UserActivitydetection string = "UserActivitydetection"
const Msg_Exec_TurnOffPC string = TurnOffPC const Msg_Exec_TurnOffPC string = "TurnOffPC"
const Msg_Exec_TurnOffPC_cmd string = "shutdown -s -t 300" const Msg_Exec_TurnOffPC_cmd string = "shutdown -s -t 300"
const Msg_Exec_LogOffUser string = LogOutUser const Msg_Exec_LogOffUser string = "LogOutUser"
const Msg_Exec_LogOffUser_cmd string = "shutdown -l" const Msg_Exec_LogOffUser_cmd string = "shutdown -l"
const Msg_Exec_RebootWindows string = "rebootWindows" const Msg_Exec_RebootWindows string = "rebootWindows"
const Msg_Exec_RebootWindows_cmd string = "shutdown -r -t 15" const Msg_Exec_RebootWindows_cmd string = "shutdown -r -t 15"
...@@ -65,6 +53,7 @@ const Msg_Exec_OpenAdminEXE string = "OpenAdmin" ...@@ -65,6 +53,7 @@ const Msg_Exec_OpenAdminEXE string = "OpenAdmin"
const Msg_Exec_OpenRemoteTerminal string = "OpenRemoteTerminal" const Msg_Exec_OpenRemoteTerminal string = "OpenRemoteTerminal"
// msg wkae type //////////////////////////////////////////////////////////////// // msg wkae type ////////////////////////////////////////////////////////////////
const Msg_Wake_Status_Req string = "WakeReq" const Msg_Wake_Status_Req string = "WakeReq"
const Msg_Wake_Status_Start string = "WakeStart" const Msg_Wake_Status_Start string = "WakeStart"
const Msg_Wake_Status_Over string = "WakeOver" const Msg_Wake_Status_Over string = "WakeOver"
...@@ -139,6 +128,13 @@ type MJwxwork struct { ...@@ -139,6 +128,13 @@ type MJwxwork struct {
Result string Result string
Content string Content string
} }
type MJcmdb struct {
MsgType string `json:"msgtype"`
Status string `json:"status"`
Instruction string `json:"instruction"`
Explain string `json:"explain"`
Version string `json:"version"`
}
// //
// //
......
...@@ -370,7 +370,7 @@ func GetNewFolder(rdir, extdir string) string { ...@@ -370,7 +370,7 @@ func GetNewFolder(rdir, extdir string) string {
} }
// 获取硬件信息 // 获取硬件信息
func getHardwareCPUForPS() (string, string, string, string) { func GetHardwareCPUForPS() (string, string, string, string) {
var c, j int var c, j int
var cpuCount, cpuName, cpuCores, cpuLogicalProcessors string var cpuCount, cpuName, cpuCores, cpuLogicalProcessors string
cpuUN, _ := PSCommandOutputNoSplit("Get-WmiObject -Class Win32_Processor | select Name,NumberOfCores,NumberOfLogicalProcessors | format-list") cpuUN, _ := PSCommandOutputNoSplit("Get-WmiObject -Class Win32_Processor | select Name,NumberOfCores,NumberOfLogicalProcessors | format-list")
...@@ -397,7 +397,7 @@ func getHardwareCPUForPS() (string, string, string, string) { ...@@ -397,7 +397,7 @@ func getHardwareCPUForPS() (string, string, string, string) {
} }
return cpuCount, cpuName, cpuCores, cpuLogicalProcessors return cpuCount, cpuName, cpuCores, cpuLogicalProcessors
} }
func getHardwareMemoryForPS() ([]int, []string, []string, int) { func GetHardwareMemoryForPS() ([]int, []string, []string, int) {
Capacity := make([]int, 2) Capacity := make([]int, 2)
Speed := make([]string, 2) Speed := make([]string, 2)
...@@ -465,7 +465,7 @@ func getHardwareMemoryForPS() ([]int, []string, []string, int) { ...@@ -465,7 +465,7 @@ func getHardwareMemoryForPS() ([]int, []string, []string, int) {
} }
return Capacity, Speed, MemoryType, j - 1 return Capacity, Speed, MemoryType, j - 1
} }
func getHardwareHardDiskForPS(mini bool) ([]string, []int64, []string, int) { func GetHardwareHardDiskForPS(mini bool) ([]string, []int64, []string, int) {
MediaType := make([]string, 2) MediaType := make([]string, 2)
FriendlyName := make([]string, 2) FriendlyName := make([]string, 2)
Sizen := make([]int64, 2) Sizen := make([]int64, 2)
......
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