feat: sale manager
This commit is contained in:
+23
-22
@@ -7,6 +7,8 @@ import (
|
||||
"strconv"
|
||||
|
||||
"lone-services/pkg/discovery"
|
||||
"lone-services/pkg/modelbase"
|
||||
"lone-services/pkg/mysql"
|
||||
"lone-services/pkg/redis"
|
||||
"lone-services/pkg/utils"
|
||||
"lone-services/pkg/validate"
|
||||
@@ -88,24 +90,24 @@ func main() {
|
||||
}
|
||||
}()
|
||||
|
||||
// db, err := mysql.New(mysql.Config{
|
||||
// Host: utils.GetConfigString("mysql.host"),
|
||||
// Port: utils.GetConfigInt("mysql.port"),
|
||||
// User: utils.GetConfigString("mysql.user"),
|
||||
// Password: utils.GetConfigString("mysql.password"),
|
||||
// Database: utils.GetConfigString("mysql.database"),
|
||||
// Charset: utils.GetConfigString("mysql.charset"),
|
||||
// Prefix: utils.GetConfigString("mysql.prefix"),
|
||||
// ReadHost: utils.GetConfigString("mysql_read.host"),
|
||||
// ReadPort: utils.GetConfigInt("mysql_read.port"),
|
||||
// ReadUser: utils.GetConfigString("mysql_read.user"),
|
||||
// ReadPassword: utils.GetConfigString("mysql_read.password"),
|
||||
// ReadDatabase: utils.GetConfigString("mysql_read.database"),
|
||||
// })
|
||||
// if err != nil {
|
||||
// logx.Errorf("mysql init: %v", err)
|
||||
// os.Exit(1)
|
||||
// }
|
||||
db, err := mysql.New(mysql.Config{
|
||||
Host: utils.GetConfigString("mysql.host"),
|
||||
Port: utils.GetConfigInt("mysql.port"),
|
||||
User: utils.GetConfigString("mysql.user"),
|
||||
Password: utils.GetConfigString("mysql.password"),
|
||||
Database: utils.GetConfigString("mysql.database"),
|
||||
Charset: utils.GetConfigString("mysql.charset"),
|
||||
Prefix: utils.GetConfigString("mysql.prefix"),
|
||||
ReadHost: utils.GetConfigString("mysql_read.host"),
|
||||
ReadPort: utils.GetConfigInt("mysql_read.port"),
|
||||
ReadUser: utils.GetConfigString("mysql_read.user"),
|
||||
ReadPassword: utils.GetConfigString("mysql_read.password"),
|
||||
ReadDatabase: utils.GetConfigString("mysql_read.database"),
|
||||
})
|
||||
if err != nil {
|
||||
logx.Errorf("mysql init: %v", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if err := redis.Init(redis.Config{
|
||||
Host: utils.GetConfigString("redis.host"),
|
||||
@@ -117,16 +119,15 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// debug := utils.GetConfigBool("mysql.debug")test
|
||||
// modelbase.Init(db, modelbase.Config{Prefix: utils.GetConfigString("mysql.prefix"), Debug: debug})
|
||||
debug := utils.GetConfigBool("mysql.debug")
|
||||
modelbase.Init(db, modelbase.Config{Prefix: utils.GetConfigString("mysql.prefix"), Debug: debug})
|
||||
|
||||
rpcConf := zrpc.RpcServerConf{
|
||||
ListenOn: listenOn,
|
||||
}
|
||||
rpcConf.Mode = mode
|
||||
|
||||
// ctx := svc.NewServiceContext(c, db)
|
||||
ctx := svc.NewServiceContext(c)
|
||||
ctx := svc.NewServiceContext(c, db)
|
||||
|
||||
s := zrpc.MustNewServer(rpcConf, func(grpcServer *grpc.Server) {
|
||||
chore.RegisterChoreServer(grpcServer, server.NewChoreServer(ctx))
|
||||
|
||||
Reference in New Issue
Block a user