Apply .gitignore rules

This commit is contained in:
皮蛋13361098506
2025-01-06 16:21:36 +08:00
parent 1b77f62820
commit ccd2c530cf
580 changed files with 69806 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
module goutil
go 1.22.2
require (
github.com/bkaradzic/go-lz4 v1.0.0
github.com/elastic/go-elasticsearch/v8 v8.0.0-20210916085751-c2fb55d91ba4
github.com/fatih/color v1.15.0
github.com/go-sql-driver/mysql v1.5.0
github.com/gomodule/redigo v1.8.9
github.com/gorilla/websocket v1.4.2
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8
google.golang.org/grpc v1.45.0
google.golang.org/protobuf v1.26.0
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
)
require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.3.6 // indirect
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
)

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# 赋予可执行权限
chmod +x adminServer
echo "启动中..."
# 接受命令行传入一个参数
case "$1" in
d)
# 使用 nohup 将进程放到后台运行,并将输出重定向到 nohup.out 文件
nohup ./adminServer > nohup.out 2>&1 &
echo "启动完成"
;;
*)
./adminServer
;;
esac
echo "启动完成"

View File

@@ -0,0 +1,80 @@
package httpServer
import (
config "common/configsYaml"
"common/resultStatus"
"common/utils"
"common/webServer"
"encoding/json"
"fmt"
"goutil/logUtilPlus"
"goutil/stringUtil"
"net/http"
"strings"
)
// selfDefineMux
// @description: 定义自定义的Mux对象
type selfDefineMux struct {
}
// ServeHTTP
// @description: ServeHTTP
// parameter:
// @receiver mux: mux
// @w: w
// @r: r
// return:
func (mux *selfDefineMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
responseObj := webServer.GetInitResponseObj()
defer utils.LogReqErrorRecover(r)
// 判断是否是接口文档
if strings.Contains(r.RequestURI, "Remarks") && r.Method == "GET" {
remarkFunc(w, r)
return
}
// 判断是否是POST方法
if r.Method != "POST" {
responseResult(w, responseObj.SetResultStatus(resultStatus.OnlySupportPOST))
return
}
// 因为httpserver——面向外网client故屏蔽了webserver中的ip限制
// 构造contex
context, errMsg := NewApiContext(r, w, false)
if errMsg != nil {
// 输出结果
responseResult(w, responseObj.SetResultStatus(resultStatus.APIDataError))
return
}
// 根据路径选择不同的处理方法
if handlerFunObj, exists := GetHandleFunc(r.RequestURI); exists {
defer func() {
if config.DEBUG {
b, _ := json.Marshal(responseObj)
msg := fmt.Sprintf("API:%v 请求数据:%v;返回数据:%s;",
r.RequestURI, string(context.GetRequestBytes()), string(b))
logUtilPlus.DebugLog(msg)
}
}()
// 输出结果
responseObj := handlerFunObj.HandleFun()(context)
responseResult(w, responseObj)
return
}
// 通过反射选择不同的方法
strs := stringUtil.Split(r.RequestURI, []string{"/"})
params, err := context.RequestDataBySlice2()
if err != nil {
responseResult(w, responseObj.SetResultStatus(resultStatus.APIDataError))
return
}
resquestData := webServer.NewRequestObject(strs[1], strs[2], params)
resp := CallFunction(resquestData)
responseResult(w, resp)
}