添加自动创建分类
This commit is contained in:
@@ -166,6 +166,8 @@ type IPurchasePlatformStoreSkuHandler interface {
|
||||
CreateStoreSkusAct(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (failedList []*StoreSkuInfoWithErr, err error)
|
||||
CancelActs(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (failedList []*StoreSkuInfoWithErr, err error)
|
||||
UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*StoreSkuInfo) (err error)
|
||||
// GetSkuCategoryIdByName 获取各个平台推荐分类
|
||||
GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error)
|
||||
}
|
||||
|
||||
type ISingleStoreStoreSkuHandler interface {
|
||||
|
||||
@@ -714,3 +714,7 @@ func (p *PurchaseHandler) CancelActs(ctx *jxcontext.Context, vendorOrgCode strin
|
||||
func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string, storeSkuList []*partner.StoreSkuInfo) (err error) {
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -23,3 +23,7 @@ func (p *PurchaseHandler) RefreshAllStoresID(ctx *jxcontext.Context, parentTask
|
||||
func (p *PurchaseHandler) GetStoreStatus(ctx *jxcontext.Context, vendorOrgCode string, storeID int, vendorStoreID string) (storeStatus int, err error) {
|
||||
return storeStatus, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -285,6 +285,19 @@ func (p *PurchaseHandler) GetSkus(ctx *jxcontext.Context, vendorOrgCode string,
|
||||
return skuNameList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
vendorCategory, err := getAPI(vendorOrgCode).GetSkuCategoryBySkuName(skuName)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
if vendorCategory == nil {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
return utils.Int2Str(vendorCategory.CategoryId), nil
|
||||
}
|
||||
|
||||
func setSkuNameListPic(vendorOrgCode string, skuNameList []*partner.SkuNameInfo) []*partner.SkuNameInfo {
|
||||
jdSkuIDs := make([]int64, len(skuNameList))
|
||||
for k, v := range skuNameList {
|
||||
|
||||
@@ -1299,3 +1299,7 @@ func buildUpdateSkusParam(storeSku *dao.StoreSkuSyncInfo, v *dao.StoreSkuSyncInf
|
||||
updateSkusParam.Skus = skus
|
||||
return updateSkusParam, wareSku, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -80,3 +80,7 @@ func (p *PurchaseHandler) GetVendorCategories(ctx *jxcontext.Context) (vendorCat
|
||||
func (p *PurchaseHandler) GetSkus(ctx *jxcontext.Context, vendorOrgCode string, skuID int, vendorSkuID string) (skuNameList []*partner.SkuNameInfo, err error) {
|
||||
return skuNameList, err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -764,3 +764,7 @@ func (p *PurchaseHandler) UpdateStoreSkusSpecTag(ctx *jxcontext.Context, vendorO
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -3,12 +3,9 @@ package tiktok_store
|
||||
import (
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/tiktok_shop/tiktok_api"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"git.rosy.net.cn/baseapi/platformapi/mtwmapi"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
@@ -84,61 +81,6 @@ func skuCategory(param1 []*tiktok_api.RetailCategoryInfo) (vendorCats []*model.S
|
||||
return
|
||||
}
|
||||
|
||||
func rangeMtwm2JX(areaStr string) string {
|
||||
var area []interface{}
|
||||
if err := utils.UnmarshalUseNumber([]byte(areaStr), &area); err == nil {
|
||||
if len(area) > 0 {
|
||||
coordList := make([]string, len(area))
|
||||
for k, v := range area {
|
||||
vv := v.(map[string]interface{})
|
||||
coordList[k] = fmt.Sprintf("%.6f,%.6f", jxutils.IntCoordinate2Standard(int(utils.ForceInterface2Int64(vv["x"]))), jxutils.IntCoordinate2Standard(int(utils.ForceInterface2Int64(vv["y"]))))
|
||||
}
|
||||
return strings.Join(coordList, ";")
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func rangeJX2Mtwm(coords string) string {
|
||||
pairs := strings.Split(strings.Trim(coords, ";"), ";")
|
||||
if len(pairs) > 0 {
|
||||
coordList := make([]map[string]interface{}, len(pairs))
|
||||
for k, v := range pairs {
|
||||
pair := strings.Split(v, ",")
|
||||
coordList[k] = map[string]interface{}{
|
||||
"x": jxutils.StandardCoordinate2Int(utils.Str2Float64(pair[0])),
|
||||
"y": jxutils.StandardCoordinate2Int(utils.Str2Float64(pair[1])),
|
||||
}
|
||||
}
|
||||
return string(utils.MustMarshal(coordList))
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func openTimeMtwm2JX(vendorOpenTime string) (opTimeList []int16) {
|
||||
timePairs := strings.Split(vendorOpenTime, ",")
|
||||
for _, v := range timePairs {
|
||||
times := strings.Split(v, "-")
|
||||
if len(times) >= 2 {
|
||||
opTimeList = append(opTimeList, jxutils.StrTime2JxOperationTime(times[0]+":00", 700), jxutils.StrTime2JxOperationTime(times[1]+":00", 2000))
|
||||
}
|
||||
}
|
||||
return opTimeList
|
||||
}
|
||||
|
||||
func openTimeJX2Mtwm(opTimeList []int16) string {
|
||||
timesLen := len(opTimeList) / 2 * 2
|
||||
var strPairs []string
|
||||
for i := 0; i < timesLen; i += 2 {
|
||||
if opTimeList[i] != 0 {
|
||||
strPairs = append(strPairs, jxutils.JxOperationTime2StrTime(opTimeList[i])+"-"+jxutils.JxOperationTime2StrTime(opTimeList[i+1]))
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
return strings.Join(strPairs, ",")
|
||||
}
|
||||
|
||||
func bizStatusTiktok2JX(status int64) int {
|
||||
switch status {
|
||||
case tiktok_api.StoreStateNormalBusiness:
|
||||
@@ -149,22 +91,6 @@ func bizStatusTiktok2JX(status int64) int {
|
||||
return model.StoreStatusDisabled
|
||||
}
|
||||
|
||||
func bizStatusJX2Mtwm(status int) (openLevel, online int) {
|
||||
if status == model.StoreStatusDisabled {
|
||||
return mtwmapi.PoiOpenLevelHaveRest, mtwmapi.PoiStatusOnline //mtwmapi.PoiStatusOffline
|
||||
} else if status == model.StoreStatusHaveRest || status == model.StoreStatusClosed {
|
||||
return mtwmapi.PoiOpenLevelHaveRest, mtwmapi.PoiStatusOnline
|
||||
}
|
||||
return mtwmapi.PoiOpenLevelNormal, mtwmapi.PoiStatusOnline
|
||||
}
|
||||
|
||||
func skuStatusJX2Tiktok(status int) int {
|
||||
if status == model.SkuStatusNormal {
|
||||
return mtwmapi.SellStatusOnline
|
||||
}
|
||||
return mtwmapi.SellStatusOffline
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) UploadImg(ctx *jxcontext.Context, vendorOrgCode, imgURL string, imgData []byte, imgName string, imgType int) (imgHint string, err error) {
|
||||
poiCode4UploadImg := p.getUploadImgPoiCode()
|
||||
if poiCode4UploadImg == "" {
|
||||
@@ -227,7 +153,3 @@ func getAPI(appOrgCode string, storeID int, vendorStoreID string) (apiObj *tikto
|
||||
func GetTiktokApi(appOrgCode string, storeID int, vendorStoreID string) *tiktok_api.API {
|
||||
return getAPI(appOrgCode, storeID, vendorStoreID)
|
||||
}
|
||||
|
||||
func getAPIWithoutToken(appOrgCode string) (apiObj *tiktok_api.API) {
|
||||
return partner.CurAPIManager.GetAPI(model.VendorIDDD, appOrgCode).(*tiktok_api.API)
|
||||
}
|
||||
|
||||
@@ -336,3 +336,8 @@ func GetProductAuditList(vendorOrgCode string, page, pageSize int64) (map[string
|
||||
}
|
||||
return updateCategory, total
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (string, error) {
|
||||
vendorCategoryId, err := getAPI(vendorOrgCode, 0, "").GetRecommendCategory(strings.Split(skuName, "|"))
|
||||
return utils.Int64ToStr(vendorCategoryId), err
|
||||
}
|
||||
|
||||
@@ -201,3 +201,6 @@ func (p *PurchaseHandler) GetStoreSkusInfo(ctx *jxcontext.Context, parentTask ta
|
||||
func composeFakeDelName(name string) string {
|
||||
return "del_" + name
|
||||
}
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -398,6 +398,9 @@ func (p *PurchaseHandler) IsErrSkuNotExist(err error) (isNotExist bool) {
|
||||
return yinbaoapi.IsErrSkuNotExist(err)
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) GetSkuCategoryIdByName(vendorOrgCode, skuName string) (vendorCategoryId string, err error) {
|
||||
return "", err
|
||||
}
|
||||
func ybSkuStatus2Jx(ybStatus int) (jxSkuStatus int) {
|
||||
if ybStatus == yinbaoapi.SkuStatusEnable {
|
||||
jxSkuStatus = model.SkuStatusNormal
|
||||
|
||||
Reference in New Issue
Block a user