|
@@ -27,9 +27,7 @@ func NewGetContactSimpleListLogic(ctx context.Context, svcCtx *svc.ServiceContex
|
|
|
}
|
|
|
|
|
|
func (l *GetContactSimpleListLogic) GetContactSimpleList(req *types.ContactListReq) (*types.ContactSimpleListResp, error) {
|
|
|
- organizationId := l.ctx.Value("organizationId").(uint64)
|
|
|
var predicates []predicate.Contact
|
|
|
- predicates = append(predicates, contact.OrganizationIDEQ(organizationId))
|
|
|
|
|
|
var ctype uint64 = 1
|
|
|
if req.Ctype != nil {
|
|
@@ -38,7 +36,7 @@ func (l *GetContactSimpleListLogic) GetContactSimpleList(req *types.ContactListR
|
|
|
predicates = append(predicates, contact.Ctype(ctype))
|
|
|
|
|
|
if req.WxWxid != nil {
|
|
|
- predicates = append(predicates, contact.WxWxid(*req.WxWxid))
|
|
|
+ predicates = append(predicates, contact.WxWxidContains(*req.WxWxid))
|
|
|
}
|
|
|
if req.Wxid != nil {
|
|
|
predicates = append(predicates, contact.WxidContains(*req.Wxid))
|
|
@@ -51,6 +49,8 @@ func (l *GetContactSimpleListLogic) GetContactSimpleList(req *types.ContactListR
|
|
|
}
|
|
|
if req.Type != nil {
|
|
|
predicates = append(predicates, contact.TypeEQ(*req.Type))
|
|
|
+ } else {
|
|
|
+ predicates = append(predicates, contact.Or(contact.TypeEQ(1), contact.TypeEQ(2)))
|
|
|
}
|
|
|
|
|
|
data, err := l.svcCtx.DB.Contact.Query().Where(predicates...).Page(l.ctx, req.Page, req.PageSize)
|