Chever John 379fb28d92 chore: sync codebase with upstream
Align origin/main with upstream/main (GitHub). The two branches
diverged due to pre-rebase vs post-rebase merge commits for the
k8s-amd64-dockerfiles feature.

Includes: multi-stage Go compilation Dockerfiles, pan-bolt
inventory features, CRM relations, Excel import tooling,
proto/gRPC updates, migration scripts, and tools/ directory.

Excludes deploy/bin/ pre-compiled binaries (arm64, not needed
for amd64 K3s cluster; builds use multi-stage Dockerfiles now).
2026-06-14 15:24:02 +08:00

36 lines
1.2 KiB
Go

package svc
import (
"muyu-apiserver/model"
"muyu-apiserver/rpc/inventory/internal/config"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
type ServiceContext struct {
Config config.Config
ProductModel model.InvProductModel
PanModel model.InvProductPanModel
BoltModel model.InvProductBoltModel
ImportLogModel model.InvStockImportLogModel
StockCheckModel model.InvStockCheckModel
CheckDetailModel model.InvStockCheckDetailModel
StockAdjustModel model.InvStockAdjustModel
AdjustDetailModel model.InvStockAdjustDetailModel
}
func NewServiceContext(c config.Config) *ServiceContext {
conn := sqlx.NewMysql(c.DataSource)
return &ServiceContext{
Config: c,
ProductModel: model.NewInvProductModel(conn, c.Cache),
PanModel: model.NewInvProductPanModel(conn),
BoltModel: model.NewInvProductBoltModel(conn),
ImportLogModel: model.NewInvStockImportLogModel(conn, c.Cache),
StockCheckModel: model.NewInvStockCheckModel(conn, c.Cache),
CheckDetailModel: model.NewInvStockCheckDetailModel(conn, c.Cache),
StockAdjustModel: model.NewInvStockAdjustModel(conn, c.Cache),
AdjustDetailModel: model.NewInvStockAdjustDetailModel(conn, c.Cache),
}
}