作者 tangxvhui

Merge branch 'dev' into test

... ... @@ -188,7 +188,8 @@ type(
Phone string `json:"phone,omitempty"` // 手机号 唯一
Position string `json:"position,omitempty"` // 职位
Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
Departments []int64 `json:"departments,omitempty"` // 所属部门
... ...
... ... @@ -123,15 +123,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
//切分文章分段
sectionList := []domain.ArticleSection{}
newStr := ""
for i := range req.Section {
strList := strings.Split(req.Section[i], "\n")
for i2 := range strList {
newStr := strings.TrimSpace(strList[i2])
if len(newStr) == 0 {
continue
}
newStr = template.HTMLEscapeString(newStr)
newStr = template.HTMLEscapeString(strList[i2])
newSection := domain.ArticleSection{
Id: 0,
CompanyId: author.CompanyId,
... ...
... ... @@ -47,7 +47,9 @@ func (l *MiniUserAuditListLogic) MiniUserAuditList(req *types.UserSearchRequest)
resp = &types.UserSearchResponse{Total: total, List: make([]*types.UserItem, 0)}
lo.ForEach(users, func(item *domain.User, index int) {
company, _ := domain.LazyLoad(companyMap, l.ctx, conn, item.CompanyId, l.svcCtx.CompanyRepository.FindOne)
resp.List = append(resp.List, NewUserItemSimple(item, company))
userAudit := NewUserItemSimple(item, company)
userAudit.AuditAt = lo.Ternary(item.AuditAt == 0, item.CreatedAt, item.AuditAt)
resp.List = append(resp.List, userAudit)
})
return
... ...
... ... @@ -62,6 +62,7 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs
Id: user.Id,
Name: user.Name,
PinYinName: user.PinYinName,
Avatar: user.Avatar,
})
}
}
... ...
... ... @@ -528,6 +528,7 @@ type UserItem struct {
Position string `json:"position,omitempty"` // 职位
Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
Departments []int64 `json:"departments,omitempty"` // 所属部门
... ...
... ... @@ -15,11 +15,12 @@ type User struct {
Flag int // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string // 名称
PinYinName string
Avatar string // 头像
Phone string // 手机号 唯一
Position string // 职位
Enable int // 启用状态 1:启用 2:禁用
AuditStatus int // 审核状态 0:待审核 1:审核通过 2:拒绝
Avatar string // 头像
Phone string // 手机号 唯一
Position string // 职位
Enable int // 启用状态 1:启用 2:禁用
AuditStatus int // 审核状态 0:待审核 1:审核通过 2:拒绝
AuditAt int64
Follower []int64 `gorm:"type:jsonb;serializer:json"` // 关注我的人 (冗余)
Following []int64 `gorm:"type:jsonb;serializer:json"` // 我关注的人 (冗余)
Departments []int64 `gorm:"type:jsonb;serializer:json"` // 所属部门
... ...
... ... @@ -121,6 +121,12 @@ func (repository *MessageSystemRepository) Find(ctx context.Context, conn transa
)
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).Order("id desc")
if v, ok := queryOptions["companyId"]; ok {
tx.Where("company_id = ?", v)
}
if v, ok := queryOptions["recipientId"]; ok {
tx.Where("recipient_id = ?", v)
}
if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
return dms, tx.Error
}
... ...
... ... @@ -218,7 +218,7 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn
)
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).Order("pin_yin_name asc")
tx.Select("id", "name", "departments", "pin_yin_name")
tx.Select("id", "name", "departments", "pin_yin_name", "avatar")
tx.Where("company_id = ?", companyId)
tx.Where("audit_status in (?)", domain.UserAuditStatusPassed)
tx.Where("enable = ?", domain.UserEnable)
... ...
... ... @@ -6,6 +6,7 @@ import (
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool"
"time"
)
type User struct {
... ... @@ -21,6 +22,7 @@ type User struct {
Position string `json:"position,omitempty"` // 职位
Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
AuditStatus int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
Departments []int64 `json:"departments,omitempty"` // 所属部门
... ... @@ -88,6 +90,7 @@ func (m *User) Audit(status int) error {
return fmt.Errorf("用户不是在待审核状态")
}
m.AuditStatus = status
m.AuditAt = time.Now().Unix()
return nil
}
... ...