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).
39 lines
833 B
Go
39 lines
833 B
Go
package panbolt
|
|
|
|
import (
|
|
"context"
|
|
|
|
"muyu-apiserver/gateway/internal/svc"
|
|
"muyu-apiserver/gateway/internal/types"
|
|
"muyu-apiserver/pkg/ctxdata"
|
|
"muyu-apiserver/rpc/inventory/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type SaveBoltsLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewSaveBoltsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SaveBoltsLogic {
|
|
return &SaveBoltsLogic{
|
|
Logger: logx.WithContext(ctx),
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
}
|
|
}
|
|
|
|
func (l *SaveBoltsLogic) SaveBolts(req *types.SaveBoltsReq) (resp *types.IdResp, err error) {
|
|
panId := ctxdata.GetPathId(l.ctx)
|
|
_, err = l.svcCtx.InventoryRpc.SaveBolts(l.ctx, &pb.SaveBoltsReq{
|
|
PanId: panId,
|
|
Lengths: req.Lengths,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &types.IdResp{Id: panId}, nil
|
|
}
|