作者 tangxvhui

Merge branch 'test'

... ... @@ -20,10 +20,6 @@ func MiniUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := user.NewMiniUserInfoLogic(r.Context(), svcCtx)
resp, err := l.MiniUserInfo(&req)
if len(resp.Accounts) == 0 { // 无账号时登出
httpx.WriteJson(w, http.StatusUnauthorized, nil)
return
}
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -42,7 +42,10 @@ func (l *MiniArticleCommentAtWhoLogic) MiniArticleCommentAtWho(req *types.MiniAr
var userList []*domain.User
if articleInfo.TargetUser == domain.ArticleTargetAll {
//获取所有人
queryOption := domain.NewQueryOptions().WithFindOnly().MustWithKV("companyId", articleInfo.CompanyId)
queryOption := domain.NewQueryOptions().WithFindOnly().
MustWithKV("companyId", articleInfo.CompanyId).
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})
_, userList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
resp = &types.MiniArticleCommentAtWhoResponse{}
... ...
... ... @@ -91,7 +91,9 @@ func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.Mini
atWhoIds = append(atWhoIds, val.Id)
}
atWhoIds = lo.Uniq(atWhoIds)
queryOption := domain.NewQueryOptions().WithFindOnly().WithKV("ids", atWhoIds)
queryOption := domain.NewQueryOptions().WithFindOnly().
WithKV("ids", atWhoIds).
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed})
_, atWhoList, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("检查@的人员失败", err)
... ...
... ... @@ -49,7 +49,9 @@ func (l *SystemEditAticleCommentLogic) SystemEditAticleComment(req *types.System
maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
} else {
//统计全员人数
queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId)
queryOption := domain.NewQueryOptions().WithCountOnly().
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
MustWithKV("companyId", req.CompanyId)
cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
... ...
... ... @@ -61,7 +61,9 @@ func (l *SystemEditAticleCommentLoveLogic) SystemEditAticleCommentLove(req *type
maxCount = commetInfo.MaxCountAdminLove(len(articleInfo.WhoRead))
} else {
//统计全员人数
queryOption := domain.NewQueryOptions().WithCountOnly().MustWithKV("companyId", req.CompanyId)
queryOption := domain.NewQueryOptions().WithCountOnly().
MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}).
MustWithKV("companyId", req.CompanyId)
cnt, _, err := l.svcCtx.UserRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("获取人员数据失败", err)
... ...
... ... @@ -69,7 +69,10 @@ func (l *MiniCompanySearchJoinedLogic) MiniCompanySearchJoined(req *types.Compan
return nil, xerr.NewErrMsgErr("公司列表获取失败", err)
}
} else if req.Flag == 2 {
total, companyList, err = l.svcCtx.CompanyRepository.Find(l.ctx, conn, queryOptions.MustWithKV("excludeIds", companyJoinedList))
if len(companyJoinedList) > 0 {
queryOptions.MustWithKV("excludeIds", companyJoinedList)
}
total, companyList, err = l.svcCtx.CompanyRepository.Find(l.ctx, conn, queryOptions)
if err != nil {
return nil, xerr.NewErrMsgErr("公司列表获取失败", err)
}
... ...
... ... @@ -2,6 +2,7 @@ package department
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
... ... @@ -58,7 +59,9 @@ func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (re
// 获取公司下的所有用户
_, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().
WithFindOnly().
WithKV("companyId", one.CompanyId))
WithKV("companyId", one.CompanyId).MustWithKV("auditStatus", []int{domain.UserAuditStatusPassed}),
)
if err != nil {
return nil, err
}
... ...
... ... @@ -267,8 +267,12 @@ func (l *MiniBusinessLogic) createMessage(
at []int64) (err error) {
var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
// 评论中携带了 @其他用户
var dupMap = make(map[int64]int64, 0)
// 评论中携带了 @用户
for i := range at {
if _, ok := dupMap[at[i]]; ok { /* ID去重 */
// do nothing ...
} else {
var msg = &domain.MessageBusiness{
Type: msgType,
OptType: optType,
... ... @@ -283,6 +287,9 @@ func (l *MiniBusinessLogic) createMessage(
if err != nil {
return err
}
dupMap[at[i]] = at[i]
}
}
return nil
}
... ...
... ... @@ -43,7 +43,8 @@ func (l *SystemUserAccountSearchLogic) SystemUserAccountSearch(req *types.System
WithKV("roleId", req.RoleId).
WithKV("enable", req.Enable).
WithKV("beginTime", req.BeginTime).
WithKV("endTime", req.EndTime)
WithKV("endTime", req.EndTime).
WithKV("auditStatus", []int{domain.UserAuditStatusPassed})
if total, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOptions); err != nil {
return nil, xerr.NewErr(err)
}
... ...
... ... @@ -41,7 +41,8 @@ func (l *SystemUserSearchLogic) SystemUserSearch(req *types.SystemUserSearchRequ
WithKV("likePhone", req.Phone).
WithKV("position", req.Position).
WithKV("enable", req.Enable).
WithKV("departmentId", req.DepartmentId)
WithKV("departmentId", req.DepartmentId).
WithKV("auditStatus", []int{domain.UserAuditStatusPassed})
if total, users, err = l.svcCtx.UserRepository.Find(l.ctx, conn, queryOptions); err != nil {
return nil, xerr.NewErr(err)
}
... ...