From 1a408d61451ebbb6c99119791b854dae0f87b0ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 15:29:56 +0800 Subject: [PATCH 1/6] 1 --- business/partner/purchase/mtwm/store_sku2.go | 1 + 1 file changed, 1 insertion(+) diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index 7fb8edeef..f51a184da 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -335,6 +335,7 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI } } + globals.SugarLogger.Debugf("===========%s", utils.Format4Output(foodDataList, false)) if globals.EnableMtwmStoreWrite { if len(foodDataList) == 1 { foodDataList[0]["skus"] = string(utils.MustMarshal(foodDataList[0]["skus"])) From ae6f93f697e7b57ba3c9cd414111f75ced207a92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 15:47:43 +0800 Subject: [PATCH 2/6] 1 --- business/jxstore/cms/store.go | 1 - business/partner/purchase/mtwm/store_sku2.go | 1 - controllers/tiktok_store.go | 9 +++++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/store.go b/business/jxstore/cms/store.go index 5dc27b6d1..17cf50281 100644 --- a/business/jxstore/cms/store.go +++ b/business/jxstore/cms/store.go @@ -4322,7 +4322,6 @@ func CreateVendorStore(ctx *jxcontext.Context, storeID, vendorID int, payload ma if err != nil { return err } - fmt.Println("======", payload["pricePercentage"]) if vendorStoreID != "" && vendorStoreID != "0" { //AddStoreVendorMap 太复杂了并不满足,还是手动加吧 storeMap := &model.StoreMap{ diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index f51a184da..7fb8edeef 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -335,7 +335,6 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI } } - globals.SugarLogger.Debugf("===========%s", utils.Format4Output(foodDataList, false)) if globals.EnableMtwmStoreWrite { if len(foodDataList) == 1 { foodDataList[0]["skus"] = string(utils.MustMarshal(foodDataList[0]["skus"])) diff --git a/controllers/tiktok_store.go b/controllers/tiktok_store.go index 112c9c34b..900b73c9d 100644 --- a/controllers/tiktok_store.go +++ b/controllers/tiktok_store.go @@ -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() From 032fb6ad0e188a9c5c52bb1ab0a5a8376d7c7519 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 16:33:10 +0800 Subject: [PATCH 3/6] 1 --- controllers/tiktok_store.go | 1 + 1 file changed, 1 insertion(+) diff --git a/controllers/tiktok_store.go b/controllers/tiktok_store.go index 900b73c9d..53ab4bcd4 100644 --- a/controllers/tiktok_store.go +++ b/controllers/tiktok_store.go @@ -18,6 +18,7 @@ type TiktokShopController struct { // TokenMsg 抖音用户授权 func (c *TiktokShopController) TokenMsg() { + globals.SugarLogger.Debugf("codeParams = %s", utils.Format4Output(c.Ctx.Request.URL.Query(), false)) code := c.Ctx.Request.URL.Query().Get("code") globals.SugarLogger.Debugf("==========%s", code) result, err := api.TiktokStore.CreateToken(code) From 9c66cc7c155f3218c2a223af2c27abcf4f560716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 17:32:42 +0800 Subject: [PATCH 4/6] 1 --- business/jxcallback/scheduler/defsch/defsch.go | 14 +++++++------- controllers/tiktok_store.go | 11 ++++++++--- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/business/jxcallback/scheduler/defsch/defsch.go b/business/jxcallback/scheduler/defsch/defsch.go index 6205e22eb..8ea1ddbc2 100644 --- a/business/jxcallback/scheduler/defsch/defsch.go +++ b/business/jxcallback/scheduler/defsch/defsch.go @@ -1133,13 +1133,13 @@ func (s *DefScheduler) resetTimer(savedOrderInfo *WatchOrderInfo, bill *model.Wa if timeout == 0 { config.CallTimeoutAction(savedOrderInfo, bill) } else { - timerName := "" - if statusType == model.OrderTypeOrder { - timerName = model.OrderStatusName[status] - } else if statusType == model.OrderTypeWaybill { - timerName = model.WaybillStatusName[status] - } - globals.SugarLogger.Debugf("timerName %s", timerName) + //timerName := "" + //if statusType == model.OrderTypeOrder { + // timerName = model.OrderStatusName[status] + //} else if statusType == model.OrderTypeWaybill { + // timerName = model.WaybillStatusName[status] + //} + //globals.SugarLogger.Debugf("timerName %s", timerName) timerInfo := &tTimerInfo{ statusType: statusType, vendorID: vendorID, diff --git a/controllers/tiktok_store.go b/controllers/tiktok_store.go index 53ab4bcd4..97cb33371 100644 --- a/controllers/tiktok_store.go +++ b/controllers/tiktok_store.go @@ -18,8 +18,13 @@ type TiktokShopController struct { // TokenMsg 抖音用户授权 func (c *TiktokShopController) TokenMsg() { - globals.SugarLogger.Debugf("codeParams = %s", utils.Format4Output(c.Ctx.Request.URL.Query(), false)) - code := c.Ctx.Request.URL.Query().Get("code") + code := utils.Interface2StringList(c.Ctx.Request.URL.Query().Get("code"))[0] + if code == "" { + c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} + c.ServeJSON() + return + } + globals.SugarLogger.Debugf("==========%s", code) result, err := api.TiktokStore.CreateToken(code) globals.SugarLogger.Debugf("=result=========%s", utils.Format4Output(result, false)) @@ -42,7 +47,7 @@ func (c *TiktokShopController) TokenMsg() { param := &model.VendorOrgCode{ VendorID: model.VendorIDDD, - VendorOrgCode: result.ShopId, + VendorOrgCode: utils.Int64ToStr(result.ShopId), Comment: "抖音授权", VendorType: "platform", IsJxCat: 1, From d963fa8bf6cd6e38768f581a6e81273bcbc7777e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 17:39:06 +0800 Subject: [PATCH 5/6] 1' --- controllers/tiktok_store.go | 76 +++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/controllers/tiktok_store.go b/controllers/tiktok_store.go index 97cb33371..cba963662 100644 --- a/controllers/tiktok_store.go +++ b/controllers/tiktok_store.go @@ -18,54 +18,58 @@ type TiktokShopController struct { // TokenMsg 抖音用户授权 func (c *TiktokShopController) TokenMsg() { - code := utils.Interface2StringList(c.Ctx.Request.URL.Query().Get("code"))[0] - if code == "" { + codeList := c.Ctx.Request.URL.Query().Get("code") + var code []string + if err := json.Unmarshal([]byte(codeList), &code); err != nil { c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} c.ServeJSON() return } - 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 { + globals.SugarLogger.Debugf("codeList=====%s", utils.Format4Output(codeList, false)) + globals.SugarLogger.Debugf("code=====%s", utils.Format4Output(code, false)) + if len(code) == 0 { c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} c.ServeJSON() return } - 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() - return - } + for _, v := range code { + result, err := api.TiktokStore.CreateToken(v) + if err != nil { + c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} + c.ServeJSON() + return + } + globals.SugarLogger.Debugf("result=====%s", utils.Format4Output(result, false)) - param := &model.VendorOrgCode{ - VendorID: model.VendorIDDD, - VendorOrgCode: utils.Int64ToStr(result.ShopId), - Comment: "抖音授权", - VendorType: "platform", - IsJxCat: 1, - IsOpen: 1, - EmpowerURL: "", - StoreBrandName: result.ShopName, - Token: string(data), - AppKey: "", // web.AppConfig.DefaultString("tiktokShopAppId", "7136048270014416392"), - AppSecret: "", // web.AppConfig.DefaultString("tiktokShopAppSecret", "c397aa9f-3927-47c4-8cfe-4d84e02602e0") + result.ExpiresIn += time.Now().Unix() + data, err := json.Marshal(result) + if err != nil { + c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} + c.ServeJSON() + return + } + + param := &model.VendorOrgCode{ + VendorID: model.VendorIDDD, + VendorOrgCode: utils.Int64ToStr(result.ShopId), + Comment: "抖音授权", + VendorType: "platform", + IsJxCat: 1, + IsOpen: 1, + EmpowerURL: "", + StoreBrandName: result.ShopName, + Token: string(data), + AppKey: "", // web.AppConfig.DefaultString("tiktokShopAppId", "7136048270014416392"), + AppSecret: "", // web.AppConfig.DefaultString("tiktokShopAppSecret", "c397aa9f-3927-47c4-8cfe-4d84e02602e0") + } + if err := common.AddVendorOrgCode(nil, param); err != nil { + c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} + c.ServeJSON() + return + } } - 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() - } From ddd27fb327141c7d907518008c14f9a97adb6aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E5=AE=97=E6=A5=A0?= Date: Mon, 24 Oct 2022 17:47:00 +0800 Subject: [PATCH 6/6] 1 --- controllers/tiktok_store.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/tiktok_store.go b/controllers/tiktok_store.go index cba963662..8fca2e008 100644 --- a/controllers/tiktok_store.go +++ b/controllers/tiktok_store.go @@ -19,8 +19,10 @@ type TiktokShopController struct { // TokenMsg 抖音用户授权 func (c *TiktokShopController) TokenMsg() { codeList := c.Ctx.Request.URL.Query().Get("code") + globals.SugarLogger.Debugf("codeList=====%s", utils.Format4Output(codeList, false)) var code []string if err := json.Unmarshal([]byte(codeList), &code); err != nil { + globals.SugarLogger.Debugf("codeList=====err%s", utils.Format4Output(err, false)) c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackFailCode, Msg: tiktok_api.CallbackFail} c.ServeJSON() return