package svc import ( "fusenapi/home-user-auth/internal/config" "fusenapi/model" "github.com/zeromicro/go-zero/core/stores/sqlx" ) type ServiceContext struct { Config config.Config FsFontModel model.FsFontModel FsCanteenTypeModel model.FsCanteenTypeModel FsUserModel model.FsUserModel } func NewServiceContext(c config.Config) *ServiceContext { conn := sqlx.NewMysql(c.DataSource) return &ServiceContext{ Config: c, FsFontModel: model.NewFsFontModel(conn), FsCanteenTypeModel: model.NewFsCanteenTypeModel(conn), FsUserModel: model.NewFsUserModel(conn), } }