实现获取设备地址和负载均衡

pull/9/head
zimujun20 2 years ago
parent 06d088e333
commit 2b0f2d5f38

@ -7,8 +7,8 @@ import (
"time" "time"
"pkg/app" "pkg/app"
"errors" "errors"
_ "github.com/mattn/go-sqlite3"
_ "github.com/mattn/go-sqlite3"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -81,12 +81,12 @@ func sendAddress(c *gin.Context) {
db.Exec(`update Endpoint set ipAddress = ? where macAddress = ?;`, ipAddress, macAddress) db.Exec(`update Endpoint set ipAddress = ? where macAddress = ?;`, ipAddress, macAddress)
db.Exec(`update Endpoint set isOnLine = ? where macAddress = ?;`, t, macAddress) db.Exec(`update Endpoint set isOnLine = ? where macAddress = ?;`, t, macAddress)
} }
appG.Response(http.StatusOK, "成功", null) appG.Response(http.StatusOK, "true", null)
} }
func mediaPipe(c *gin.Context) { func mediaPipe(c *gin.Context) {
appG := app.Gin{C: c} appG := app.Gin{C: c}
//这里将视频流转化为自然语言 //这里将视频流转化为自然语言
data := data :=
appG.Response(http.StatusOK, "成功", data) appG.Response(http.StatusOK, "true", data)
} }

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
"database/sql" "database/sql"
_ "go-sqlite3-master" _ "go-sqlite3-master"
"application/pkg/app" "pkg/app"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -35,5 +35,5 @@ func wordSend (c *gin.Context) {
//这里获取转化好的数据 //这里获取转化好的数据
data := mediaPipe().data data := mediaPipe().data
updateAverage() updateAverage()
appG.Response(http.StatusOK, "成功", data) appG.Response(http.StatusOK, "true", data)
} }

@ -1,8 +1,27 @@
//获取手语视频 //获取手语视频
func getMedia() {} function getMedia() {
media = infos.media.value
mediaToWords(media)
}
//翻译视频为自然语言 //翻译视频为自然语言
func mediaToWords() {} function mediaToWords(media) {
//这里调用hands_recegnation
display(word)
}
//显示自然语言 //显示自然语言
func display() {} function display(word) {
var xmlhttp;
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest();
else xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (xmlhttp.responseText=="成功") alert("翻译成功!")
else alert("操作失败")
}
}
xmlhttp.open("GET","http://127.0.0.1:8000//",true);
xmlhttp.send();
}

@ -5,7 +5,10 @@ function enterWords() {
} }
//翻译自然语言为动画 //翻译自然语言为动画
function wordsToMedia(words) {} function wordsToMedia(words) {
//这里调用word_input
display(media)
}
//显示动画 //显示动画
function display(media) { function display(media) {
@ -15,10 +18,10 @@ function display(media) {
xmlhttp.onreadystatechange=function() xmlhttp.onreadystatechange=function()
{ {
if (xmlhttp.readyState==4 && xmlhttp.status==200) { if (xmlhttp.readyState==4 && xmlhttp.status==200) {
if (xmlhttp.responseText=="成功") alert("删除成功!") if (xmlhttp.responseText=="成功") alert("翻译成功!")
else alert("操作失败") else alert("操作失败")
} }
} }
xmlhttp.open("GET","http://127.0.0.1:8000//"+"?user="+user+"&ps="+ps,true); xmlhttp.open("GET","http://127.0.0.1:8000//",true);
xmlhttp.send(); xmlhttp.send();
} }
Loading…
Cancel
Save