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
ea6bda72
Commit
ea6bda72
authored
Aug 21, 2020
by
陶腾飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.8.1 解决无法处理收到的消息问题
parent
eca29c2a
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
23 deletions
+39
-23
README.MD
+1
-0
adct/adct.go
+1
-1
daemon/daemon.go
+3
-0
public/env.go
+2
-2
public/msg_deal.go
+12
-6
public/print.go
+1
-1
public/send.go
+19
-13
No files found.
README.MD
View file @
ea6bda72
...
...
@@ -64,6 +64,7 @@ UI:
-
2020/08/12 v1.6.1 优化备份方案
-
2020/08/19 v1.7.0 更新PDF转化工具,优化用户备份
-
2020/08/21 v1.8.0 合并企业微信推送,转型HTTP服务器,增加活动检测,用户备份升级
-
2020/08/21 v1.8.1 解决无法处理收到的消息问题
## 其他说明
...
...
adct/adct.go
View file @
ea6bda72
...
...
@@ -20,7 +20,7 @@ func initLog(){
}
}
pub
.
Loger
=
pub
.
NewLoger
(
logpath
)
pub
.
Loger
=
pub
.
NewLoger
(
logpath
+
"adct.log"
)
}
func
main
(){
initLog
()
...
...
daemon/daemon.go
View file @
ea6bda72
...
...
@@ -9,7 +9,9 @@ func main() {
// 写入日志
pub
.
Loger
=
pub
.
NewLoger
(
pub
.
Dir_AD_log
+
`daemon.log`
)
pub
.
PrintLog
(
"start daemon!"
)
http
.
HandleFunc
(
"/"
,
pub
.
DealMsgEnter
)
http
.
ListenAndServe
(
pub
.
DaemonListen
,
nil
)
}
\ No newline at end of file
public/env.go
View file @
ea6bda72
...
...
@@ -5,7 +5,7 @@ package public
const
Host_adserver
string
=
"ADSERVER"
const
ADServerDaemon
string
=
Host_adserver
+
DaemonListen
const
DaemonListen
string
=
":16823"
const
Version
string
=
"1.8.
0
"
const
Version
string
=
"1.8.
1
"
const
Bak_Version
string
=
"0819"
var
Active
bool
=
true
...
...
@@ -65,7 +65,7 @@ const App_adct string = SMB_ADSoftApplication + "adct.exe"
const
App_MultiSplit
string
=
SMB_ADSoftOthTool
+
"win_MultiSplit.exe"
const
App_SyncExe
string
=
App_Sync
+
`.exe`
const
App_Sync
string
=
`syncappw`
const
App_Sync_full
string
=
`C:\Progra~1\zhiwei\AllWay_Sync\Bin\`
+
App_Sync
const
App_Sync_full
string
=
`C:\Progra~1\zhiwei\AllWay_Sync\Bin\`
+
App_Sync
Exe
// reg info //
...
...
public/msg_deal.go
View file @
ea6bda72
...
...
@@ -12,14 +12,20 @@ import(
func
DealMsgEnter
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
var
msgtype
string
=
r
.
URL
.
Path
[
1
:
]
msgtype
:
=
r
.
URL
.
Path
[
1
:
]
url
:=
r
.
URL
.
RawQuery
unmsg
,
err
:=
ioutil
.
ReadAll
(
r
.
Body
)
if
err
!=
nil
{
PntError
(
err
)
w
.
Write
([]
byte
(
""
))
}
ret
:=
DealMsg
(
msgtype
,
url
,
unmsg
)
w
.
Write
(
ret
)
}
func
DealMsg
(
msgtype
,
url
string
,
unmsg
[]
byte
)
[]
byte
{
var
ret
[]
byte
switch
msgtype
{
// 报告 消息
case
Msg_Report
:
...
...
@@ -54,15 +60,13 @@ func DealMsgEnter(w http.ResponseWriter, r *http.Request) {
ret
=
ReParseJson
(
&
ice
)
default
:
pmsg
:=
ParseWX
(
r
.
URL
.
RawQuery
,
&
unmsg
)
pmsg
:=
ParseWX
(
url
,
&
unmsg
)
go
pmsg
.
MsgDealSend
()
}
w
.
Write
(
ret
)
return
ret
}
//
//
// 具体消息实现
...
...
@@ -75,6 +79,8 @@ func (rep *MJreport)MsgDeal() interface{} {
switch
rep
.
Instruction
{
case
Msg_Report_InitBak
:
PrintLog
(
rep
.
Computername
,
"初始化备份"
)
if
!
IsPrimaryUser
(
rep
.
Username
)
||
RunAsPC
(
rep
.
Username
){
return
nil
}
...
...
public/print.go
View file @
ea6bda72
...
...
@@ -14,7 +14,7 @@ func NewLoger(s string) * log.Logger{
s
,
os
.
O_RDWR
|
os
.
O_CREATE
|
os
.
O_APPEND
,
0766
);
err
!=
nil
&&
DomainComputer
(){
SendServerError
(
fmt
.
Errorf
(
"%s %v-%v"
,
s
,
Error_Fail_File_Open
,
err
))
PrintLog
(
fmt
.
Errorf
(
"%s %v-%v"
,
s
,
Error_Fail_File_Open
,
err
))
}
return
log
.
New
(
Log_file_obj
,
""
,
log
.
LstdFlags
)
}
...
...
public/send.go
View file @
ea6bda72
...
...
@@ -9,26 +9,26 @@ import (
)
func
SendServerReport
(
s
string
)
([]
byte
,
error
)
{
return
SendMsg
(
Msg_Report
,
GJreport
(
s
))
func
SendServerReport
(
s
string
)
{
SendMsg
(
Msg_Report
,
GJreport
(
s
))
}
func
SendServerExec
(
s
string
)
([]
byte
,
error
)
{
return
SendMsg
(
Msg_Exec
,
GJexec
(
s
))
func
SendServerExec
(
s
string
)
{
SendMsg
(
Msg_Exec
,
GJexec
(
s
))
}
func
SendServerExecJ
(
v
interface
{})
([]
byte
,
error
)
{
return
SendMsg
(
Msg_Exec
,
v
)
func
SendServerExecJ
(
v
interface
{})
{
SendMsg
(
Msg_Exec
,
v
)
}
func
SendServerError
(
err
error
)
([]
byte
,
error
)
{
return
SendMsg
(
Msg_Error
,
GJerror
(
err
))
func
SendServerError
(
err
error
)
{
SendMsg
(
Msg_Error
,
GJerror
(
err
))
}
// base
func
SendMsg
(
msgtype
string
,
v
interface
{})
([]
byte
,
error
)
{
func
SendMsg
(
msgtype
string
,
v
interface
{})
{
//将结构体 转化成 byte
textbyte
,
err
:=
json
.
Marshal
(
v
)
if
err
!=
nil
{
PntError
(
"Json to String Error "
,
v
,
err
)
return
nil
,
err
}
link
:=
fmt
.
Sprintf
(
"http://%s/%s"
,
ADServerDaemon
,
msgtype
)
PntSend
(
link
,
string
(
textbyte
))
...
...
@@ -38,14 +38,20 @@ func SendMsg(msgtype string ,v interface{}) ([]byte,error){
link
,
"application/json; charset=utf-8"
,
bytes
.
NewReader
(
textbyte
))
if
err
!=
nil
{
return
nil
,
err
PntError
(
err
)
}
defer
resp
.
Body
.
Close
()
// 读取数据
body
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
PntError
(
err
)
}
// 处理数据
DealMsg
(
GetMsgType
(
body
),
""
,
body
)
return
body
,
nil
}
// 发送Get请求
...
...
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