更改目录结构
This commit is contained in:
1 parent
be6b954dba
commit
68415a3061
20 files changed
+116
-15
No files matched your search
+51
-2
@@ -1,8 +1,11 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"changeme/cameraFunc"
|
"changeme/internal/logic/cameraFunc"
|
||||||
"changeme/util/response"
|
"changeme/internal/logic/util/response"
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
"sync"
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/net/ghttp"
|
"github.com/gogf/gf/v2/net/ghttp"
|
||||||
)
|
)
|
||||||
@@ -44,4 +47,50 @@ func DownLoadCameraJpg(r *ghttp.Request) {
|
|||||||
}
|
}
|
||||||
response.SusJson(true, r, "下载成功")
|
response.SusJson(true, r, "下载成功")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func DownLoadAllCameraJpg(r *ghttp.Request) {
|
||||||
|
fileType := r.Get("file_type").String()
|
||||||
|
ids := r.Get("ids").String()
|
||||||
|
if ids == "" {
|
||||||
|
response.FailJson(true, r, "参数错误")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
arrIds := strings.Split(ids, ",")
|
||||||
|
arrDeviceId := []string{
|
||||||
|
"11", "12", "14", "22", "23", "32", "34", "42", "43", "52", "54", "62",
|
||||||
|
"63", "71", "72", "74", "82", "83", "92", "94", "102", "103", "112",
|
||||||
|
"114", "122", "123",
|
||||||
|
}
|
||||||
|
arrFail := make([]string, 0)
|
||||||
|
var wg sync.WaitGroup
|
||||||
|
var mu sync.Mutex
|
||||||
|
|
||||||
|
// 控制并发数,限制最大并发goroutine数量
|
||||||
|
sem := make(chan struct{}, 26) // 限制并发数为10
|
||||||
|
|
||||||
|
for _, id := range arrIds {
|
||||||
|
for _, deviceId := range arrDeviceId {
|
||||||
|
wg.Add(1)
|
||||||
|
go func(id, deviceId string) {
|
||||||
|
defer wg.Done()
|
||||||
|
|
||||||
|
// 控制并发数
|
||||||
|
sem <- struct{}{}
|
||||||
|
defer func() { <-sem }()
|
||||||
|
|
||||||
|
err := cameraFunc.DownLoadCameraJpgByFtp(id, deviceId, fileType)
|
||||||
|
if err != nil {
|
||||||
|
mu.Lock()
|
||||||
|
arrFail = append(arrFail, fmt.Sprintf("%s_%s-error-%s", id, deviceId, err.Error()))
|
||||||
|
mu.Unlock()
|
||||||
|
}
|
||||||
|
}(id, deviceId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 等待所有goroutine完成
|
||||||
|
wg.Wait()
|
||||||
|
// 所有下载成功
|
||||||
|
response.SusJson(true, r, "下载成功",arrFail)
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"changeme/masterFunc"
|
"changeme/internal/logic/masterFunc"
|
||||||
"changeme/util/response"
|
"changeme/internal/logic/util/response"
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/net/ghttp"
|
"github.com/gogf/gf/v2/net/ghttp"
|
||||||
)
|
)
|
||||||
|
|||||||
+3
-3
@@ -1,9 +1,9 @@
|
|||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"changeme/db"
|
"changeme/internal/logic/db"
|
||||||
"changeme/model"
|
"changeme/internal/logic/util/response"
|
||||||
"changeme/util/response"
|
"changeme/internal/model"
|
||||||
|
|
||||||
"github.com/gogf/gf/v2/net/ghttp"
|
"github.com/gogf/gf/v2/net/ghttp"
|
||||||
)
|
)
|
||||||
|
|||||||
+14
@@ -233,3 +233,17 @@ export function ClipboardGetText(): Promise<string>;
|
|||||||
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
// [ClipboardSetText](https://wails.io/docs/reference/runtime/clipboard#clipboardsettext)
|
||||||
// Sets a text on the clipboard
|
// Sets a text on the clipboard
|
||||||
export function ClipboardSetText(text: string): Promise<boolean>;
|
export function ClipboardSetText(text: string): Promise<boolean>;
|
||||||
|
|
||||||
|
// [OnFileDrop](https://wails.io/docs/reference/runtime/draganddrop#onfiledrop)
|
||||||
|
// OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||||
|
export function OnFileDrop(callback: (x: number, y: number ,paths: string[]) => void, useDropTarget: boolean) :void
|
||||||
|
|
||||||
|
// [OnFileDropOff](https://wails.io/docs/reference/runtime/draganddrop#dragandddropoff)
|
||||||
|
// OnFileDropOff removes the drag and drop listeners and handlers.
|
||||||
|
export function OnFileDropOff() :void
|
||||||
|
|
||||||
|
// Check if the file path resolver is available
|
||||||
|
export function CanResolveFilePaths(): boolean;
|
||||||
|
|
||||||
|
// Resolves file paths for an array of files
|
||||||
|
export function ResolveFilePaths(files: File[]): void
|
||||||
@@ -199,4 +199,40 @@ export function ClipboardGetText() {
|
|||||||
|
|
||||||
export function ClipboardSetText(text) {
|
export function ClipboardSetText(text) {
|
||||||
return window.runtime.ClipboardSetText(text);
|
return window.runtime.ClipboardSetText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @callback OnFileDropCallback
|
||||||
|
* @param {number} x - x coordinate of the drop
|
||||||
|
* @param {number} y - y coordinate of the drop
|
||||||
|
* @param {string[]} paths - A list of file paths.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnFileDrop listens to drag and drop events and calls the callback with the coordinates of the drop and an array of path strings.
|
||||||
|
*
|
||||||
|
* @export
|
||||||
|
* @param {OnFileDropCallback} callback - Callback for OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||||
|
* @param {boolean} [useDropTarget=true] - Only call the callback when the drop finished on an element that has the drop target style. (--wails-drop-target)
|
||||||
|
*/
|
||||||
|
export function OnFileDrop(callback, useDropTarget) {
|
||||||
|
return window.runtime.OnFileDrop(callback, useDropTarget);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnFileDropOff removes the drag and drop listeners and handlers.
|
||||||
|
*/
|
||||||
|
export function OnFileDropOff() {
|
||||||
|
return window.runtime.OnFileDropOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function CanResolveFilePaths() {
|
||||||
|
return window.runtime.CanResolveFilePaths();
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ResolveFilePaths(files) {
|
||||||
|
return window.runtime.ResolveFilePaths(files);
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ require (
|
|||||||
github.com/jlaffaye/ftp v0.2.0
|
github.com/jlaffaye/ftp v0.2.0
|
||||||
github.com/mattn/go-sqlite3 v1.14.24
|
github.com/mattn/go-sqlite3 v1.14.24
|
||||||
github.com/pkg/sftp v1.13.7
|
github.com/pkg/sftp v1.13.7
|
||||||
github.com/wailsapp/wails/v2 v2.7.1
|
github.com/wailsapp/wails/v2 v2.9.2
|
||||||
golang.org/x/crypto v0.29.0
|
golang.org/x/crypto v0.29.0
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS
|
|||||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
|
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||||
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
|
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
|
||||||
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
|
||||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
|
||||||
@@ -104,8 +104,8 @@ github.com/wailsapp/go-webview2 v1.0.16 h1:wffnvnkkLvhRex/aOrA3R7FP7rkvOqL/bir1b
|
|||||||
github.com/wailsapp/go-webview2 v1.0.16/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
github.com/wailsapp/go-webview2 v1.0.16/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||||
github.com/wailsapp/wails/v2 v2.7.1 h1:HAzp2c5ODOzsLC6ZMDVtNOB72ozM7/SJecJPB2Ur+UU=
|
github.com/wailsapp/wails/v2 v2.9.2 h1:Xb5YRTos1w5N7DTMyYegWaGukCP2fIaX9WF21kPPF2k=
|
||||||
github.com/wailsapp/wails/v2 v2.7.1/go.mod h1:oIJVwwso5fdOgprBYWXBBqtx6PaSvxg8/KTQHNGkadc=
|
github.com/wailsapp/wails/v2 v2.9.2/go.mod h1:uehvlCwJSFcBq7rMCGfk4rxca67QQGsbg5Nm4m9UnBs=
|
||||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM=
|
go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM=
|
||||||
go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU=
|
go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU=
|
||||||
|
|||||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
|||||||
package db
|
package db
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"changeme/model"
|
"changeme/internal/model"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -2,7 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"changeme/api"
|
"changeme/api"
|
||||||
"changeme/initFunc"
|
"changeme/internal/logic/initFunc"
|
||||||
"context"
|
"context"
|
||||||
"embed"
|
"embed"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -17,6 +17,7 @@ import (
|
|||||||
"github.com/wailsapp/wails/v2/pkg/menu/keys"
|
"github.com/wailsapp/wails/v2/pkg/menu/keys"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options"
|
"github.com/wailsapp/wails/v2/pkg/options"
|
||||||
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
"github.com/wailsapp/wails/v2/pkg/options/assetserver"
|
||||||
|
"github.com/wailsapp/wails/v2/pkg/runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:embed all:frontend/dist
|
//go:embed all:frontend/dist
|
||||||
@@ -56,7 +57,7 @@ func main() {
|
|||||||
AppMenu := menu.NewMenu()
|
AppMenu := menu.NewMenu()
|
||||||
SubMenu := AppMenu.AddSubmenu("工具")
|
SubMenu := AppMenu.AddSubmenu("工具")
|
||||||
SubMenu.AddText("刷新", keys.CmdOrCtrl("F5"), func(_ *menu.CallbackData) {
|
SubMenu.AddText("刷新", keys.CmdOrCtrl("F5"), func(_ *menu.CallbackData) {
|
||||||
// runtime.Reload(app.ctx)
|
runtime.WindowReloadApp(app.ctx)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@@ -118,6 +119,7 @@ func HttpServer(){
|
|||||||
s.BindHandler("/update_take_photo",api.UpdateDbData)
|
s.BindHandler("/update_take_photo",api.UpdateDbData)
|
||||||
s.BindHandler("/delete_take_photo",api.DeleteDbData)
|
s.BindHandler("/delete_take_photo",api.DeleteDbData)
|
||||||
s.BindHandler("/download_camera_jpg",api.DownLoadCameraJpg)
|
s.BindHandler("/download_camera_jpg",api.DownLoadCameraJpg)
|
||||||
|
s.BindHandler("/download_all_camera_jpg",api.DownLoadAllCameraJpg)
|
||||||
s.BindHandler("/download_master_jpg",api.DownLoadMasterJpg)
|
s.BindHandler("/download_master_jpg",api.DownLoadMasterJpg)
|
||||||
|
|
||||||
s.SetPort(8383)
|
s.SetPort(8383)
|
||||||
|
|||||||
Reference in new issue
Block a user