This commit is contained in:
邹宗楠
2022-10-24 21:24:35 +08:00
parent 13cd51ef84
commit 79a7157390

View File

@@ -56,6 +56,17 @@ func PKCS5UnPadding(origData []byte) []byte {
return origData[:(length - unfilledNum)]
}
type Code struct {
MsgType int64 `json:"msg_type"`
msg struct {
ActionType int64 `json:"action_type"`
AppId int64 `json:"app_id"`
ShopId int64 `json:"shop_id"`
Code string `json:"code"`
CodeGenerateTime string `json:"code_generate_time"`
}
}
func (c *TiktokShopController) TokenMsg() {
req := c.Ctx.Request
var code []string
@@ -77,11 +88,16 @@ func (c *TiktokShopController) TokenMsg() {
case http.MethodGet:
codeValues := req.URL.Query()
codeList := codeValues.Get("code")
if err := json.Unmarshal([]byte(string(codeList)), &code); err != nil {
codeResult := make([]Code, 0, 0)
if err := json.Unmarshal([]byte(string(codeList)), &codeResult); err != nil {
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
c.ServeJSON()
return
}
for _, v := range codeResult {
code = append(code, v.msg.Code)
}
}
globals.SugarLogger.Debugf("code ==================%s", utils.Format4Output(code, false))