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
5abdeeab
Commit
5abdeeab
authored
Jul 04, 2025
by
zhengyaoqiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(colorway): 代码调整
parent
e715f459
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
26 additions
and
17 deletions
+26
-17
site_group_margin_config_model_gen.go
...teGroupMarginConfig/site_group_margin_config_model_gen.go
+1
-1
brand_data_model_gen.go
...g/database/mongo/model/brand_data/brand_data_model_gen.go
+1
-1
site_combo_margin_config_model_gen.go
...combo_margin_config/site_combo_margin_config_model_gen.go
+1
-1
site_float_margin_config_model_gen.go
...float_margin_config/site_float_margin_config_model_gen.go
+1
-1
subject_model_gen.go
...nal/pkg/database/mongo/model/subject/subject_model_gen.go
+1
-1
model.tpl
internal/pkg/database/mongo/templates/mongo/model.tpl
+1
-1
brand_rank.go
internal/rpc/internal/svc/cache/brand_rank.go
+1
-1
cacahe.go
internal/rpc/internal/svc/cache/cacahe.go
+2
-2
platform_store_sku.go
internal/rpc/internal/svc/convert/platform_store_sku.go
+3
-3
product.go
internal/rpc/internal/svc/convert/product.go
+3
-3
rate.go
internal/rpc/internal/svc/rate/rate.go
+4
-0
servicecontext.go
internal/rpc/internal/svc/servicecontext.go
+5
-1
reflect.go
pkg/reflect/reflect.go
+2
-1
No files found.
internal/pkg/database/mongo/model/SiteGroupMarginConfig/site_group_margin_config_model_gen.go
View file @
5abdeeab
...
...
@@ -12,7 +12,7 @@ type siteGroupMarginConfigModel interface {
type
defaultSiteGroupMarginConfigModel
struct
{
conn
*
mon
.
Model
model
.
Base
[
SiteGroupMarginConfig
]
*
model
.
Base
[
SiteGroupMarginConfig
]
}
func
newDefaultSiteGroupMarginConfigModel
(
conn
*
mon
.
Model
)
*
defaultSiteGroupMarginConfigModel
{
...
...
internal/pkg/database/mongo/model/brand_data/brand_data_model_gen.go
View file @
5abdeeab
...
...
@@ -12,7 +12,7 @@ type brandDataModel interface {
type
defaultBrandDataModel
struct
{
conn
*
mon
.
Model
model
.
Base
[
BrandData
]
*
model
.
Base
[
BrandData
]
}
func
newDefaultBrandDataModel
(
conn
*
mon
.
Model
)
*
defaultBrandDataModel
{
...
...
internal/pkg/database/mongo/model/site_combo_margin_config/site_combo_margin_config_model_gen.go
View file @
5abdeeab
...
...
@@ -12,7 +12,7 @@ type siteComboMarginConfigModel interface {
type
defaultSiteComboMarginConfigModel
struct
{
conn
*
mon
.
Model
model
.
Base
[
SiteComboMarginConfig
]
*
model
.
Base
[
SiteComboMarginConfig
]
}
func
newDefaultSiteComboMarginConfigModel
(
conn
*
mon
.
Model
)
*
defaultSiteComboMarginConfigModel
{
...
...
internal/pkg/database/mongo/model/site_float_margin_config/site_float_margin_config_model_gen.go
View file @
5abdeeab
...
...
@@ -12,7 +12,7 @@ type siteFloatMarginConfigModel interface {
type
defaultSiteFloatMarginConfigModel
struct
{
conn
*
mon
.
Model
model
.
Base
[
SiteFloatMarginConfig
]
*
model
.
Base
[
SiteFloatMarginConfig
]
}
func
newDefaultSiteFloatMarginConfigModel
(
conn
*
mon
.
Model
)
*
defaultSiteFloatMarginConfigModel
{
...
...
internal/pkg/database/mongo/model/subject/subject_model_gen.go
View file @
5abdeeab
...
...
@@ -12,7 +12,7 @@ type subjectModel interface {
type
defaultSubjectModel
struct
{
conn
*
mon
.
Model
model
.
Base
[
Subject
]
*
model
.
Base
[
Subject
]
}
func
newDefaultSubjectModel
(
conn
*
mon
.
Model
)
*
defaultSubjectModel
{
...
...
internal/pkg/database/mongo/templates/mongo/model.tpl
View file @
5abdeeab
...
...
@@ -14,7 +14,7 @@ type {{.lowerType}}Model interface{
type default{{.Type}}Model struct {
conn {
{
if
.
Cache
}
}*monc.Model{
{
else
}
}*mon.Model{
{
end
}
}
model.Base[{{.Type}}]
*
model.Base[{{.Type}}]
}
func newDefault{{.Type}}Model(conn {
{
if
.
Cache
}
}*monc.Model{
{
else
}
}*mon.Model{
{
end
}
}) *default{{.Type}}Model {
...
...
internal/rpc/internal/svc/cache/brand_rank.go
View file @
5abdeeab
...
...
@@ -16,7 +16,7 @@ type BrandRank struct {
middleBrands
[]
string
}
func
NewBrand
Data
(
brandDataModel
model
.
BrandDataModel
)
*
BrandRank
{
func
NewBrand
Rank
(
brandDataModel
model
.
BrandDataModel
)
*
BrandRank
{
return
&
BrandRank
{
brandDataModel
:
brandDataModel
,
rwMutex
:
new
(
sync
.
RWMutex
)}
}
...
...
internal/rpc/internal/svc/cache/cacahe.go
View file @
5abdeeab
...
...
@@ -20,12 +20,12 @@ type Cache struct {
func
InitCache
(
config
Config
)
{
s
:=
NewSource
(
config
.
Source
)
b
d
:=
NewBrandData
(
config
.
BrandDataModel
)
b
r
:=
NewBrandRank
(
config
.
BrandDataModel
)
// 注册缓存刷新 Map
_cache
=
&
Cache
{
refreshMap
:
map
[
RefreshKey
]
Refresh
{
RefreshKeySource
:
s
,
RefreshKeyRankBrandIds
:
b
d
,
RefreshKeyRankBrandIds
:
b
r
,
},
Source
:
s
,
}
...
...
internal/rpc/internal/svc/convert/platform_store_sku.go
View file @
5abdeeab
...
...
@@ -29,11 +29,11 @@ import (
type
PlatformStoreSku
struct
{
mongoManager
*
mongo
.
Manager
rate
rate
.
Rate
brandRankCache
cache
.
BrandRank
rate
*
rate
.
Rate
brandRankCache
*
cache
.
BrandRank
}
func
NewPlatformStoreSku
(
mongoManager
*
mongo
.
Manager
,
rate
rate
.
Rate
,
brandRankCache
cache
.
BrandRank
)
*
PlatformStoreSku
{
func
NewPlatformStoreSku
(
mongoManager
*
mongo
.
Manager
,
rate
*
rate
.
Rate
,
brandRankCache
*
cache
.
BrandRank
)
*
PlatformStoreSku
{
return
&
PlatformStoreSku
{
mongoManager
:
mongoManager
,
rate
:
rate
,
brandRankCache
:
brandRankCache
}
}
...
...
internal/rpc/internal/svc/convert/product.go
View file @
5abdeeab
...
...
@@ -18,11 +18,11 @@ import (
type
Product
struct
{
cache
*
cache
.
Cache
mongoManager
*
mongo
.
Manager
rate
rate
.
Rate
brandRankCache
cache
.
BrandRank
rate
*
rate
.
Rate
brandRankCache
*
cache
.
BrandRank
}
func
NewProduct
(
cache
*
cache
.
Cache
,
mongoManager
*
mongo
.
Manager
,
rate
rate
.
Rate
,
brandRankCache
cache
.
BrandRank
)
*
Product
{
func
NewProduct
(
cache
*
cache
.
Cache
,
mongoManager
*
mongo
.
Manager
,
rate
*
rate
.
Rate
,
brandRankCache
*
cache
.
BrandRank
)
*
Product
{
return
&
Product
{
cache
:
cache
,
mongoManager
:
mongoManager
,
rate
:
rate
,
brandRankCache
:
brandRankCache
}
}
...
...
internal/rpc/internal/svc/rate/rate.go
View file @
5abdeeab
...
...
@@ -10,6 +10,10 @@ type Rate struct {
rateClient
*
rate
.
Client
}
func
NewRate
(
rateClient
*
rate
.
Client
)
*
Rate
{
return
&
Rate
{
rateClient
:
rateClient
}
}
func
(
receiver
*
Rate
)
GetRate
(
store
types
.
Store
,
from
,
to
string
)
(
float64
,
error
)
{
switch
store
{
case
types
.
StoreTmall2cStore1
,
types
.
StoreJDStoreGongxiao
:
...
...
internal/rpc/internal/svc/servicecontext.go
View file @
5abdeeab
...
...
@@ -2,12 +2,14 @@ package svc
import
(
"git.chillcy.com/golang/chillcy/pkg/etcd"
rate2
"git.chillcy.com/golang/chillcy/pkg/sdk/rate"
"git.chillcy.com/golang/chillcy/project/pc4/pkg/rpc/client/product"
"git.chillcy.com/golang/chillcy/project/pc4/pkg/rpc/client/source"
"git.chillcy.com/golang/colorway/internal/pkg/database/mongo"
"git.chillcy.com/golang/colorway/internal/rpc/internal/config"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc/cache"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc/convert"
"git.chillcy.com/golang/colorway/internal/rpc/internal/svc/rate"
"github.com/zeromicro/go-zero/zrpc"
)
...
...
@@ -45,7 +47,9 @@ func NewServiceContext(c config.Config) *ServiceContext {
})
svc
.
Cache
=
cache
.
GetCache
()
svc
.
SpuConvert
=
convert
.
NewSpu
(
svc
.
Cache
)
svc
.
ProductConvert
=
convert
.
NewProduct
(
svc
.
Cache
)
rateClient
:=
rate2
.
NewClient
(
etcd
.
Get
(
etcd
.
KeyHttpRateApiUri
))
brandRank
:=
cache
.
NewBrandRank
(
svc
.
MongoManager
.
BrandDataModel
)
svc
.
ProductConvert
=
convert
.
NewProduct
(
svc
.
Cache
,
svc
.
MongoManager
,
rate
.
NewRate
(
rateClient
),
brandRank
)
return
svc
}
...
...
pkg/reflect/reflect.go
View file @
5abdeeab
...
...
@@ -20,7 +20,8 @@ func MemberMethodCall(obj any, methodName string, in []reflect.Value) error {
// 检查是否有 methodName 方法
method
:=
field
.
MethodByName
(
methodName
)
if
!
method
.
IsValid
()
{
return
fmt
.
Errorf
(
"字段 %s 没有 %s 方法
\n
"
,
fieldType
.
Name
,
methodName
)
//log.Println(fmt.Errorf("字段 %s 没有 %s 方法\n", fieldType.Name, methodName))
return
nil
}
// 调用 methodName 方法
...
...
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