|
@@ -74,7 +74,7 @@ func main() {
|
|
|
select {}
|
|
|
}
|
|
|
|
|
|
-//dealWatch 处理监听程序,获取最新的文件夹路径
|
|
|
+// dealWatch 处理监听程序,获取最新的文件夹路径
|
|
|
func dealWatch() {
|
|
|
log.Println("start dealWatch")
|
|
|
//监听目录
|
|
@@ -123,7 +123,7 @@ func dealWatch() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//dealFiles 处理路径下的文件
|
|
|
+// dealFiles 处理路径下的文件
|
|
|
func dealFiles() {
|
|
|
option.RootPath = LastPath
|
|
|
fmt.Println("LastPath =>", LastPath)
|
|
@@ -133,7 +133,7 @@ func dealFiles() {
|
|
|
}
|
|
|
|
|
|
//1.判断数据表数量
|
|
|
- if len(rootNodes.Children) != pathTableSize {
|
|
|
+ if len(rootNodes.Children) <= 0 {
|
|
|
log.Printf("%s 目录下文件夹数量为:%s", rootNodes.Path, len(rootNodes.Children))
|
|
|
} else {
|
|
|
for _, v := range rootNodes.Children {
|
|
@@ -156,7 +156,7 @@ func dealFiles() {
|
|
|
}
|
|
|
|
|
|
//满足条件,触发同步
|
|
|
- if len(tableSlice) == pathTableSize {
|
|
|
+ if len(tableSlice) > 0 {
|
|
|
data := map[string]interface{}{
|
|
|
"start": true,
|
|
|
"path": LastPath,
|
|
@@ -168,7 +168,7 @@ func dealFiles() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-//SendUdpMsg 通知处理企业新增数据
|
|
|
+// SendUdpMsg 通知处理企业新增数据
|
|
|
func SendUdpMsg(data map[string]interface{}, target *net.UDPAddr) {
|
|
|
bytes, _ := json.Marshal(data)
|
|
|
UdpClient.WriteUdp(bytes, udp.OP_TYPE_DATA, target)
|
|
@@ -176,7 +176,7 @@ func SendUdpMsg(data map[string]interface{}, target *net.UDPAddr) {
|
|
|
util.Debug("target :=>", target.IP, target.Port)
|
|
|
}
|
|
|
|
|
|
-//processUdpMsg 处理udp
|
|
|
+// processUdpMsg 处理udp
|
|
|
func processUdpMsg(act byte, data []byte, ra *net.UDPAddr) {
|
|
|
switch act {
|
|
|
case udp.OP_TYPE_DATA:
|