35 lines
985 B
Go
35 lines
985 B
Go
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 errdata = this.SearchCheck(session, req); errdata != nil {
|
|
return
|
|
}
|
|
|
|
rsp := &pb.SociatySearchResp{}
|
|
sociaty := this.module.modelSociaty.findByName(req.Name)
|
|
if sociaty != nil && sociaty.Id != "" {
|
|
rsp.List = append(rsp.List, sociaty)
|
|
}
|
|
|
|
session.SendMsg(string(this.module.GetType()), SociatySubTypeSearch, rsp)
|
|
return
|
|
}
|