Files
lone-services/services/analysis/internal/logic/analysisuser/userStatusLogic.go
T
zzw c4eede1114
CI / changes (push) Successful in 1m32s
CI / ad (push) Successful in 0s
CI / admin (push) Successful in 0s
CI / analysis (push) Successful in 3m45s
CI / bff (push) Successful in 31s
CI / chore (push) Successful in 0s
CI / equipment (push) Successful in 0s
CI / express (push) Successful in 1s
CI / factory (push) Successful in 0s
CI / message (push) Successful in 0s
CI / order (push) Successful in 0s
CI / payment (push) Successful in 0s
CI / percutaneous (push) Successful in 1s
CI / product (push) Successful in 0s
CI / sale (push) Successful in 0s
CI / record (push) Successful in 0s
CI / store (push) Successful in 0s
CI / support (push) Successful in 0s
CI / user (push) Successful in 1s
CI / task (push) Successful in 0s
CI / water (push) Successful in 0s
CI / wecom (push) Successful in 0s
CI / ws (push) Successful in 0s
feat: analysis user status
2026-10-27 09:01:36 +08:00

56 lines
1.3 KiB
Go

package analysisuserlogic
import (
"context"
"lone-services/pkg/utils"
analysis "lone-services/rpc/analysis/pb"
"lone-services/services/analysis/internal/logic/common"
"lone-services/services/analysis/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type UserStatusLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewUserStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserStatusLogic {
return &UserStatusLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *UserStatusLogic) UserStatus(in *analysis.UserStatusReq) (*analysis.Response, error) {
bizId, _, fail := common.RequireAnalysisUserId(l.ctx)
if fail != nil {
return fail, nil
}
row, err := common.LoadAnalysisUser(bizId)
if err != nil {
l.Errorf("user status load: %v", err)
return common.FailResponse(utils.Fail), nil
}
if row == nil {
return common.FailResponse(utils.ErrorNotFund), nil
}
status := utils.NumberOne
if row.IsRegistered == uint8(utils.StatusOk) {
status = utils.NumberTwo
}
if row.IsFaceVerified == uint8(utils.StatusOk) {
status = utils.NumberThree
}
if row.IsProfileCompleted == uint8(utils.StatusOk) {
status = utils.NumberFour
}
return common.OkResponse(map[string]int{"status": status}), nil
}