|
@@ -2,8 +2,10 @@ package hdl |
|
|
|
|
|
|
|
|
import ( |
|
|
import ( |
|
|
"applet/app/utils" |
|
|
"applet/app/utils" |
|
|
|
|
|
"encoding/xml" |
|
|
"fmt" |
|
|
"fmt" |
|
|
"github.com/gin-gonic/gin" |
|
|
"github.com/gin-gonic/gin" |
|
|
|
|
|
"io/ioutil" |
|
|
"net/http" |
|
|
"net/http" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
@@ -15,14 +17,29 @@ type ReqWxMessage struct { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func SetTicket(c *gin.Context) { |
|
|
func SetTicket(c *gin.Context) { |
|
|
params := c.QueryMap("*") |
|
|
|
|
|
|
|
|
query := c.Request.URL.Query() |
|
|
|
|
|
var params = map[string]string{} |
|
|
|
|
|
for key, value := range query { |
|
|
|
|
|
fmt.Printf("Key: %s, Value: %s\n", key, value[0]) |
|
|
|
|
|
params[key] = value[0] |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
utils.FilePutContents("SetTicket_Get", utils.SerializeStr(params)) |
|
|
utils.FilePutContents("SetTicket_Get", utils.SerializeStr(params)) |
|
|
|
|
|
|
|
|
var wxMsg ReqWxMessage |
|
|
var wxMsg ReqWxMessage |
|
|
err := c.BindXML(&wxMsg) |
|
|
|
|
|
|
|
|
// 读取请求体 |
|
|
|
|
|
body, err := ioutil.ReadAll(c.Request.Body) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": "failed to read request body"}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
err = xml.Unmarshal(body, &wxMsg) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
fmt.Println("setTicket>>>>>>>>", err.Error()) |
|
|
fmt.Println("setTicket>>>>>>>>", err.Error()) |
|
|
|
|
|
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) |
|
|
|
|
|
return |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
utils.FilePutContents("SetTicket_XML", utils.SerializeStr(wxMsg)) |
|
|
utils.FilePutContents("SetTicket_XML", utils.SerializeStr(wxMsg)) |
|
|
c.String(http.StatusOK, "success") |
|
|
c.String(http.StatusOK, "success") |
|
|
return |
|
|
return |
|
|