new create admin order,express add company
This commit is contained in:
@@ -74,26 +74,37 @@ func GetRpcClient(serviceName string) (zrpc.Client, error) {
|
||||
}
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
Prefix string
|
||||
|
||||
Config config.Config
|
||||
DB *gorm.DB
|
||||
Prefix string
|
||||
ProductSvcName string //服务名
|
||||
ExpressSvcName string
|
||||
ChoreSvcName string
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config, db *gorm.DB) *ServiceContext {
|
||||
//启动仅读取配置,不建立rpc连接 多个服务就多个
|
||||
productSvc := utils.GetConfigString("services.product")
|
||||
ExpressSvc := utils.GetConfigString("services.express")
|
||||
ChoreSvc := utils.GetConfigString("services.chore")
|
||||
|
||||
if productSvc == utils.StringEmpty {
|
||||
logx.Error("config services.product empty")
|
||||
}
|
||||
if ExpressSvc == utils.StringEmpty {
|
||||
logx.Error("config services.express empty")
|
||||
}
|
||||
if ChoreSvc == utils.StringEmpty {
|
||||
logx.Error("config services.chore empty")
|
||||
}
|
||||
|
||||
svcCtx := &ServiceContext{
|
||||
Config: c,
|
||||
DB: db,
|
||||
Prefix: utils.GetConfigString("mysql.prefix"),
|
||||
ProductSvcName: productSvc,
|
||||
ExpressSvcName: ExpressSvc,
|
||||
ChoreSvcName: ChoreSvc,
|
||||
}
|
||||
|
||||
return svcCtx
|
||||
|
||||
Reference in New Issue
Block a user