2025-06-22 11:22:04 +08:00
|
|
|
package impl
|
|
|
|
|
|
|
|
import (
|
|
|
|
"122.51.31.227/go-course/go18/devcloud/mpaas/apps/application"
|
|
|
|
"github.com/infraboard/mcube/v2/ioc"
|
|
|
|
"github.com/infraboard/mcube/v2/ioc/config/datasource"
|
2025-06-29 15:26:49 +08:00
|
|
|
"github.com/infraboard/mcube/v2/ioc/config/log"
|
|
|
|
"github.com/rs/zerolog"
|
2025-06-22 11:22:04 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
ioc.Controller().Registry(&ApplicationServiceImpl{})
|
|
|
|
}
|
|
|
|
|
|
|
|
var _ application.Service = (*ApplicationServiceImpl)(nil)
|
|
|
|
|
|
|
|
type ApplicationServiceImpl struct {
|
|
|
|
ioc.ObjectImpl
|
2025-06-29 15:26:49 +08:00
|
|
|
|
|
|
|
log *zerolog.Logger
|
2025-06-22 11:22:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (i *ApplicationServiceImpl) Init() error {
|
2025-06-29 15:26:49 +08:00
|
|
|
i.log = log.Sub(i.Name())
|
|
|
|
|
2025-06-22 11:22:04 +08:00
|
|
|
if datasource.Get().AutoMigrate {
|
|
|
|
err := datasource.DB().AutoMigrate(&application.Application{})
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (i *ApplicationServiceImpl) Name() string {
|
|
|
|
return application.APP_NAME
|
|
|
|
}
|