42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package analysisstorelogic
|
|
|
|
import (
|
|
"context"
|
|
|
|
"lone-services/pkg/utils"
|
|
"lone-services/pkg/validate"
|
|
analysis "lone-services/rpc/analysis/pb"
|
|
"lone-services/services/analysis/internal/logic/common"
|
|
"lone-services/services/analysis/internal/svc"
|
|
"lone-services/services/analysis/validator"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type StoreInfoLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
}
|
|
|
|
func NewStoreInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StoreInfoLogic {
|
|
return &StoreInfoLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *StoreInfoLogic) StoreInfo(in *analysis.StoreInfoReq) (*analysis.Response, error) {
|
|
var req validator.StoreInfoValidator
|
|
if msg := validate.ValidateFromProto(in, &req); msg != utils.StringEmpty {
|
|
return common.OutResponse(utils.ErrorParams, msg), nil
|
|
}
|
|
|
|
info, fail := loadPassedStore(l.ctx, req.Id)
|
|
if fail != nil {
|
|
return fail, nil
|
|
}
|
|
return common.OkResponse(skinStore(info)), nil
|
|
}
|