Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
colorway
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
golang
colorway
Commits
f8385223
Commit
f8385223
authored
Jul 02, 2025
by
zhengyaoqiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(colorway): 平台店铺枚举
parent
bc3d33f5
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
330 additions
and
22 deletions
+330
-22
generate.go
internal/pkg/database/mongo/generate.go
+2
-0
producttypes.go
internal/pkg/database/mongo/product/producttypes.go
+8
-10
error.go
...al/pkg/database/mongo/site_platform_price_config/error.go
+12
-0
site_platform_price_config_model.go
...platform_price_config/site_platform_price_config_model.go
+25
-0
site_platform_price_config_model_gen.go
...form_price_config/site_platform_price_config_model_gen.go
+23
-0
site_platform_price_config_types.go
...platform_price_config/site_platform_price_config_types.go
+22
-0
platform.go
internal/pkg/platform/platform.go
+66
-0
store.go
internal/pkg/store/store.go
+160
-0
dev.yaml
internal/rpc/etc/dev.yaml
+3
-1
product.go
internal/rpc/internal/svc/convert/product.go
+8
-10
servicecontext.go
internal/rpc/internal/svc/servicecontext.go
+1
-1
No files found.
internal/pkg/database/mongo/generate.go
View file @
f8385223
...
...
@@ -3,3 +3,5 @@ package mongo
//go:generate goctl template init --home ./templates
//go:generate goctl model mongo --type Product --dir product --home ./templates
//go:generate goctl model mongo --type SitePlatformPriceConfig --dir site_platform_price_config --home ./templates --style go_zero
internal/pkg/database/mongo/product/producttypes.go
View file @
f8385223
...
...
@@ -71,16 +71,14 @@ type ProductColor struct {
type
ProductColors
[]
ProductColor
type
ProductColorSku
struct
{
Pc3SkuId
string
`bson:"pc3SkuId"`
Pc3ProductId
string
`bson:"pc3ProductId"`
ColorSpuStyleNumber
string
`bson:"colorSpuStyleNumber"`
ColorSpuColorCode
string
`bson:"colorSpuColorCode"`
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"`
}
type
ProductColorSkus
[]
ProductColorSku
...
...
internal/pkg/database/mongo/site_platform_price_config/error.go
0 → 100644
View file @
f8385223
package
model
import
(
"errors"
"github.com/zeromicro/go-zero/core/stores/mon"
)
var
(
ErrNotFound
=
mon
.
ErrNotFound
ErrInvalidObjectId
=
errors
.
New
(
"invalid objectId"
)
)
internal/pkg/database/mongo/site_platform_price_config/site_platform_price_config_model.go
0 → 100644
View file @
f8385223
package
model
import
"github.com/zeromicro/go-zero/core/stores/mon"
var
_
SitePlatformPriceConfigModel
=
(
*
customSitePlatformPriceConfigModel
)(
nil
)
type
(
// SitePlatformPriceConfigModel is an interface to be customized, add more methods here,
// and implement the added methods in customSitePlatformPriceConfigModel.
SitePlatformPriceConfigModel
interface
{
sitePlatformPriceConfigModel
}
customSitePlatformPriceConfigModel
struct
{
*
defaultSitePlatformPriceConfigModel
}
)
// NewSitePlatformPriceConfigModel returns a model for the mongo.
func
NewSitePlatformPriceConfigModel
(
url
,
db
,
collection
string
)
SitePlatformPriceConfigModel
{
conn
:=
mon
.
MustNewModel
(
url
,
db
,
collection
)
return
&
customSitePlatformPriceConfigModel
{
defaultSitePlatformPriceConfigModel
:
newDefaultSitePlatformPriceConfigModel
(
conn
),
}
}
internal/pkg/database/mongo/site_platform_price_config/site_platform_price_config_model_gen.go
0 → 100644
View file @
f8385223
// Code generated by goctl. DO NOT EDIT.
package
model
import
(
model
"git.chillcy.com/golang/colorway/internal/pkg/database/mongo/base"
"github.com/zeromicro/go-zero/core/stores/mon"
)
type
sitePlatformPriceConfigModel
interface
{
model
.
Model
[
SitePlatformPriceConfig
]
}
type
defaultSitePlatformPriceConfigModel
struct
{
conn
*
mon
.
Model
model
.
Model
[
SitePlatformPriceConfig
]
}
func
newDefaultSitePlatformPriceConfigModel
(
conn
*
mon
.
Model
)
*
defaultSitePlatformPriceConfigModel
{
return
&
defaultSitePlatformPriceConfigModel
{
conn
:
conn
,
Model
:
model
.
NewBaseModel
[
SitePlatformPriceConfig
](
conn
),
}
}
internal/pkg/database/mongo/site_platform_price_config/site_platform_price_config_types.go
0 → 100644
View file @
f8385223
package
model
import
(
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type
SitePlatformPriceConfig
struct
{
ID
primitive
.
ObjectID
`bson:"_id,omitempty" json:"id,omitempty"`
Site
string
`json:"site" bson:"site"`
Seller
embed
.
Seller
`json:"seller" bson:"seller"`
// 销售平台
Enable
bool
`json:"enable" bson:"enable"`
// 是否启用
embed
.
RoutePriceConfig
`bson:",inline"`
// 路线价格配置
UpdateAt
time
.
Time
`bson:"updateAt,omitempty" json:"updateAt,omitempty"`
CreateAt
time
.
Time
`bson:"createAt,omitempty" json:"createAt,omitempty"`
}
type
Seller
struct
{
Platform
string
`json:"platform" bson:"platform"`
// 销售平台
Store
string
`json:"store" bson:"store"`
// 销售平台具体店铺
}
internal/pkg/platform/platform.go
0 → 100644
View file @
f8385223
package
platform
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"
)
func
(
p
Platform
)
GetName
()
string
{
switch
p
{
case
Mezzanine
:
return
"迷衣"
case
Tmall2b
:
return
"天猫ToB"
case
Taobao
:
return
"淘宝"
case
Poizon2b
:
return
"得物"
case
OldPoizon
:
return
"旧得物"
case
Jd
:
return
"京东"
case
Im2b
:
return
"ImToB"
case
Tmall2c
:
return
"天猫"
case
B2B
:
return
"B2B"
case
Open
:
return
"开放平台"
}
return
string
(
p
)
}
func
GetAllPlatforms
()
[]
Platform
{
return
[]
Platform
{
Mezzanine
,
Tmall2b
,
Taobao
,
Poizon2b
,
Jd
,
Im2b
,
Tmall2c
,
B2B
,
Open
,
OldPoizon
,
}
}
func
IsPlatform
(
s
string
)
bool
{
for
_
,
p
:=
range
GetAllPlatforms
()
{
if
string
(
p
)
==
s
{
return
true
}
}
return
false
}
internal/pkg/store/store.go
0 → 100644
View file @
f8385223
package
store
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"
Poizon2bStore1
Store
=
"mezzanine1"
Poizon2bStore2
Store
=
"mezzanine2"
JDStore2015
Store
=
"150558"
JDStore2017
Store
=
"208456"
JDStoreGongxiao
Store
=
"208456gx"
JDStore2019
Store
=
"754589"
JDStore2024
Store
=
"13888912"
Im2b
Store
=
"im2b"
Tmall2cStore1
Store
=
"mezzanine"
B2bStore1
Store
=
"alfamoda"
B2bStore2
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"
OpenStore1
Store
=
"open_store1"
OldPoizon1
Store
=
"oldpoizon1"
OldPoizon2
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
,
}
}
func
(
store
Store
)
GetStoreName
()
string
{
switch
store
{
case
MezzanineApp
:
return
"迷衣App"
case
MezzanineMiniApp
:
return
"迷衣小程序"
case
Tmall2bHK
:
return
"天猫ToB HK"
case
Tmall2bUS
:
return
"天猫ToB US"
case
Tmall2bEUR
:
return
"天猫ToB EUR"
case
Poizon2bStore1
:
return
"得物一店"
case
Poizon2bStore2
:
return
"得物二店"
case
Im2b
:
return
"ImToB"
case
JDStore2015
:
return
"XIYANGHUI2015"
case
JDStore2017
:
return
"XIYANGHUI2017"
case
JDStoreGongxiao
:
return
"京东供销"
case
JDStore2019
:
return
"XIYANGHUI2019"
case
Tmall2cStore1
:
return
"迷衣时尚海外旗舰店"
case
TbStore1
:
return
"huzhijie1991"
case
TbStore2
:
return
"足尚潮鞋店"
case
TbStore3
:
return
"冰蕙儿"
case
TbStore4
:
return
"mezzanine"
case
TbStore5
:
return
"西洋汇"
case
TbStore6
:
return
"huangjiawei44"
case
TbStore7
:
return
"soulsoulsu"
case
TbStore8
:
return
"ys狼牙俱乐部"
case
TbStore9
:
return
"旧店铺"
case
B2bStore1
:
return
"ALFAMODA"
case
B2bStore2
:
return
"ALFA-MP"
case
OpenStore1
:
return
"开放平台"
case
OldPoizon1
:
return
"旧得物一店"
case
OldPoizon2
:
return
"旧得物二店"
}
return
string
(
store
)
}
//func GetPlatformStores(platform Platform) []Store {
// switch platform {
// case PlatformMezzanine:
// return []Store{StoreMezzanineApp}
// case PlatformTmall2b:
// return []Store{StoreTmall2bHK, StoreTmall2bUS, StoreTmall2bEUR}
// case PlatformPoizon2b:
// return []Store{StorePoizon2bStore1, StorePoizon2bStore2}
// case PlatformIm2b:
// return []Store{StoreIm2b}
// case PlatformJd:
// return []Store{StoreJDStore2015, StoreJDStore2017, StoreJDStoreGongxiao, StoreJDStore2019, StoreJDStore2024}
// case PlatformTmall2c:
// return []Store{StoreTmall2cStore1}
// case PlatformB2B:
// return []Store{StoreB2bStore1, StoreB2bStore2}
// case PlatformTaobao:
// return []Store{StoreTbStore1, StoreTbStore2, StoreTbStore3, StoreTbStore4, StoreTbStore5,
// StoreTbStore6, StoreTbStore7, StoreTbStore8, StoreTbStore9}
// case PlatformOpen:
// return []Store{StoreOpenStore1}
// case PlatformOldPoizon:
// return []Store{StoreOldPoizon1, StoreOldPoizon2}
// }
// return nil
//}
internal/rpc/etc/dev.yaml
View file @
f8385223
Name
:
colorway.rpc
ListenOn
:
0.0.0.0:5200
Mode
:
dev
Timeout
:
30000
\ No newline at end of file
Timeout
:
30000
Log
:
Stat
:
false
\ No newline at end of file
internal/rpc/internal/svc/convert/product.go
View file @
f8385223
...
...
@@ -140,16 +140,14 @@ func buildProductColor(colorProduct *pc4.ColorProduct, styleNumber string, ws we
for
_
,
sku
:=
range
productAndSkus
.
GetSkus
()
{
pc
.
Skus
=
append
(
pc
.
Skus
,
model
.
ProductColorSku
{
Pc3SkuId
:
sku
.
GetId
(),
Pc3ProductId
:
product
.
GetId
(),
ColorSpuStyleNumber
:
styleNumber
,
ColorSpuColorCode
:
colorProduct
.
GetColorNumber
(),
SourceId
:
product
.
GetSourceId
(),
SiteId
:
product
.
GetSiteId
(),
Size
:
sku
.
GetRawSize
(),
Stock
:
int
(
sku
.
GetStock
()),
Price
:
sku
.
GetPriceDetail
()
.
GetNow
(),
Currency
:
sku
.
GetPriceDetail
()
.
GetCurrency
(),
Pc3SkuId
:
sku
.
GetId
(),
Pc3ProductId
:
product
.
GetId
(),
SourceId
:
product
.
GetSourceId
(),
SiteId
:
product
.
GetSiteId
(),
Size
:
sku
.
GetRawSize
(),
Stock
:
int
(
sku
.
GetStock
()),
Price
:
sku
.
GetPriceDetail
()
.
GetNow
(),
Currency
:
sku
.
GetPriceDetail
()
.
GetCurrency
(),
})
}
}
...
...
internal/rpc/internal/svc/servicecontext.go
View file @
f8385223
...
...
@@ -23,7 +23,7 @@ type ServiceContext struct {
func
NewServiceContext
(
c
config
.
Config
)
*
ServiceContext
{
etcd
.
Init
(
etcd
.
Env
(
c
.
Mode
))
pc4RpcProductServiceTarget
:=
etcd
.
Get
(
etcd
.
KeyRpcPc4
)
mongoManager
:=
mongo
.
NewManager
(
etcd
.
Get
(
etcd
.
KeyMongoP
latform
Uri
))
mongoManager
:=
mongo
.
NewManager
(
etcd
.
Get
(
etcd
.
KeyMongoP
roduct
Uri
))
if
etcd
.
GetEnv
()
==
etcd
.
EnvDev
{
pc4RpcProductServiceTarget
=
"127.0.0.1:5100"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment