Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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{
|
||||
|
||||
@@ -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"
|
||||
@@ -16,41 +18,60 @@ type TiktokShopController struct {
|
||||
|
||||
// TokenMsg 抖音用户授权
|
||||
func (c *TiktokShopController) TokenMsg() {
|
||||
code := c.Ctx.Request.URL.Query().Get("code")
|
||||
result, err := api.TiktokStore.CreateToken(code)
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
result.ExpiresIn += time.Now().Unix()
|
||||
data, err := json.Marshal(result)
|
||||
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
|
||||
}
|
||||
|
||||
param := &model.VendorOrgCode{
|
||||
VendorID: model.VendorIDDD,
|
||||
VendorOrgCode: 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
|
||||
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))
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
c.Data["json"] = tiktok_api.CallbackResponse{Code: tiktok_api.CallbackSuccessCode, Msg: tiktok_api.CallbackSuccess}
|
||||
c.ServeJSON()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user