This commit is contained in:
邹宗楠
2022-09-30 17:16:22 +08:00
parent e2b41bf9db
commit 97c092cd26
36 changed files with 1753 additions and 1895 deletions

View File

@@ -2,6 +2,7 @@ package tiktok_store
import (
"fmt"
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
"strings"
"sync"
@@ -30,6 +31,11 @@ type PurchaseHandler struct {
locker sync.RWMutex
}
func (c *PurchaseHandler) GetOrderStatus(vendorOrgCode, vendorOrderID string) (status int, err error) {
//TODO implement me
panic("implement me")
}
func init() {
if api.MtwmAPI != nil || api.Mtwm2API != nil {
CurPurchaseHandler = New()
@@ -163,7 +169,7 @@ func bizStatusJX2Mtwm(status int) (openLevel, online int) {
return mtwmapi.PoiOpenLevelNormal, mtwmapi.PoiStatusOnline
}
func skuStatusJX2Mtwm(status int) int {
func skuStatusJX2Tiktok(status int) int {
if status == model.SkuStatusNormal {
return mtwmapi.SellStatusOnline
}
@@ -226,17 +232,14 @@ func (p *PurchaseHandler) getUploadImgPoiCode() (poiCode string) {
return poiCode
}
func GetAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *mtwmapi.API) {
if appOrgCode == "" {
globals.SugarLogger.Debugf("getAPI appOrgCode is empty")
}
apiObj = partner.CurAPIManager.GetAPI(model.VendorIDMTWM, appOrgCode).(*mtwmapi.API)
if appOrgCode == globals.Mtwm2Code {
func getAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *tiktok_api.API) {
apiObj = partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API)
if appOrgCode == globals.TiktokShopCode {
var storeDetail *dao.StoreDetail
if storeID != 0 {
storeDetail, _ = dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDMTWM, appOrgCode)
storeDetail, _ = dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDDD, appOrgCode)
} else if vendorStoreID != "" {
storeDetail, _ = dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreID, model.VendorIDMTWM, appOrgCode)
storeDetail, _ = dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreID, model.VendorIDDD, appOrgCode)
}
if storeDetail != nil {
apiObj.SetToken(storeDetail.MtwmToken)
@@ -245,28 +248,6 @@ func GetAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *mtwma
return apiObj
}
func getAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *mtwmapi.API) {
if appOrgCode == "" {
globals.SugarLogger.Debugf("getAPI appOrgCode is empty")
}
apiObj = partner.CurAPIManager.GetAPI(model.VendorIDMTWM, appOrgCode).(*mtwmapi.API)
if appOrgCode == globals.Mtwm2Code {
var storeDetail *dao.StoreDetail
if storeID != 0 {
storeDetail, _ = dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDMTWM, appOrgCode)
} else if vendorStoreID != "" {
storeDetail, _ = dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreID, model.VendorIDMTWM, appOrgCode)
}
if storeDetail != nil {
apiObj.SetToken(storeDetail.MtwmToken)
}
}
return apiObj
}
func getAPIWithoutToken(appOrgCode string) (apiObj *mtwmapi.API) {
if appOrgCode == "" {
globals.SugarLogger.Warnf("getAPI appOrgCode is empty")
}
return partner.CurAPIManager.GetAPI(model.VendorIDMTWM, appOrgCode).(*mtwmapi.API)
func getAPIWithoutToken(appOrgCode string) (apiObj *tiktok_api.API) {
return partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API)
}