1
This commit is contained in:
@@ -3,8 +3,10 @@ package controllers
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/common"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
"github.com/astaxie/beego/server/web"
|
||||
"time"
|
||||
@@ -17,7 +19,10 @@ type TiktokShopController struct {
|
||||
// TokenMsg 抖音用户授权
|
||||
func (c *TiktokShopController) TokenMsg() {
|
||||
code := c.Ctx.Request.URL.Query().Get("code")
|
||||
globals.SugarLogger.Debugf("==========%s", code)
|
||||
result, err := api.TiktokStore.CreateToken(code)
|
||||
globals.SugarLogger.Debugf("=result=========%s", utils.Format4Output(result, false))
|
||||
globals.SugarLogger.Debugf("=err1=========%s", err)
|
||||
if err != nil {
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
|
||||
c.ServeJSON()
|
||||
@@ -26,6 +31,8 @@ func (c *TiktokShopController) TokenMsg() {
|
||||
|
||||
result.ExpiresIn += time.Now().Unix()
|
||||
data, err := json.Marshal(result)
|
||||
globals.SugarLogger.Debugf("=err12=========%s", utils.Format4Output(data, false))
|
||||
globals.SugarLogger.Debugf("=data=========%s", err)
|
||||
if err != nil {
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
|
||||
c.ServeJSON()
|
||||
@@ -46,10 +53,12 @@ func (c *TiktokShopController) TokenMsg() {
|
||||
AppSecret: "", // web.AppConfig.DefaultString("tiktokShopAppSecret", "c397aa9f-3927-47c4-8cfe-4d84e02602e0")
|
||||
}
|
||||
if err := common.AddVendorOrgCode(nil, param); err != nil {
|
||||
globals.SugarLogger.Debugf("=err123=========%s", err)
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail}
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
globals.SugarLogger.Debugf("=4=========%s", err)
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess}
|
||||
c.ServeJSON()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user