48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package logic
|
|
|
|
import (
|
|
"context"
|
|
"lone-services/pkg/modelbase"
|
|
"lone-services/pkg/utils"
|
|
"lone-services/services/chore/internal/dao"
|
|
"lone-services/services/chore/internal/model"
|
|
"lone-services/services/chore/validator"
|
|
"strconv"
|
|
|
|
"lone-services/rpc/chore/pb"
|
|
"lone-services/services/chore/internal/svc"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type ApiSystemInfoLogic struct {
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
logx.Logger
|
|
BaseLogic
|
|
}
|
|
|
|
func NewApiSystemInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ApiSystemInfoLogic {
|
|
return &ApiSystemInfoLogic{
|
|
ctx: ctx,
|
|
svcCtx: svcCtx,
|
|
Logger: logx.WithContext(ctx),
|
|
}
|
|
}
|
|
|
|
func (l *ApiSystemInfoLogic) ApiSystemInfo(in *chore.ApiSystemReq) (*chore.Response, error) {
|
|
var v validator.ApiSystemInfoValidator
|
|
if fail := l.checkParams(in, &v); fail != nil {
|
|
return fail, nil
|
|
}
|
|
|
|
var info []dao.ApiSystemInfo
|
|
w := modelbase.Params{Eq: map[string]string{"type": strconv.Itoa(int(in.Type))}}
|
|
err := model.SystemModel{}.Init().GetOne(w, &info)
|
|
if err != nil {
|
|
return l.fail(utils.ErrorNotFund)
|
|
}
|
|
|
|
return l.ok(info)
|
|
}
|