diff --git a/.gitignore b/.gitignore
index 7797b887..998f66d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,39 +1,41 @@
-
-/dsBaseRpc/.idea/
-/dsBaseRpc/build/
-/dsBaseRpc/WinBuild/
-/dsBaseRpc/Logs/
-
-/dsAutoCode/Logs/
-/dsAutoCode/.idea/
-/dsAutoCode/build/
-/dsAutoCode/WinBuild/
-/dsAutoCode/lastupdate.log
-
-/dsBaseWeb/.idea/
-/dsBaseWeb/build/
-/dsBaseWeb/WinBuild/
-/dsBaseWeb/Logs/
-/dsBaseWeb/dsBaseRpc.log
-
-/dsData/.idea/
-/dsData/build/
-/dsData/WinBuild/
-/dsData/Logs/
-
-/dsSso/.idea/
-/dsSso/build/
-/dsSso/WinBuild/
-/dsSso/Logs/
-
-/dsTools/.idea/
-/dsTools/build/
-/dsTools/WinBuild/
-
-/dsWatch/.idea/
-/dsWatch/build/
-/dsWatch/WinBuild/
-/dsBaseRpc/Java调用示例/JavaGRpc/target/
-/dsWatch/Logs/
-
-/dsAutoCode/.idea/
+
+/dsBaseRpc/.idea/
+/dsBaseRpc/build/
+/dsBaseRpc/WinBuild/
+/dsBaseRpc/Logs/
+
+/dsAutoCode/Logs/
+/dsAutoCode/.idea/
+/dsAutoCode/build/
+/dsAutoCode/WinBuild/
+/dsAutoCode/lastupdate.log
+
+/dsBaseWeb/.idea/
+/dsBaseWeb/build/
+/dsBaseWeb/WinBuild/
+/dsBaseWeb/Logs/
+/dsBaseWeb/dsBaseRpc.log
+
+/dsData/.idea/
+/dsData/build/
+/dsData/WinBuild/
+/dsData/Logs/
+
+/dsSso/.idea/
+/dsSso/build/
+/dsSso/WinBuild/
+/dsSso/Logs/
+
+/dsTools/.idea/
+/dsTools/build/
+/dsTools/WinBuild/
+
+/dsWatch/.idea/
+/dsWatch/build/
+/dsWatch/WinBuild/
+/dsBaseRpc/Java调用示例/JavaGRpc/target/
+/dsWatch/Logs/
+
+/dsAutoCode/.idea/
+/dsSupport/Source/
+/dsSupport/Target/
diff --git a/dsBaseRpc/Const/DefaultConst/DefaultConst.go b/dsBaseRpc/Const/DefaultConst/DefaultConst.go
deleted file mode 100644
index f85715e2..00000000
--- a/dsBaseRpc/Const/DefaultConst/DefaultConst.go
+++ /dev/null
@@ -1,7 +0,0 @@
-package DefaultConst
-
-var (
- IdentityId = "-1"
- PersonId = "-1"
- DeviceId = "-1"
-)
diff --git a/dsBaseRpc/Documents/创建关闭学校、单位、开启关闭教育局的操作步骤整理.txt b/dsBaseRpc/Documents/创建关闭学校、单位、开启关闭教育局的操作步骤整理.txt
deleted file mode 100644
index a7278ea3..00000000
--- a/dsBaseRpc/Documents/创建关闭学校、单位、开启关闭教育局的操作步骤整理.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-1ҪҵԸάд
-
-2ѧУ̸λʱҪarea_codeͬʱеλʹ룬ԸЩλԱ
-t_base_organization,t_base_teacher,t_sys_loginperson,t_base_roleű--->OK
-
-3õǽ֣ΪǻƺͨʼģҪжDzb_useڷ仯DZΪ㣬
-ҪDzĵλԱ(b_use=1)ڣáڣԽãҪt_base_organization
-t_base_teacher,t_sys_loginpersonűb_use=-1.
-b_use=1ҪԭӦĸǷھݣڣֱӻָb_use=1粻ڣҪ֮
-
-(1) t_base_organization--->ӣֻb_use
-(2) t_base_teacher---->Ҫ
-(3) t_sys_loginperson--->Ҫ
-(4) t_base_role----> Ҫ
\ No newline at end of file
diff --git a/dsBaseRpc/Documents/常见问题.txt b/dsBaseRpc/Documents/常见问题.txt
deleted file mode 100644
index cb812777..00000000
--- a/dsBaseRpc/Documents/常见问题.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
-https://github.com/xormplus/xorm
-*/
\ No newline at end of file
diff --git a/dsBaseRpc/Utils/CommonUtil/AesUtil.go b/dsBaseRpc/Utils/CommonUtil/AesUtil.go
deleted file mode 100644
index 12adc799..00000000
--- a/dsBaseRpc/Utils/CommonUtil/AesUtil.go
+++ /dev/null
@@ -1,65 +0,0 @@
-package CommonUtil
-
-import (
- "bytes"
- "crypto/aes"
- "crypto/cipher"
- "encoding/base64"
-)
-
-func AesEncrypt(orig string, key string) string {
- // 转成字节数组
- origData := []byte(orig)
- k := []byte(key)
-
- // 分组秘钥
- block, _ := aes.NewCipher(k)
- // 获取秘钥块的长度
- blockSize := block.BlockSize()
- // 补全码
- origData = PKCS7Padding(origData, blockSize)
- // 加密模式
- blockMode := cipher.NewCBCEncrypter(block, k[:blockSize])
- // 创建数组
- cryted := make([]byte, len(origData))
- // 加密
- blockMode.CryptBlocks(cryted, origData)
-
- return base64.StdEncoding.EncodeToString(cryted)
-
-}
-
-func AesDecrypt(cryted string, key string) string {
- // 转成字节数组
- crytedByte, _ := base64.StdEncoding.DecodeString(cryted)
- k := []byte(key)
-
- // 分组秘钥
- block, _ := aes.NewCipher(k)
- // 获取秘钥块的长度
- blockSize := block.BlockSize()
- // 加密模式
- blockMode := cipher.NewCBCDecrypter(block, k[:blockSize])
- // 创建数组
- orig := make([]byte, len(crytedByte))
- // 解密
- blockMode.CryptBlocks(orig, crytedByte)
- // 去补全码
- orig = PKCS7UnPadding(orig)
- return string(orig)
-}
-
-//补码
-func PKCS7Padding(ciphertext []byte, blocksize int) []byte {
- padding := blocksize - len(ciphertext)%blocksize
- padtext := bytes.Repeat([]byte{byte(padding)}, padding)
- return append(ciphertext, padtext...)
-}
-
-//去码
-func PKCS7UnPadding(origData []byte) []byte {
- length := len(origData)
- unpadding := int(origData[length-1])
- return origData[:(length - unpadding)]
-}
-
diff --git a/dsBaseRpc/Utils/CommonUtil/HttpUtil.go b/dsBaseRpc/Utils/CommonUtil/HttpUtil.go
deleted file mode 100644
index 219c980c..00000000
--- a/dsBaseRpc/Utils/CommonUtil/HttpUtil.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package CommonUtil
-
-import (
- "fmt"
- "io/ioutil"
- "net/http"
- "strings"
-)
-
-/**
-功能:POST请求
-作者:吴缤
-日期:2020-02-21
-备注:data方式为id=123
-*/
-func HttpPost(url string, data string) (string, error) {
- request, err := http.Post(url, "application/x-www-form-urlencoded", strings.NewReader(data))
- defer request.Body.Close()
- if err != nil {
- fmt.Printf("post data error:%v\n", err)
- return "", err
- } else {
- respBody, err := ioutil.ReadAll(request.Body)
- if err != nil {
- return "", err
- } else {
- return string(respBody), nil
- }
- }
-}
diff --git a/dsBaseRpc/Utils/NetUtil/NetUtil.go b/dsBaseRpc/Utils/NetUtil/NetUtil.go
deleted file mode 100644
index be145481..00000000
--- a/dsBaseRpc/Utils/NetUtil/NetUtil.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package NetUtil
-
-import (
- "fmt"
- "net"
-)
-
-/**
-功能:获取服务器的第一个网卡MAC地址
-作者:黄海
-时间:2020-01-19
- */
-func GetMacAddrs() (macAddrs []string) {
- netInterfaces, err := net.Interfaces()
- if err != nil {
- fmt.Printf("fail to get net interfaces: %v", err)
- return macAddrs
- }
-
- for _, netInterface := range netInterfaces {
- macAddr := netInterface.HardwareAddr.String()
- if len(macAddr) == 0 {
- continue
- }
-
- macAddrs = append(macAddrs, macAddr)
- }
- return macAddrs
-}
-
diff --git a/dsSupport/.idea/.gitignore b/dsSupport/.idea/.gitignore
new file mode 100644
index 00000000..4aa91ea5
--- /dev/null
+++ b/dsSupport/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/dsSupport/.idea/dsSupport.iml b/dsSupport/.idea/dsSupport.iml
new file mode 100644
index 00000000..338a2663
--- /dev/null
+++ b/dsSupport/.idea/dsSupport.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsSupport/.idea/misc.xml b/dsSupport/.idea/misc.xml
new file mode 100644
index 00000000..ef004d16
--- /dev/null
+++ b/dsSupport/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsSupport/.idea/modules.xml b/dsSupport/.idea/modules.xml
new file mode 100644
index 00000000..d8eaf8d9
--- /dev/null
+++ b/dsSupport/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsSupport/.idea/vcs.xml b/dsSupport/.idea/vcs.xml
new file mode 100644
index 00000000..2e3f6920
--- /dev/null
+++ b/dsSupport/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dsSupport/ConvertMovie/Convert.go b/dsSupport/ConvertMovie/Convert.go
new file mode 100644
index 00000000..371720a4
--- /dev/null
+++ b/dsSupport/ConvertMovie/Convert.go
@@ -0,0 +1,23 @@
+package main
+
+import (
+ "dsSupport/Utils/ConvertUtil"
+)
+
+func main() {
+ //源文件
+ source := "B7318F5D-46B8-4AA1-8811-1A9D65528E19.wmv"
+ //1、对视频文件进行切片
+ ConvertUtil.Cut(source)
+ //2、切片完成后,尝试进行转码
+ var childMovie = ConvertUtil.GetAllCutChild(source)
+ for i := range childMovie {
+ ConvertUtil.ConvertToH264Mp4(childMovie[i])
+ }
+ //3、生成拼接的索引文件
+ indexName := ConvertUtil.GenerateIndexTxt(source, childMovie)
+ //4、合成MP4
+ ConvertUtil.Merge(source, indexName)
+ //5、清除垃圾
+ ConvertUtil.ClearRubbish(source)
+}
diff --git a/dsSupport/Utils/ConvertUtil/ConvertUtil.go b/dsSupport/Utils/ConvertUtil/ConvertUtil.go
new file mode 100644
index 00000000..7cd946d6
--- /dev/null
+++ b/dsSupport/Utils/ConvertUtil/ConvertUtil.go
@@ -0,0 +1,135 @@
+package ConvertUtil
+
+import (
+ "dsSupport/Utils/FileUtil"
+ "dsSupport/Utils/ShellUtil"
+ "fmt"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+)
+
+//运行的目录
+var runDir string
+
+// ffmpeg 的命令行位置
+var ffmpeg string
+
+func init() {
+ runDir, _ = os.Getwd()
+
+ ffmpeg=runDir + `\ffmpeg\ffmpeg.exe`
+}
+
+/**
+功能:对指定的视频文件进行切片
+作者:黄海
+时间:2020-07-08
+*/
+func Cut(source string) {
+ //1、源视频文件
+ sourcePath := runDir + "/Source/" + source[0:2] + "/" + source
+ //2、获取文件后缀
+ extension := path.Ext(source)
+ //3、输出的文件通配名称
+ workingPath := runDir + `/Working/` + source[0:2] + "/"
+ if !FileUtil.Exists(workingPath) {
+ os.Mkdir(workingPath, os.ModePerm)
+ }
+ workingPath = workingPath + source[0:36] + "/"
+ if !FileUtil.Exists(workingPath) {
+ os.Mkdir(workingPath, os.ModePerm)
+ }
+
+ targetPath := workingPath + source[0:36] + `_%03d` + extension
+ //尝试删除已存在的视频
+ var i = 0
+ for {
+ var f = workingPath + source[0:36] + "_" + fmt.Sprintf("%03d", i) + extension
+ if FileUtil.Exists(f) {
+ os.Remove(f)
+ } else {
+ break
+ }
+ i++
+ }
+ //4、切片
+ cmdLine := ffmpeg + ` -fflags +genpts -i ` + sourcePath + ` -acodec copy -vcodec copy -f segment -segment_time 300 -reset_timestamps 1 -map 0:0 -map 0:1 ` + targetPath
+ ShellUtil.ExecCommand(cmdLine)
+}
+
+/**
+功能:将指定的视频文件,在切片后,获取都生成了哪些切片
+作者:黄海
+时间:2020-07-08
+*/
+func GetAllCutChild(source string) []string {
+ filepathNames, err := filepath.Glob(filepath.Join(runDir+`/Working/`+source[0:2]+"/"+source[0:36]+"/", "*"))
+ if err!=nil{
+ fmt.Println(err.Error())
+ }
+ return filepathNames
+}
+
+/**
+功能:将视频转为H264格式的MP4
+作者: 黄海
+时间:2020-07-08
+*/
+func ConvertToH264Mp4(childMovie string) {
+ extension := path.Ext(childMovie)
+ childMovieMp4 := strings.Replace(childMovie, extension, ".mp4", -1)
+ //如果存在则删除之
+ if FileUtil.Exists(childMovieMp4) {
+ os.Remove(childMovieMp4)
+ }
+ cmdLine := ffmpeg + ` -i ` + childMovie + ` -c:v libx264 -strict -2 ` + childMovieMp4
+ ShellUtil.ExecCommand(cmdLine)
+}
+/**
+功能:生成索引的文本文件
+作者:黄海
+时间:2020-07-08
+*/
+func GenerateIndexTxt(source string,childMovie []string)string{
+ content:=make([]string,0)
+ for i := range childMovie {
+ extension := path.Ext(childMovie[i])
+ content= append(content, `file '`+strings.Replace(childMovie[i],extension,".mp4",-1)+`'`)
+ }
+ //文件位置
+ indexName:=runDir+`/Working/`+source[0:2]+"/"+source[0:36]+"/"+source[0:36]+".txt"
+ FileUtil.WriteLines(content,indexName)
+ return indexName
+}
+/**
+功能:合并视频
+作者:黄海
+时间:2020-07-08
+ */
+func Merge(source string,indexName string){
+ Target := runDir + `/Target/` + source[0:2] + "/"
+ if !FileUtil.Exists(Target) {
+ os.Mkdir(Target, os.ModePerm)
+ }
+ Target = Target + source[0:36] + "/"
+ if !FileUtil.Exists(Target) {
+ os.Mkdir(Target, os.ModePerm)
+ }
+ cmdLine:=ffmpeg+` -f concat -i `+indexName+` -c copy `+Target+"/"+source[0:36]+".mp4"
+ ShellUtil.ExecCommand(cmdLine)
+}
+
+/**
+功能:清除垃圾
+作者:黄海
+时间:2020-07-08
+ */
+func ClearRubbish(source string){
+ var deletePath=[]string{"Working","Target"}
+ for i := range deletePath {
+ //删除目录
+ os.RemoveAll(runDir+`/`+deletePath[i]+`/`+source[0:2]+"/"+source[0:36])
+ }
+}
diff --git a/dsSupport/Utils/FileUtil/FileUtil.go b/dsSupport/Utils/FileUtil/FileUtil.go
new file mode 100644
index 00000000..49d9c658
--- /dev/null
+++ b/dsSupport/Utils/FileUtil/FileUtil.go
@@ -0,0 +1,58 @@
+package FileUtil
+
+import (
+ "bufio"
+ "fmt"
+ "os"
+)
+
+// 判断所给路径文件/文件夹是否存在
+func Exists(path string) bool {
+ _, err := os.Stat(path) //os.Stat获取文件信息
+ if err != nil {
+ if os.IsExist(err) {
+ return true
+ }
+ return false
+ }
+ return true
+}
+/**
+功能:按行读取文件
+作者:黄海
+时间:2020-07-08
+ */
+func ReadLines(path string) ([]string, error) {
+ file, err := os.Open(path)
+ if err != nil {
+ return nil, err
+ }
+ defer file.Close()
+
+ var lines []string
+ scanner := bufio.NewScanner(file)
+ for scanner.Scan() {
+ lines = append(lines, scanner.Text())
+ }
+ return lines, scanner.Err()
+}
+
+/**
+功能:按行写入文件
+作者:黄海
+时间:2020-07-08
+*/
+func WriteLines(lines []string, path string) error {
+ file, err := os.Create(path)
+ if err != nil {
+ return err
+ }
+ defer file.Close()
+
+ w := bufio.NewWriter(file)
+ for _, line := range lines {
+ fmt.Fprintln(w, line)
+ }
+ return w.Flush()
+}
+
diff --git a/dsSupport/Utils/ShellUtil/ShellUtil.go b/dsSupport/Utils/ShellUtil/ShellUtil.go
new file mode 100644
index 00000000..3e933216
--- /dev/null
+++ b/dsSupport/Utils/ShellUtil/ShellUtil.go
@@ -0,0 +1,15 @@
+package ShellUtil
+
+import (
+ "fmt"
+ "os/exec"
+)
+
+//封装一个函数来执行命令
+func ExecCommand(cmdLine string) {
+ cmd := exec.Command("cmd.exe", "/c", cmdLine)
+ err := cmd.Run()
+ cmd.Wait()
+ fmt.Printf("%s, error:%v \n", cmdLine, err)
+}
+
diff --git a/dsSupport/ffmpeg/ffmpeg.exe b/dsSupport/ffmpeg/ffmpeg.exe
new file mode 100644
index 00000000..84b1819a
Binary files /dev/null and b/dsSupport/ffmpeg/ffmpeg.exe differ
diff --git a/dsSupport/go.mod b/dsSupport/go.mod
new file mode 100644
index 00000000..945334c1
--- /dev/null
+++ b/dsSupport/go.mod
@@ -0,0 +1,3 @@
+module dsSupport
+
+go 1.14