代码拉取完成,页面将自动刷新
package logic
import (
"context"
"gitee.com/imxxm/easy-chat/apps/user/models"
"gitee.com/imxxm/easy-chat/apps/user/rpc/internal/svc"
"gitee.com/imxxm/easy-chat/apps/user/rpc/user"
"github.com/jinzhu/copier"
"github.com/zeromicro/go-zero/core/logx"
)
type FindUserLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewFindUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FindUserLogic {
return &FindUserLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *FindUserLogic) FindUser(in *user.FindUserReq) (*user.FindUserResp, error) {
// todo: add your logic here and delete this line
var (
userEntitys []*models.Users
err error
)
if in.Phone != "" {
userEntity, err := l.svcCtx.UsersModel.FindByPhone(l.ctx, in.Phone)
if err == nil {
userEntitys = append(userEntitys, userEntity)
}
} else if in.Name != "" {
userEntitys, err = l.svcCtx.UsersModel.ListByName(l.ctx, in.Name)
} else if len(in.Ids) > 0 {
userEntitys, err = l.svcCtx.UsersModel.ListByIds(l.ctx, in.Ids)
}
if err != nil {
return nil, err
}
var resp []*user.UserEntity
copier.Copy(&resp, &userEntitys)
return &user.FindUserResp{
User: resp,
}, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。