diff --git a/application/server/api/android/hands_3d.go b/application/server/api/android/hands_3d.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/hands_recegnation.go b/application/server/api/android/hands_recegnation.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/hands_translation.go b/application/server/api/android/hands_translation.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/media_camera.go b/application/server/api/android/media_camera.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/media_pipe.go b/application/server/api/android/media_pipe.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/word_input.go b/application/server/api/android/word_input.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/word_recv.go b/application/server/api/android/word_recv.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/word_send.go b/application/server/api/android/word_send.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/android/word_show.go b/application/server/api/android/word_show.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/pc/load_alancing.go b/application/server/api/pc/load_alancing.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/pc/nginx-rtmp.go b/application/server/api/pc/nginx-rtmp.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/api/pc/webserver.go b/application/server/api/pc/webserver.go new file mode 100644 index 0000000..e69de29 diff --git a/application/server/main.go b/application/server/main.go new file mode 100644 index 0000000..dee48c7 --- /dev/null +++ b/application/server/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "time" + + "application/routers" +) + +func main() { + timeLocal, err := time.LoadLocation("Asia/Shanghai") + if err != nil { + log.Printf("时区设置失败 %s", err) + } + time.Local = timeLocal + + endPoint := fmt.Sprintf("0.0.0.0:%d", 8000) + server := &http.Server{ + Addr: endPoint, + Handler: routers.InitRouter(), + } + log.Printf("[info] start http server listening %s", endPoint) + if err := server.ListenAndServe(); err != nil { + log.Printf("start http server failed %s", err) + } +} diff --git a/application/server/pkg/app/response.go b/application/server/pkg/app/response.go new file mode 100644 index 0000000..40b8e13 --- /dev/null +++ b/application/server/pkg/app/response.go @@ -0,0 +1,24 @@ +package app + +import ( + "github.com/gin-gonic/gin" +) + +type Gin struct { + C *gin.Context +} + +type Response struct { + Code int `json:"code"` + Msg string `json:"msg"` + Data interface{} `json:"data"` +} + +func (g *Gin) Response(httpCode int, errMsg string, data interface{}) { + g.C.JSON(httpCode, Response{ + Code: httpCode, + Msg: errMsg, + Data: data, + }) + return +} diff --git a/application/server/routers/router.go b/application/server/routers/router.go new file mode 100644 index 0000000..99d640d --- /dev/null +++ b/application/server/routers/router.go @@ -0,0 +1,26 @@ +package routers + +import ( + "net/http" + + android "application/api/android" + pc "application/api/pc" + + "github.com/gin-gonic/gin" +) + +// InitRouter 初始化路由信息 +func InitRouter() *gin.Engine { + r := gin.Default() + + api := r.Group("/api") + { + api.GET("/android/hello", android.Hello) + api.POST("/android/hello", android.Hello) + api.GET("/pc/hello", pc.Hello) + api.POST("/pc/hello", pc.Hello) + } + // 静态文件路由 + r.StaticFS("/web", http.Dir("./dist/")) + return r +} diff --git a/application/web/src/main.js b/application/web/src/main.js new file mode 100644 index 0000000..e69de29 diff --git a/zimujun_test.txt b/zimujun_test.txt deleted file mode 100644 index 6c41c7e..0000000 --- a/zimujun_test.txt +++ /dev/null @@ -1 +0,0 @@ -smjsmjsmj \ No newline at end of file