@@ -475,6 +475,12 @@ func GetProductListHandler(ctx *gin.Context) {
|
|||||||
ctx.String(http.StatusOK, resp)
|
ctx.String(http.StatusOK, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GuestStatusHandler(ctx *gin.Context) {
|
||||||
|
resp := `{"code":0,"msg":"ok","data":{"disablead":1,"loginswitch":1,"message":"ok","result":0}}`
|
||||||
|
ctx.Header("Content-Type", "text/html;charset=utf-8")
|
||||||
|
ctx.String(http.StatusOK, resp)
|
||||||
|
}
|
||||||
|
|
||||||
func ReportLog(ctx *gin.Context) {
|
func ReportLog(ctx *gin.Context) {
|
||||||
// body, err := io.ReadAll(ctx.Request.Body)
|
// body, err := io.ReadAll(ctx.Request.Body)
|
||||||
// CheckErr(err)
|
// CheckErr(err)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ func main() {
|
|||||||
v1 := r.Group("v1")
|
v1 := r.Group("v1")
|
||||||
{
|
{
|
||||||
v1.GET("/basic/getcode", handler.GetCodeHandler)
|
v1.GET("/basic/getcode", handler.GetCodeHandler)
|
||||||
|
v1.POST("/basic/getcode", handler.GetCodeHandler)
|
||||||
v1.POST("/account/active", handler.ActiveHandler)
|
v1.POST("/account/active", handler.ActiveHandler)
|
||||||
v1.POST("/basic/publickey", handler.PublicKeyHandler)
|
v1.POST("/basic/publickey", handler.PublicKeyHandler)
|
||||||
v1.POST("/basic/handshake", handler.HandshakeHandler)
|
v1.POST("/basic/handshake", handler.HandshakeHandler)
|
||||||
@@ -40,6 +41,7 @@ func main() {
|
|||||||
v1.POST("/basic/loginarea", handler.LoginAreaHandler)
|
v1.POST("/basic/loginarea", handler.LoginAreaHandler)
|
||||||
v1.POST("/account/reportRole", handler.ReportRoleHandler)
|
v1.POST("/account/reportRole", handler.ReportRoleHandler)
|
||||||
v1.POST("/basic/getProductList", handler.GetProductListHandler)
|
v1.POST("/basic/getProductList", handler.GetProductListHandler)
|
||||||
|
v1.POST("/guest/status", handler.GuestStatusHandler)
|
||||||
}
|
}
|
||||||
r.GET("/agreement/all", handler.AgreementHandler)
|
r.GET("/agreement/all", handler.AgreementHandler)
|
||||||
r.GET("/integration/appReport/initialize", handler.ReportApp)
|
r.GET("/integration/appReport/initialize", handler.ReportApp)
|
||||||
|
|||||||
+16
-20
@@ -9,29 +9,25 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func ParseMultipartForm(ctx *gin.Context) {
|
func ParseMultipartForm(ctx *gin.Context) {
|
||||||
if ctx.Request.Header.Get("OS") != "Android" {
|
// I don't know why mime.ParseMediaType() is failed
|
||||||
// I don't know why mime.ParseMediaType() is failed
|
// mime.ParseMediaType(ctx.Request.Header.Get("Content-Type"))
|
||||||
// mime.ParseMediaType(ctx.Request.Header.Get("Content-Type"))
|
boundary := strings.ReplaceAll(ctx.Request.Header.Get("Content-Type"), "multipart/form-data; boundary=", "")
|
||||||
boundary := strings.ReplaceAll(ctx.Request.Header.Get("Content-Type"), "multipart/form-data; boundary=", "")
|
|
||||||
|
|
||||||
var reqData []byte
|
var reqData []byte
|
||||||
mReader := multipart.NewReader(ctx.Request.Body, boundary)
|
mReader := multipart.NewReader(ctx.Request.Body, boundary)
|
||||||
for {
|
for {
|
||||||
part, err := mReader.NextPart()
|
part, err := mReader.NextPart()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
break
|
break
|
||||||
}
|
|
||||||
CheckErr(err)
|
|
||||||
|
|
||||||
data, err := io.ReadAll(part)
|
|
||||||
CheckErr(err)
|
|
||||||
|
|
||||||
reqData = data
|
|
||||||
}
|
}
|
||||||
ctx.Set("request_data", string(reqData))
|
CheckErr(err)
|
||||||
} else {
|
|
||||||
ctx.Set("request_data", ctx.PostForm("request_data"))
|
data, err := io.ReadAll(part)
|
||||||
|
CheckErr(err)
|
||||||
|
|
||||||
|
reqData = data
|
||||||
}
|
}
|
||||||
|
ctx.Set("request_data", string(reqData))
|
||||||
|
|
||||||
ctx.Next()
|
ctx.Next()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user