Commit 6bc3863e authored by zhengyaoqiu's avatar zhengyaoqiu

feat(colorway): 价格适配器迁移

parent 46fba849
......@@ -19,6 +19,8 @@ type ChangeStream[T any] interface {
type Cache[T any] interface {
GetCacheDocuments() []T
StartCache(ctx context.Context) error
GetCacheOne(hitFunc func(document T) bool) (T, bool)
GetCacheMany(hitFunc func(document T) bool) []T
}
type Base[T any] struct {
......@@ -99,6 +101,25 @@ func (receiver *Base[T]) Filter(data ChangeStreamData) bson.M {
return bson.M{"_id": id}
}
func (receiver *Base[T]) GetCacheOne(hitFunc func(document T) bool) (T, bool) {
for _, d := range receiver.GetCacheDocuments() {
if hitFunc(d) {
return d, true
}
}
return *new(T), false
}
func (receiver *Base[T]) GetCacheMany(hitFunc func(document T) bool) []T {
var documents []T
for _, d := range receiver.GetCacheDocuments() {
if hitFunc(d) {
documents = append(documents, d)
}
}
return documents
}
type ChangeStreamData struct {
DocumentKey struct {
Id struct {
......
package model
import (
"git.chillcy.com/golang/colorway/internal/pkg/database/mongo/types"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
......@@ -57,6 +58,14 @@ type ProductCategory struct {
Children []ProductCategory `json:"children" bson:"children"`
}
func (receiver ProductCategory) GetIds() []string {
ids := []string{receiver.Id}
for _, child := range receiver.Children {
ids = append(ids, child.GetIds()...)
}
return ids
}
type ProductColor struct {
ColorCode string `bson:"colorCode"`
Id string `bson:"id"`
......@@ -71,14 +80,15 @@ type ProductColor struct {
type ProductColors []ProductColor
type ProductColorSku struct {
Pc3SkuId string `bson:"pc3SkuId"`
Pc3ProductId string `bson:"pc3ProductId"`
SourceId string `bson:"sourceId"`
SiteId string `bson:"siteId"`
Size string `bson:"size"`
Stock int `bson:"stock"`
Price float64 `bson:"price"`
Currency string `bson:"currency"`
Pc3SkuId string `bson:"pc3SkuId"`
Pc3ProductId string `bson:"pc3ProductId"`
SourceId string `bson:"sourceId"`
SiteId string `bson:"siteId"`
Size string `bson:"size"`
Stock int `bson:"stock"`
Price float64 `bson:"price"`
Currency string `bson:"currency"`
ProductColorSkuPlatformStoreSkus []ProductColorSkuPlatformStoreSkus `bson:"productColorSkuPlatformStoreSkus"`
}
type ProductColorSkus []ProductColorSku
......@@ -92,3 +102,33 @@ type ProductBrand struct {
Id string `bson:"id"`
Name string `bson:"name"`
}
type ProductColorSkuPlatformStoreSku struct {
Platform string `bson:"platform"` // 销售平台
Store string `bson:"store"` // 销售平台具体店铺
Qty int `bson:"qty"` // 库存
FixedQty *int `bson:"fixedQty,omitempty"` // 虚拟库存
Route string `bson:"route"` // 线路
Currency string `bson:"currency"` // 销售平台的币种
OriginCurrency string `bson:"originCurrency"` // 原始币种
Price float64 `bson:"price"` // 最终价格
FixPrice *float64 `bson:"fixPrice,omitempty"` // 固定价格
FixMargin *float64 `bson:"fixMargin,omitempty"` // 固定加价率(影响计价)
Rate float64 `bson:"rate"` // OriginCurrency -> Currency 的汇率
CnyRate float64 `bson:"cnyRate"` // Currency -> CNY 的汇率
Margin float64 `bson:"margin"` // 加价率
SubjectRate float64 `bson:"subjectRate"` // 专题系数
Subject *primitive.ObjectID `bson:"subject"` // 绑定的专题id
DiscountRate float64 `bson:"discountRate"` // 商家系数
TotalDiscount float64 `bson:"totalDiscount"` // 总折扣
TaxRate float64 `bson:"taxRate"` // 税率
Freight float64 `bson:"freight"` // 商家运费
Express float64 `bson:"express"` // 跨境费
ChangeRate *float64 `bson:"changeRate,omitempty"` // 价格变动率, 0.1表示涨价10%, -0.1表示降价10%
ChangeAt *time.Time `bson:"changeAt,omitempty"` // 价格变动时间,方便筛选
Memos types.Memos `bson:"memos,omitempty"` // 操作备注
// todo 有固定价格固定库存等操作就是有固定操作
IsFixed *bool `bson:"isFixed,omitempty"` // 是否有固定操作
}
type ProductColorSkuPlatformStoreSkus []ProductColorSkuPlatformStoreSku
......@@ -2,7 +2,7 @@ package model
import (
"git.chillcy.com/golang/chillcy/pkg/currency"
"git.chillcy.com/golang/colorway/internal/pkg/database/mongo/types"
"git.chillcy.com/golang/colorway/pkg/types"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
......@@ -21,7 +21,7 @@ type SitePlatformPriceConfig struct {
}
type RoutePriceConfig struct {
Route string `json:"route" bson:"route"` // 路线
Route types.Route `json:"route" bson:"route"` // 路线
Currency currency.Currency `json:"currency" bson:"currency"` // 结算币种
TaxRate float64 `json:"taxRate" bson:"taxRate"` // 税率
MarginConfig MarginConfig `json:"marginConfig" bson:"marginConfig"` // 加价率配置
......@@ -29,6 +29,38 @@ type RoutePriceConfig struct {
ExpressConfig ExpressConfig `json:"expressConfig" bson:"expressConfig"` // 跨境快递配置,默认是0
}
func (rc *RoutePriceConfig) IsValid() bool {
// 路线价格配置校验-加价率
if rc.MarginConfig.MarginStyle == MarginStyleFixed && (rc.MarginConfig.Margin <= 0 || rc.MarginConfig.Margin > 1) {
return false
}
if rc.MarginConfig.MarginStyle == MarginStyleLadder && len(rc.MarginConfig.Ladders) <= 0 {
return false
}
if rc.MarginConfig.MarginStyle == MarginStyleLadder {
if !rc.MarginConfig.IsValidLadders() {
return false
}
}
// 路线价格配置校验-运费
if rc.Route == types.RouteCC || rc.Route == types.RouteBC {
// toC线路必须有税率
if rc.TaxRate <= 0 {
return false
}
}
if rc.Route == types.RouteBB && (rc.FreightConfig.FreightStyle == FreightStyleCategory || rc.FreightConfig.FreightStyle == FreightStylePrice) {
// B2B线路不能按照分类计算运费, 也不能按照页面价格计算运费
return false
}
if rc.Route == types.RouteBB && rc.ExpressConfig.ExpressStyle == ExpressStyleCategory {
// B2B线路不能按照分类计算快递费
return false
}
return true
}
type ExpressConfig struct {
Express float64 `json:"express" bson:"express"` // 跨境快递费
ExpressStyle ExpressStyle `json:"expressStyle" bson:"expressStyle"` // 跨境快递费计算方式
......@@ -36,6 +68,9 @@ type ExpressConfig struct {
type ExpressStyle string
const ExpressStyleDefault = "default" // 默认计算方式
const ExpressStyleCategory = "category" // 按照分类计算方式
type FreightConfig struct {
Freight float64 `json:"freight" bson:"freight"` // 商家运费
FreightStyle FreightStyle `json:"freightStyle" bson:"freightStyle" ` // 商家运费计算方式
......@@ -45,14 +80,49 @@ type FreightConfig struct {
type FreightStyle string
const FreightStyleDefault FreightStyle = "default" // 默认运费计算方式(设置的运费)
const FreightStyleCategory FreightStyle = "category" // 根据分类计算
const FreightStylePrice FreightStyle = "price" // 根据页面价格计算
const FreightStyleMinPrice FreightStyle = "min_price" // 根据价格满多少免运费
type MarginConfig struct {
MarginStyle MarginStyle `json:"marginStyle" bson:"marginStyle"` // 加价方式
Margin float64 `json:"margin" bson:"margin"` // 加价率,加价方式为固定加价时使用
Ladders []Ladder `json:"ladders" bson:"ladders"` // 阶梯加价,加价方式为阶梯加价时使用
}
func (mc *MarginConfig) IsValidLadders() bool {
if mc.MarginStyle == MarginStyleLadder {
if len(mc.Ladders) <= 0 {
return false
}
for i, ladder := range mc.Ladders {
// 除了最后一个阶梯,其他阶梯的最大值必须设置值
if i < len(mc.Ladders)-1 && ladder.Max <= 0 {
return false
}
// 阶梯的最小值必须大于等于0
if ladder.Min < 0 {
return false
}
// 阶梯的最大值必须大于最小值
if ladder.Min >= ladder.Max {
return false
}
// 阶梯的加价率必须大于0小于等于1
if ladder.Margin <= 0 || ladder.Margin > 1 {
return false
}
}
}
return true
}
type MarginStyle string
const MarginStyleFixed MarginStyle = "fixed" // 默认加价方式,固定加价一个比例;值为0.1,即加价10%
const MarginStyleLadder MarginStyle = "ladder" // 阶梯加价
type Ladder struct {
Min float64 `json:"min" bson:"min"` // 最小值
Max float64 `json:"max" bson:"max"` // 最大值
......
package types
import "time"
type Operation string
type Memo struct {
Operator string `bson:"operator"`
Operation Operation `bson:"operation"`
Remark string `bson:"remark"`
CreateAt time.Time `bson:"createAt"`
}
type Memos []Memo
package types
import (
"git.chillcy.com/golang/colorway/pkg/platform"
"git.chillcy.com/golang/colorway/pkg/store"
)
type Seller struct {
Platform platform.Platform `json:"platform" bson:"platform"` // 销售平台
Store store.Store `json:"store" bson:"store"` // 销售平台具体店铺
}
package convert
import (
"errors"
"fmt"
"git.chillcy.com/golang/chillcy/pkg/sdk/pc3"
"git.chillcy.com/golang/colorway/internal/pkg/database/mongo"
productModel "git.chillcy.com/golang/colorway/internal/pkg/database/mongo/model/product"
sitePlatformPriceConfigModel "git.chillcy.com/golang/colorway/internal/pkg/database/mongo/model/site_platform_price_config"
"github.com/zeromicro/go-zero/core/logx"
"log"
"math"
"time"
)
type PlatformStoreSku struct {
mongoManager *mongo.Manager
}
func (receiver *PlatformStoreSku) Convert(p productModel.Product) productModel.ProductColorSkuPlatformStoreSkus {
var platformStoreSkus []productModel.ProductColorSkuPlatformStoreSkus
for _, color := range p.Colors {
for _, sku := range color.Skus {
sitePlatformPriceConfigs := receiver.mongoManager.SitePlatformPriceConfigModel.GetCacheMany(func(document sitePlatformPriceConfigproductModel.SitePlatformPriceConfig) bool {
return document.Site == sku.SiteId
})
categoryIds := p.Category.GetIds()
for _, sitePlatformPriceConfig := range sitePlatformPriceConfigs {
platformPriceDetail, err := r.calculatePlatformPrice(ctx, localSkuModel, pc3SkuModel, categories, priceConfig, svcProductModel)
if err != nil {
return nil, err
}
if platformPriceDetail != nil {
skuPriceList = append(skuPriceList, *platformPriceDetail)
}
}
}
}
err = r.dataRepo.BatchUpsertSkuPrice(ctx, skuPriceList)
if err != nil {
return nil, fmt.Errorf("BatchUpsertSkuPrice:%w", err)
}
}
func (receiver *PlatformStoreSku) calculatePlatformPrice(localSkuModel *productModel.Sku, pc3SkuModel pc3.ModelSku, categories []string, priceConfig sitePlatformPriceConfigModel.SitePlatformPriceConfig, svcProductModel *ProductModel) (productModel.ProductColorSkuPlatformStoreSku, error) {
var sku productModel.ProductColorSkuPlatformStoreSku
if !priceConfig.IsValid() {
return sku, fmt.Errorf("路线价格配置不合法")
}
sku, err := r.calculateRoutePrice(ctx, svcProductModel, localSkuModel, pc3SkuModel, categories, priceConfig.RoutePriceConfig, priceConfig.Seller)
if err != nil {
return sku, err
}
return sku, nil
}
func (receiver *PlatformStoreSku) calculateRoutePrice(svcProductModel *ProductModel, localSkuModel *model.Sku, pc3SkuModel pc3.ModelSku, categories []string, routeConfig embed.RoutePriceConfig, seller embed.Seller) (*model.SkuPrice, error) {
adapter, err := priceRouteAdapter.SelectAdapter(routeConfig.Route)
if err != nil {
return nil, err
}
rateKey := pc3SkuModel.PriceDetail.Currency + "_" + string(routeConfig.Currency)
currencyRate, err := r.rateConfig.GetRate(rateKey, seller.Platform)
if err != nil || currencyRate == 0 {
currencyRate, err = r.updateOrSetRate(rateKey, seller.Platform)
if err != nil {
return nil, errors.New("无法获取汇率信息")
}
}
oldSkuPriceRecord, err := r.dataRepo.GetOneSkuPrice(ctx, localSkuModel.Id, seller.Platform, seller.Store, routeConfig.Route)
if err != nil && !errors.Is(err, mongo.ErrNoDocuments) {
return nil, err
}
subjectRate, subjectId, err := r.getSubjectRateAndSubject(pc3SkuModel, svcProductModel, seller.Platform)
if err != nil {
return nil, err
}
// 固定毛利
margin := 1.0
if oldSkuPriceRecord != nil && oldSkuPriceRecord.FixMargin != nil && *oldSkuPriceRecord.FixMargin != 0 {
margin = 1 + (*oldSkuPriceRecord.FixMargin / 100)
} else {
margin, err = r.calculateMargin(routeConfig, svcProductModel, pc3SkuModel, seller)
if err != nil {
return nil, err
}
}
margin = math2.Round(math.Max(1.0, margin), 3) // 保底1.0
freight, err := r.calculateFreight(pc3SkuModel, categories, routeConfig.FreightConfig, seller.Platform)
if err != nil {
return nil, err
}
priceDetail := embed.RoutePriceDetail{
Route: routeConfig.Route,
Currency: string(routeConfig.Currency),
OriginCurrency: pc3SkuModel.PriceDetail.Currency,
Rate: currencyRate,
Margin: margin,
SubjectRate: subjectRate,
Subject: subjectId,
DiscountRate: pc3SkuModel.PriceDetail.Discount,
TotalDiscount: pc3SkuModel.PriceDetail.Discount * subjectRate,
TaxRate: 1 + routeConfig.TaxRate,
Freight: freight,
Express: r.calculateExpress(categories, routeConfig.ExpressConfig),
}
// 计算最终价格
priceDetail.Price, err = adapter.GetPrice(pc3SkuModel.PriceDetail.Now, priceDetail, platform.Platform(seller.Platform))
if err != nil {
return nil, err
}
rateKey = priceDetail.Currency + "_" + string(embed.CurrencyCNY)
cnyRate, err := r.rateConfig.GetRate(rateKey, seller.Platform)
if err != nil || cnyRate == 0 {
cnyRate, err = r.updateOrSetRate(rateKey, seller.Platform)
if err != nil {
log.Println(rateKey+"无法获取汇率信息:", err)
}
}
record := model.SkuPrice{
SkuId: localSkuModel.Id,
Mid: svcProductModel.Id,
Platform: seller.Platform,
Store: seller.Store,
Qty: localSkuModel.Quantity,
Route: priceDetail.Route,
Currency: priceDetail.Currency,
OriginCurrency: priceDetail.OriginCurrency,
Price: priceDetail.Price,
Rate: priceDetail.Rate,
CnyRate: cnyRate,
Margin: priceDetail.Margin,
SubjectRate: priceDetail.SubjectRate,
Subject: priceDetail.Subject,
DiscountRate: priceDetail.DiscountRate,
TotalDiscount: priceDetail.TotalDiscount,
TaxRate: priceDetail.TaxRate,
Freight: priceDetail.Freight,
Express: priceDetail.Express,
}
if oldSkuPriceRecord != nil {
now := time.Now()
change := math2.Round((priceDetail.Price-oldSkuPriceRecord.Price)/oldSkuPriceRecord.Price, 4)
record.Id = oldSkuPriceRecord.Id
record.FixedQty = oldSkuPriceRecord.FixedQty
if math.Abs(change) > 0.0001 {
record.ChangeRate = &change
record.ChangeAt = &now
}
}
return &record, nil
}
package priceRouteAdapter
import (
"git.chillcy.com/golang/chillcy/pkg/platform"
"git.chillcy.com/golang/colorway/pkg/types"
)
type IAdapter interface {
IsMatch(route types.Route) bool
GetPrice(now float64, config RoutePriceDetail, plt platform.Platform) (float64, error)
}
package priceRouteAdapter
import (
"fmt"
math2 "git.chillcy.com/golang/chillcy/pkg/math"
"git.chillcy.com/golang/chillcy/pkg/platform"
"git.chillcy.com/golang/colorway/pkg/types"
"github.com/zeromicro/go-zero/core/logx"
)
type B2BAdapter struct {
}
func NewB2BAdapter() *B2BAdapter {
return &B2BAdapter{}
}
func (c *B2BAdapter) IsMatch(route types.Route) bool {
return route == types.RouteBB || route == types.RouteComplex
}
func (c *B2BAdapter) GetPrice(now float64, config RoutePriceDetail, plt platform.Platform) (float64, error) {
//minValue := now*
// config.Rate*
// config.SubjectRate + config.Freight + config.Express
finalValue := (now*
config.Rate*
config.SubjectRate*
config.Margin + config.Freight + config.Express) * config.TaxRate
msg := fmt.Sprintf("b2bAdapter 平台:%v 计算价格: (PriceDetail.Now:%v * Rate:%v * SubjectRate:%v * Margin:%v + Freight:%v + Express:%v) * TaxRate:%v = %v",
plt,
now,
config.Rate,
config.SubjectRate,
config.Margin,
config.Freight,
config.Express,
config.TaxRate,
finalValue,
)
logx.Debug(msg)
return math2.Round(finalValue, 2), nil
}
package priceRouteAdapter
import (
"fmt"
math2 "git.chillcy.com/golang/chillcy/pkg/math"
"git.chillcy.com/golang/chillcy/pkg/platform"
"git.chillcy.com/golang/colorway/pkg/types"
"github.com/zeromicro/go-zero/core/logx"
"math"
)
type B2CAdapter struct {
}
func NewB2CAdapter() *B2CAdapter {
return &B2CAdapter{}
}
func (c *B2CAdapter) IsMatch(route types.Route) bool {
return route == types.RouteCC || route == types.RouteBC
}
func (c *B2CAdapter) GetPrice(now float64, config RoutePriceDetail, plt platform.Platform) (float64, error) {
//minValue := (now*
// config.Rate*
// config.SubjectRate*+config.Freight + config.Express) *
// config.TaxRate
finalValue := (now*
config.Rate*
config.SubjectRate*
config.Margin + config.Freight + config.Express) *
config.TaxRate
//finalValue = math.Max(minValue, finalValue)
// 天猫2c 推给天猫的价 = 固定汇率算的价 * 1.005 ( 如1000 则推给 天猫 1005)
if plt == platform.PlatformTmall2c {
finalValue = finalValue * 1.005
}
// 根据平台向上取整或者向上取9
finalValue = c.roundUpToNine(finalValue, plt)
msg := fmt.Sprintf("b2cAdapter 平台:%v 计算价格: (PriceDetail.Now:%v * Rate:%v * SubjectRate:%v * Margin:%v + Freight:%v + Express:%v) * TaxRate:%v = %v",
plt,
now,
config.Rate,
config.SubjectRate,
config.Margin,
config.Freight,
config.Express,
config.TaxRate,
finalValue,
)
logx.Debug(msg)
return math2.Round(finalValue, 2), nil
}
func (c *B2CAdapter) roundUpToNine(value float64, pf platform.Platform) float64 {
ceil := math.Ceil(value)
if pf != platform.PlatformMezzanine {
return ceil
}
if ceil > value && math.Mod(ceil, 10) != 9 {
ceil += 9 - math.Mod(ceil, 10)
}
return ceil
}
package priceRouteAdapter
import (
"git.chillcy.com/golang/colorway/pkg/types"
"github.com/pkg/errors"
)
func SelectAdapter(route types.Route) (IAdapter, error) {
allAdapter := []IAdapter{
NewB2CAdapter(),
NewB2BAdapter(),
}
for _, adapter := range allAdapter {
if adapter.IsMatch(route) {
return adapter, nil
}
}
return nil, errors.New("未支持的路线,无法计算价格")
}
package priceRouteAdapter
import "go.mongodb.org/mongo-driver/bson/primitive"
type RoutePriceDetail struct {
Route string `bson:"route"` // 线路
Currency string `bson:"currency"` // 销售平台的币种
OriginCurrency string `bson:"originCurrency"` // 原始币种
Price float64 `bson:"price"` // 最终价格
Rate float64 `bson:"rate"` // OriginCurrency -> Currency 的汇率
Margin float64 `bson:"margin"` // 加价率
SubjectRate float64 `bson:"subjectRate"` // 专题系数
Subject *primitive.ObjectID `bson:"subjectID"` // 绑定的专题id
DiscountRate float64 `bson:"discountRate"` // 商家系数
TotalDiscount float64 `bson:"totalDiscount"` // 总折扣
TaxRate float64 `bson:"taxRate"` // 税率
Freight float64 `bson:"freight"` // 商家运费
Express float64 `bson:"express"` // 跨境费
}
package model
//go:generate goctl model mysql
package platform
package types
type Platform string
const (
Mezzanine Platform = "mezzanine"
Tmall2b Platform = "tmall2b"
Taobao Platform = "taobao"
Poizon2b Platform = "poizon2b"
OldPoizon Platform = "oldpoizon"
Jd Platform = "jingdong"
Im2b Platform = "im2b"
Tmall2c Platform = "tmall"
B2B Platform = "b2b"
Open Platform = "open"
PlatformMezzanine Platform = "mezzanine"
PlatformTmall2b Platform = "tmall2b"
PlatformTaobao Platform = "taobao"
PlatformPoizon2b Platform = "poizon2b"
PlatformOldPoizon Platform = "oldpoizon"
PlatformJd Platform = "jingdong"
PlatformIm2b Platform = "im2b"
PlatformTmall2c Platform = "tmall"
PlatformB2B Platform = "b2b"
PlatformOpen Platform = "open"
)
func (p Platform) GetName() string {
switch p {
case Mezzanine:
case PlatformMezzanine:
return "迷衣"
case Tmall2b:
case PlatformTmall2b:
return "天猫ToB"
case Taobao:
case PlatformTaobao:
return "淘宝"
case Poizon2b:
case PlatformPoizon2b:
return "得物"
case OldPoizon:
case PlatformOldPoizon:
return "旧得物"
case Jd:
case PlatformJd:
return "京东"
case Im2b:
case PlatformIm2b:
return "ImToB"
case Tmall2c:
case PlatformTmall2c:
return "天猫"
case B2B:
case PlatformB2B:
return "B2B"
case Open:
case PlatformOpen:
return "开放平台"
}
return string(p)
......@@ -43,16 +43,16 @@ func (p Platform) GetName() string {
func GetAllPlatforms() []Platform {
return []Platform{
Mezzanine,
Tmall2b,
Taobao,
Poizon2b,
Jd,
Im2b,
Tmall2c,
B2B,
Open,
OldPoizon,
PlatformMezzanine,
PlatformTmall2b,
PlatformTaobao,
PlatformPoizon2b,
PlatformJd,
PlatformIm2b,
PlatformTmall2c,
PlatformB2B,
PlatformOpen,
PlatformOldPoizon,
}
}
......
package types
type Route string
const RouteBC Route = "BC" // BC路线
const RouteCC Route = "CC" // CC路线
const RouteBB Route = "B2B" // B2B路线
const RouteComplex = "Complex" // 复杂路线
package types
type Seller struct {
Platform Platform `json:"platform" bson:"platform"` // 销售平台
Store Store `json:"store" bson:"store"` // 销售平台具体店铺
}
package store
package types
type Store string
const (
MezzanineApp Store = "mezzanine_app"
MezzanineMiniApp Store = "mezzanine_mini_app"
Tmall2bHK Store = "tmall2b_hk"
Tmall2bUS Store = "tmall2b_us"
Tmall2bEUR Store = "tmall2b_eur"
StoreMezzanineApp Store = "mezzanine_app"
StoreMezzanineMiniApp Store = "mezzanine_mini_app"
StoreTmall2bHK Store = "tmall2b_hk"
StoreTmall2bUS Store = "tmall2b_us"
StoreTmall2bEUR Store = "tmall2b_eur"
Poizon2bStore1 Store = "mezzanine1"
Poizon2bStore2 Store = "mezzanine2"
StorePoizon2bStore1 Store = "mezzanine1"
StorePoizon2bStore2 Store = "mezzanine2"
JDStore2015 Store = "150558"
JDStore2017 Store = "208456"
JDStoreGongxiao Store = "208456gx"
JDStore2019 Store = "754589"
JDStore2024 Store = "13888912"
StoreJDStore2015 Store = "150558"
StoreJDStore2017 Store = "208456"
StoreJDStoreGongxiao Store = "208456gx"
StoreJDStore2019 Store = "754589"
StoreJDStore2024 Store = "13888912"
Im2b Store = "im2b"
StoreIm2b Store = "im2b"
Tmall2cStore1 Store = "mezzanine"
B2bStore1 Store = "alfamoda"
B2bStore2 Store = "alfa_mp"
StoreTmall2cStore1 Store = "mezzanine"
StoreB2bStore1 Store = "alfamoda"
StoreB2bStore2 Store = "alfa_mp"
TbStore1 Store = "taobao_store1"
TbStore2 Store = "taobao_store2"
TbStore3 Store = "taobao_store3"
TbStore4 Store = "taobao_store4"
TbStore5 Store = "taobao_store5"
TbStore6 Store = "taobao_store6"
TbStore7 Store = "taobao_store7"
TbStore8 Store = "taobao_store8"
TbStore9 Store = "taobao_store9"
StoreTbStore1 Store = "taobao_store1"
StoreTbStore2 Store = "taobao_store2"
StoreTbStore3 Store = "taobao_store3"
StoreTbStore4 Store = "taobao_store4"
StoreTbStore5 Store = "taobao_store5"
StoreTbStore6 Store = "taobao_store6"
StoreTbStore7 Store = "taobao_store7"
StoreTbStore8 Store = "taobao_store8"
StoreTbStore9 Store = "taobao_store9"
OpenStore1 Store = "open_store1"
StoreOpenStore1 Store = "open_store1"
OldPoizon1 Store = "oldpoizon1"
OldPoizon2 Store = "oldpoizon2"
StoreOldPoizon1 Store = "oldpoizon1"
StoreOldPoizon2 Store = "oldpoizon2"
)
func GetAllStores() []Store {
return []Store{
MezzanineApp,
Tmall2bHK,
Tmall2bUS,
Tmall2bEUR,
Poizon2bStore1,
Poizon2bStore2,
Im2b,
Tmall2cStore1,
JDStore2015,
JDStore2017,
JDStoreGongxiao,
JDStore2019,
JDStore2024,
B2bStore1,
B2bStore2,
TbStore1,
TbStore2,
TbStore3,
TbStore4,
TbStore5,
TbStore6,
TbStore7,
TbStore8,
TbStore9,
OpenStore1,
OldPoizon1,
OldPoizon2,
StoreMezzanineApp,
StoreTmall2bHK,
StoreTmall2bUS,
StoreTmall2bEUR,
StorePoizon2bStore1,
StorePoizon2bStore2,
StoreIm2b,
StoreTmall2cStore1,
StoreJDStore2015,
StoreJDStore2017,
StoreJDStoreGongxiao,
StoreJDStore2019,
StoreJDStore2024,
StoreB2bStore1,
StoreB2bStore2,
StoreTbStore1,
StoreTbStore2,
StoreTbStore3,
StoreTbStore4,
StoreTbStore5,
StoreTbStore6,
StoreTbStore7,
StoreTbStore8,
StoreTbStore9,
StoreOpenStore1,
StoreOldPoizon1,
StoreOldPoizon2,
}
}
func (store Store) GetStoreName() string {
switch store {
case MezzanineApp:
case StoreMezzanineApp:
return "迷衣App"
case MezzanineMiniApp:
case StoreMezzanineMiniApp:
return "迷衣小程序"
case Tmall2bHK:
case StoreTmall2bHK:
return "天猫ToB HK"
case Tmall2bUS:
case StoreTmall2bUS:
return "天猫ToB US"
case Tmall2bEUR:
case StoreTmall2bEUR:
return "天猫ToB EUR"
case Poizon2bStore1:
case StorePoizon2bStore1:
return "得物一店"
case Poizon2bStore2:
case StorePoizon2bStore2:
return "得物二店"
case Im2b:
case StoreIm2b:
return "ImToB"
case JDStore2015:
case StoreJDStore2015:
return "XIYANGHUI2015"
case JDStore2017:
case StoreJDStore2017:
return "XIYANGHUI2017"
case JDStoreGongxiao:
case StoreJDStoreGongxiao:
return "京东供销"
case JDStore2019:
case StoreJDStore2019:
return "XIYANGHUI2019"
case Tmall2cStore1:
case StoreTmall2cStore1:
return "迷衣时尚海外旗舰店"
case TbStore1:
case StoreTbStore1:
return "huzhijie1991"
case TbStore2:
case StoreTbStore2:
return "足尚潮鞋店"
case TbStore3:
case StoreTbStore3:
return "冰蕙儿"
case TbStore4:
case StoreTbStore4:
return "mezzanine"
case TbStore5:
case StoreTbStore5:
return "西洋汇"
case TbStore6:
case StoreTbStore6:
return "huangjiawei44"
case TbStore7:
case StoreTbStore7:
return "soulsoulsu"
case TbStore8:
case StoreTbStore8:
return "ys狼牙俱乐部"
case TbStore9:
case StoreTbStore9:
return "旧店铺"
case B2bStore1:
case StoreB2bStore1:
return "ALFAMODA"
case B2bStore2:
case StoreB2bStore2:
return "ALFA-MP"
case OpenStore1:
case StoreOpenStore1:
return "开放平台"
case OldPoizon1:
case StoreOldPoizon1:
return "旧得物一店"
case OldPoizon2:
case StoreOldPoizon2:
return "旧得物二店"
}
return string(store)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment