添加自动创建分类
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user