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
dd22f0a4
Commit
dd22f0a4
authored
Jul 07, 2025
by
zhengyaoqiu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(colorway): 入库脚本
parent
17fe7a73
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
12 deletions
+76
-12
go.mod
go.mod
+3
-3
go.sum
go.sum
+8
-7
product.go
internal/rpc/internal/svc/convert/product.go
+1
-1
servicecontext.go
internal/rpc/internal/svc/servicecontext.go
+0
-1
main.go
internal/script/consumer/product/main.go
+64
-0
No files found.
go.mod
View file @
dd22f0a4
...
...
@@ -3,9 +3,10 @@ module git.chillcy.com/golang/colorway
go 1.24.3
require (
git.chillcy.com/golang/chillcy/pkg v0.0.0-2025070
3141544-f63c5883c3d1
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250
630145511-385ed232051f
git.chillcy.com/golang/chillcy/pkg v0.0.0-2025070
4075210-a180c8cdfef5
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250
707084717-6601c75ef066
github.com/pkg/errors v0.9.1
github.com/streadway/amqp v1.1.0
github.com/zeromicro/go-zero v1.8.4
go.mongodb.org/mongo-driver v1.17.4
go.uber.org/multierr v1.11.0
...
...
@@ -38,7 +39,6 @@ require (
github.com/golang/snappy v0.0.4 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/grafana/pyroscope-go v1.2.2 // indirect
...
...
go.sum
View file @
dd22f0a4
filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250703141544-f63c5883c3d1 h1:YKPXnj98Z+pQms4d9JetiHRgA4OmX9ksOBspauGXsPU=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250703141544-f63c5883c3d1/go.mod h1:1N8ux+rPaW+/OT74EGSz2oX51NvsEK3H4nlBZ+5Xx0M=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250630145511-385ed232051f h1:08l02ihb9QCINdg2o202kclqEQK4gaqxYo0H7kz6/p8=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250630145511-385ed232051f/go.mod h1:+oGrruo/MyXkrh5VPjDu/jvHN7tZGNkdZiKMJ/gIi4c=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250704075210-a180c8cdfef5 h1:BXcSMhabCN0YmFrncmEp9j5+U1Bv50qUe+XqIcDhMWk=
git.chillcy.com/golang/chillcy/pkg v0.0.0-20250704075210-a180c8cdfef5/go.mod h1:1N8ux+rPaW+/OT74EGSz2oX51NvsEK3H4nlBZ+5Xx0M=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250707083628-17d19d7e3e2b h1:7sdqbgi4SYI9HcbFFPmPcCwQh889SnQ/1jQ/xIY7D1k=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250707083628-17d19d7e3e2b/go.mod h1:RLAM/O19UhMYxV12QHge8AqRWwYPwF4YbiZj9HjjNGo=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250707084717-6601c75ef066 h1:f4tvEFxNKs0TWM4IpKdci3PAyTNEcdrotgndVVqiFWI=
git.chillcy.com/golang/chillcy/project/pc4 v0.0.0-20250707084717-6601c75ef066/go.mod h1:RLAM/O19UhMYxV12QHge8AqRWwYPwF4YbiZj9HjjNGo=
github.com/alicebob/miniredis/v2 v2.35.0 h1:QwLphYqCEAo1eu1TqPRN2jgVMPBweeQcR21jeqDCONI=
github.com/alicebob/miniredis/v2 v2.35.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM=
github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
...
...
@@ -61,12 +63,9 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I=
github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
...
...
@@ -152,6 +151,8 @@ github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0b
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/streadway/amqp v1.1.0 h1:py12iX8XSyI7aN/3dUT8DFIDJazNJsVJdxNVEpnQTZM=
github.com/streadway/amqp v1.1.0/go.mod h1:WYSrTEYHOXHd0nwFeUXAe2G2hRnQT+deZJJf88uS9Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
...
...
internal/rpc/internal/svc/convert/product.go
View file @
dd22f0a4
...
...
@@ -177,7 +177,7 @@ func buildProductColor(colorProduct *pc4.ColorProduct, ws weightSelect, oldProdu
Stock
:
int
(
sku
.
GetStock
()),
Price
:
sku
.
GetPriceDetail
()
.
GetNow
(),
Currency
:
sku
.
GetPriceDetail
()
.
GetCurrency
(),
SubjectIds
:
product
.
Subjects
,
SubjectIds
:
product
.
GetSubjects
()
,
}
psSkus
,
err
:=
platformStoreSkuConvert
.
Convert
(
product
,
sku
,
oldProductPointer
)
if
err
!=
nil
{
...
...
internal/rpc/internal/svc/servicecontext.go
View file @
dd22f0a4
...
...
@@ -31,7 +31,6 @@ func NewServiceContext(c config.Config) *ServiceContext {
panic
(
err
)
}
if
etcd
.
GetEnv
()
==
etcd
.
EnvDev
{
pc4RpcProductServiceTarget
=
"127.0.0.1:5100"
etcd
.
SetEtcd
(
etcd
.
KeyHttpRateApiUri
.
String
(),
"http://127.0.0.1:6060"
)
}
svc
:=
&
ServiceContext
{
...
...
internal/script/consumer/product/main.go
0 → 100644
View file @
dd22f0a4
package
main
import
(
"context"
"encoding/json"
"flag"
"git.chillcy.com/golang/chillcy/pkg/etcd"
"git.chillcy.com/golang/chillcy/pkg/rabbitmq"
"git.chillcy.com/golang/chillcy/project/pc4/pkg/message"
"git.chillcy.com/golang/colorway/internal/pkg/database/mongo"
"git.chillcy.com/golang/colorway/internal/rpc/client/product"
"github.com/streadway/amqp"
"github.com/zeromicro/go-zero/zrpc"
"log"
)
var
_env
=
flag
.
String
(
"env"
,
"dev"
,
"环境配置"
)
var
_databaseManager
*
mongo
.
Manager
var
_consumer
*
rabbitmq
.
Consumer
var
_productService
product
.
Product
func
init
()
{
flag
.
Parse
()
etcd
.
Init
(
etcd
.
Env
(
*
_env
))
_databaseManager
=
mongo
.
NewManager
(
etcd
.
Get
(
etcd
.
KeyMongoProductUri
))
_consumer
=
rabbitmq
.
NewRabbitmqConsumer
(
rabbitmq
.
Option
{
RabbitMqUri
:
etcd
.
Get
(
etcd
.
KeyRabbitMQClusterNode01Uri
),
QueueName
:
"product.info.events.sync"
,
ConsumerTag
:
"product"
,
ExchangeName
:
message
.
ProductInfoExchange
,
ExchangeType
:
amqp
.
ExchangeDirect
,
BindingKey
:
"#"
,
ConsumerWorker
:
5
,
ConsumerPrefetch
:
5
,
})
_productService
=
product
.
NewProduct
(
zrpc
.
MustNewClient
(
zrpc
.
RpcClientConf
{
Target
:
"127.0.0.1:5200"
,
}))
}
func
main
()
{
log
.
Println
(
"脚本开始"
)
defer
log
.
Println
(
"脚本结束"
)
err
:=
_consumer
.
HandlerMessage
(
func
(
msg
[]
byte
)
error
{
var
productInfoMsg
message
.
ProductInfo
err
:=
json
.
Unmarshal
(
msg
,
&
productInfoMsg
)
if
err
!=
nil
{
return
err
}
if
productInfoMsg
.
Operation
==
message
.
ProductInfoOperationInsert
{
_
,
err
=
_productService
.
Upload
(
context
.
TODO
(),
&
product
.
ProductUploadRequest
{
StyleNumbers
:
[]
string
{
productInfoMsg
.
DesignerId
},
})
if
err
!=
nil
{
log
.
Println
(
string
(
msg
))
return
err
}
}
return
nil
})
if
err
!=
nil
{
panic
(
err
)
}
}
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