作者 tangxvhui

Merge branch 'dev' into test

@@ -189,6 +189,7 @@ type( @@ -189,6 +189,7 @@ type(
189 Position string `json:"position,omitempty"` // 职位 189 Position string `json:"position,omitempty"` // 职位
190 Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用 190 Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
191 AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝 191 AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
  192 + AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
192 Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余) 193 Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
193 Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余) 194 Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
194 Departments []int64 `json:"departments,omitempty"` // 所属部门 195 Departments []int64 `json:"departments,omitempty"` // 所属部门
@@ -123,15 +123,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR @@ -123,15 +123,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
123 123
124 //切分文章分段 124 //切分文章分段
125 sectionList := []domain.ArticleSection{} 125 sectionList := []domain.ArticleSection{}
  126 + newStr := ""
126 for i := range req.Section { 127 for i := range req.Section {
127 strList := strings.Split(req.Section[i], "\n") 128 strList := strings.Split(req.Section[i], "\n")
128 for i2 := range strList { 129 for i2 := range strList {
129 - newStr := strings.TrimSpace(strList[i2])  
130 - if len(newStr) == 0 {  
131 - continue  
132 - }  
133 - newStr = template.HTMLEscapeString(newStr)  
134 - 130 + newStr = template.HTMLEscapeString(strList[i2])
135 newSection := domain.ArticleSection{ 131 newSection := domain.ArticleSection{
136 Id: 0, 132 Id: 0,
137 CompanyId: author.CompanyId, 133 CompanyId: author.CompanyId,
@@ -47,7 +47,9 @@ func (l *MiniUserAuditListLogic) MiniUserAuditList(req *types.UserSearchRequest) @@ -47,7 +47,9 @@ func (l *MiniUserAuditListLogic) MiniUserAuditList(req *types.UserSearchRequest)
47 resp = &types.UserSearchResponse{Total: total, List: make([]*types.UserItem, 0)} 47 resp = &types.UserSearchResponse{Total: total, List: make([]*types.UserItem, 0)}
48 lo.ForEach(users, func(item *domain.User, index int) { 48 lo.ForEach(users, func(item *domain.User, index int) {
49 company, _ := domain.LazyLoad(companyMap, l.ctx, conn, item.CompanyId, l.svcCtx.CompanyRepository.FindOne) 49 company, _ := domain.LazyLoad(companyMap, l.ctx, conn, item.CompanyId, l.svcCtx.CompanyRepository.FindOne)
50 - resp.List = append(resp.List, NewUserItemSimple(item, company)) 50 + userAudit := NewUserItemSimple(item, company)
  51 + userAudit.AuditAt = lo.Ternary(item.AuditAt == 0, item.CreatedAt, item.AuditAt)
  52 + resp.List = append(resp.List, userAudit)
51 }) 53 })
52 54
53 return 55 return
@@ -62,6 +62,7 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs @@ -62,6 +62,7 @@ func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUs
62 Id: user.Id, 62 Id: user.Id,
63 Name: user.Name, 63 Name: user.Name,
64 PinYinName: user.PinYinName, 64 PinYinName: user.PinYinName,
  65 + Avatar: user.Avatar,
65 }) 66 })
66 } 67 }
67 } 68 }
@@ -528,6 +528,7 @@ type UserItem struct { @@ -528,6 +528,7 @@ type UserItem struct {
528 Position string `json:"position,omitempty"` // 职位 528 Position string `json:"position,omitempty"` // 职位
529 Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用 529 Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
530 AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝 530 AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
  531 + AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
531 Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余) 532 Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
532 Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余) 533 Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
533 Departments []int64 `json:"departments,omitempty"` // 所属部门 534 Departments []int64 `json:"departments,omitempty"` // 所属部门
@@ -20,6 +20,7 @@ type User struct { @@ -20,6 +20,7 @@ type User struct {
20 Position string // 职位 20 Position string // 职位
21 Enable int // 启用状态 1:启用 2:禁用 21 Enable int // 启用状态 1:启用 2:禁用
22 AuditStatus int // 审核状态 0:待审核 1:审核通过 2:拒绝 22 AuditStatus int // 审核状态 0:待审核 1:审核通过 2:拒绝
  23 + AuditAt int64
23 Follower []int64 `gorm:"type:jsonb;serializer:json"` // 关注我的人 (冗余) 24 Follower []int64 `gorm:"type:jsonb;serializer:json"` // 关注我的人 (冗余)
24 Following []int64 `gorm:"type:jsonb;serializer:json"` // 我关注的人 (冗余) 25 Following []int64 `gorm:"type:jsonb;serializer:json"` // 我关注的人 (冗余)
25 Departments []int64 `gorm:"type:jsonb;serializer:json"` // 所属部门 26 Departments []int64 `gorm:"type:jsonb;serializer:json"` // 所属部门
@@ -121,6 +121,12 @@ func (repository *MessageSystemRepository) Find(ctx context.Context, conn transa @@ -121,6 +121,12 @@ func (repository *MessageSystemRepository) Find(ctx context.Context, conn transa
121 ) 121 )
122 queryFunc := func() (interface{}, error) { 122 queryFunc := func() (interface{}, error) {
123 tx = tx.Model(&ms).Order("id desc") 123 tx = tx.Model(&ms).Order("id desc")
  124 + if v, ok := queryOptions["companyId"]; ok {
  125 + tx.Where("company_id = ?", v)
  126 + }
  127 + if v, ok := queryOptions["recipientId"]; ok {
  128 + tx.Where("recipient_id = ?", v)
  129 + }
124 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { 130 if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil {
125 return dms, tx.Error 131 return dms, tx.Error
126 } 132 }
@@ -218,7 +218,7 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn @@ -218,7 +218,7 @@ func (repository *UserRepository) FindDepartmentUsers(ctx context.Context, conn
218 ) 218 )
219 queryFunc := func() (interface{}, error) { 219 queryFunc := func() (interface{}, error) {
220 tx = tx.Model(&ms).Order("pin_yin_name asc") 220 tx = tx.Model(&ms).Order("pin_yin_name asc")
221 - tx.Select("id", "name", "departments", "pin_yin_name") 221 + tx.Select("id", "name", "departments", "pin_yin_name", "avatar")
222 tx.Where("company_id = ?", companyId) 222 tx.Where("company_id = ?", companyId)
223 tx.Where("audit_status in (?)", domain.UserAuditStatusPassed) 223 tx.Where("audit_status in (?)", domain.UserAuditStatusPassed)
224 tx.Where("enable = ?", domain.UserEnable) 224 tx.Where("enable = ?", domain.UserEnable)
@@ -6,6 +6,7 @@ import ( @@ -6,6 +6,7 @@ import (
6 "github.com/samber/lo" 6 "github.com/samber/lo"
7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" 7 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool" 8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool"
  9 + "time"
9 ) 10 )
10 11
11 type User struct { 12 type User struct {
@@ -21,6 +22,7 @@ type User struct { @@ -21,6 +22,7 @@ type User struct {
21 Position string `json:"position,omitempty"` // 职位 22 Position string `json:"position,omitempty"` // 职位
22 Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用 23 Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
23 AuditStatus int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝 24 AuditStatus int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
  25 + AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
24 Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余) 26 Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
25 Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余) 27 Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
26 Departments []int64 `json:"departments,omitempty"` // 所属部门 28 Departments []int64 `json:"departments,omitempty"` // 所属部门
@@ -88,6 +90,7 @@ func (m *User) Audit(status int) error { @@ -88,6 +90,7 @@ func (m *User) Audit(status int) error {
88 return fmt.Errorf("用户不是在待审核状态") 90 return fmt.Errorf("用户不是在待审核状态")
89 } 91 }
90 m.AuditStatus = status 92 m.AuditStatus = status
  93 + m.AuditAt = time.Now().Unix()
91 return nil 94 return nil
92 } 95 }
93 96