|
|
@@ -2,7 +2,7 @@ package controllers
|
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
- "io/ioutil"
|
|
|
+ "io"
|
|
|
"os"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
@@ -437,7 +437,7 @@ func (o *CameraController) Snapshot() {
|
|
|
}
|
|
|
defer f.Close()
|
|
|
f.Seek(0, 0)
|
|
|
- content, err := ioutil.ReadAll(f)
|
|
|
+ content, err := io.ReadAll(f)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
@@ -458,7 +458,7 @@ func (o *CameraController) Snapshot() {
|
|
|
filepath = filepath + strDate + string(os.PathSeparator)
|
|
|
os.MkdirAll(filepath, os.ModePerm)
|
|
|
filepath = filepath + fh.Filename
|
|
|
- err = ioutil.WriteFile(filepath, content, os.ModePerm)
|
|
|
+ err = os.WriteFile(filepath, content, os.ModePerm)
|
|
|
if err != nil {
|
|
|
beego.Error("Snapshot存储抓图发生错误:", err)
|
|
|
}
|
|
|
@@ -474,14 +474,14 @@ func (o *CameraController) PresetPicture() {
|
|
|
}
|
|
|
defer f.Close()
|
|
|
f.Seek(0, 0)
|
|
|
- content, err := ioutil.ReadAll(f)
|
|
|
+ content, err := io.ReadAll(f)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
filepath := "file" + string(os.PathSeparator) + "preset" + string(os.PathSeparator)
|
|
|
os.MkdirAll(filepath, os.ModePerm)
|
|
|
filepath = filepath + fh.Filename
|
|
|
- err = ioutil.WriteFile(filepath, content, os.ModePerm)
|
|
|
+ err = os.WriteFile(filepath, content, os.ModePerm)
|
|
|
if err != nil {
|
|
|
beego.Error("Snapshot存储抓图发生错误:", err)
|
|
|
}
|
|
|
@@ -497,7 +497,7 @@ func (o *CameraController) FLV() {
|
|
|
}
|
|
|
defer f.Close()
|
|
|
f.Seek(0, 0)
|
|
|
- content, err := ioutil.ReadAll(f)
|
|
|
+ content, err := io.ReadAll(f)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
@@ -518,7 +518,7 @@ func (o *CameraController) FLV() {
|
|
|
filepath = filepath + strDate + string(os.PathSeparator)
|
|
|
os.MkdirAll(filepath, os.ModePerm)
|
|
|
filepath = filepath + fh.Filename
|
|
|
- err = ioutil.WriteFile(filepath, content, os.ModePerm)
|
|
|
+ err = os.WriteFile(filepath, content, os.ModePerm)
|
|
|
if err != nil {
|
|
|
beego.Error("MP4存储发生错误:", err)
|
|
|
}
|
|
|
@@ -541,7 +541,7 @@ func (o *CameraController) GetSnapshot() {
|
|
|
//dir := "file/snapshot/" + util.MlNow().Format("2006-01-02") + "/"
|
|
|
filepath := "file" + string(os.PathSeparator) + "snapshot" + string(os.PathSeparator) +
|
|
|
code + string(os.PathSeparator) + date + string(os.PathSeparator)
|
|
|
- fis, err := ioutil.ReadDir(filepath)
|
|
|
+ fis, err := os.ReadDir(filepath)
|
|
|
if err != nil {
|
|
|
beego.Error(fmt.Sprintf("未找到该路径[%s],请先抓图", err.Error()))
|
|
|
o.Response(Failure, "未找到该路径,请先抓图", nil)
|
|
|
@@ -576,7 +576,7 @@ func (o *CameraController) GetFLV() {
|
|
|
//dir := "file/snapshot/" + util.MlNow().Format("2006-01-02") + "/"
|
|
|
filepath := "file" + string(os.PathSeparator) + "flv" + string(os.PathSeparator) +
|
|
|
code + string(os.PathSeparator) + date + string(os.PathSeparator)
|
|
|
- fis, err := ioutil.ReadDir(filepath)
|
|
|
+ fis, err := os.ReadDir(filepath)
|
|
|
if err != nil {
|
|
|
beego.Error(fmt.Sprintf("未找到该路径[%s],请先录制mp4", err.Error()))
|
|
|
o.Response(Failure, "未找到该路径,请先录制mp4", nil)
|