package sociaty import ( "go_dreamfactory/comm" "go_dreamfactory/lego/sys/log" "go_dreamfactory/pb" ) // 公会搜索 func (this *apiComp) SearchCheck(session comm.IUserSession, req *pb.SociatySearchReq) (errdata *pb.ErrorData) { if req.Name == "" { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ReqParameterError, Title: pb.ErrorCode_ReqParameterError.ToString(), } this.module.Error("公会搜索参数错误", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "params", Value: req.String()}) } return } func (this *apiComp) Search(session comm.IUserSession, req *pb.SociatySearchReq) (errdata *pb.ErrorData) { if code = this.SearchCheck(session, req); code != pb.ErrorCode_Success { return } data = &pb.ErrorData{} rsp := &pb.SociatySearchResp{} sociaty := this.module.modelSociaty.findByName(req.Name) if sociaty != nil && sociaty.Id != "" { rsp.List = append(rsp.List, sociaty) } if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeSearch, rsp); err != nil { code = pb.ErrorCode_SystemError } return }