| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package logic
- import (
- "context"
- "slow_wild_api/apps/internal/constants"
- "slow_wild_api/apps/internal/svc"
- "slow_wild_api/apps/internal/types"
- "git.banshen.xyz/huangguangrong/slow_wild_protobuff/slowwild/slowwildserver"
- "github.com/zeromicro/go-zero/core/logx"
- )
- type SearchUsernameLogic struct {
- logx.Logger
- ctx context.Context
- svcCtx *svc.ServiceContext
- }
- // 搜索用户
- func NewSearchUsernameLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SearchUsernameLogic {
- return &SearchUsernameLogic{
- Logger: logx.WithContext(ctx),
- ctx: ctx,
- svcCtx: svcCtx,
- }
- }
- func (l *SearchUsernameLogic) SearchUsername(req *types.SearchUsernameReq) (resp *types.BaseReturnData, err error) {
- resp = &types.BaseReturnData{}
- userId := l.ctx.Value(constants.UserIdKey).(int64)
- rpcResp, err := l.svcCtx.SlowWildPb.SearchUsername(l.ctx, &slowwildserver.SearchUsernameReq{
- Keyword: req.Keyword,
- Page: req.Page,
- PageSize: req.PageSize,
- UserId: userId,
- })
- if err != nil {
- return nil, err
- }
- resp.Data = rpcResp
- return
- }
|