diff --git a/controllers/tiktok_store.go b/controllers/tiktok_store.go index df4a3c287..ff1cf7626 100644 --- a/controllers/tiktok_store.go +++ b/controllers/tiktok_store.go @@ -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))