|
@@ -11,10 +11,12 @@ import (
|
|
|
"hongze/hongze_mobile_admin/models/tables/contract_approval_record"
|
|
|
"hongze/hongze_mobile_admin/models/tables/yb_community_question"
|
|
|
"hongze/hongze_mobile_admin/models/tables/yb_community_question_comment"
|
|
|
+ "hongze/hongze_mobile_admin/services"
|
|
|
"hongze/hongze_mobile_admin/utils"
|
|
|
"sort"
|
|
|
"strconv"
|
|
|
"strings"
|
|
|
+ "time"
|
|
|
)
|
|
|
|
|
|
//消息模块
|
|
@@ -144,8 +146,8 @@ func (c *MessageCommon) MessageList() {
|
|
|
_ = company_approval_message.ModifyAllCompanyApprovalMessageStatus(sysUserId, sourceType)
|
|
|
|
|
|
switch sourceType {
|
|
|
- case 5:
|
|
|
- err = getQuestionMessage(list)
|
|
|
+ case 5, 6:
|
|
|
+ err = getMessageInfo(list)
|
|
|
resp := message.CompanyApprovalMessageListResp{
|
|
|
List: list,
|
|
|
Total: total,
|
|
@@ -156,19 +158,6 @@ func (c *MessageCommon) MessageList() {
|
|
|
}
|
|
|
c.OkDetailed(resp, "获取成功")
|
|
|
return
|
|
|
- case 6:
|
|
|
- err = getQuestionCommentMessage(list)
|
|
|
- resp := message.CompanyApprovalMessageListResp{
|
|
|
- List: list,
|
|
|
- Total: total,
|
|
|
- }
|
|
|
- if err != nil {
|
|
|
- c.FailWithMessage("获取失败", "获取问答失败,Err:"+err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- c.OkDetailed(resp, "获取成功")
|
|
|
- return
|
|
|
-
|
|
|
}
|
|
|
|
|
|
companyApprovalIds := make([]string, 0)
|
|
@@ -338,6 +327,37 @@ func getQuestionCommentMessage(companyApprovalMessageList []*company_approval_me
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+// getMessageInfo 从消息主体中获取的消息
|
|
|
+func getMessageInfo(companyApprovalMessageList []*company_approval_message.CompanyApprovalMessageList) (err error) {
|
|
|
+ errMsgList := make([]string, 0)
|
|
|
+ defer func() {
|
|
|
+ if len(errMsgList) > 0 {
|
|
|
+ fmt.Println("errMsg:", strings.Join(errMsgList, "\n"))
|
|
|
+ }
|
|
|
+ }()
|
|
|
+ for _, v := range companyApprovalMessageList {
|
|
|
+ var tmpMessageInfo services.MessageInfo
|
|
|
+ if v.MessageInfo != `` {
|
|
|
+ tmpErr := json.Unmarshal([]byte(v.MessageInfo), &tmpMessageInfo)
|
|
|
+ if tmpErr != nil {
|
|
|
+ errMsgList = append(errMsgList, fmt.Sprintf("%d格式化消息失败,err:%s", v.CompanyApprovalId, v.MessageInfo))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ createTime, _ := time.ParseInLocation(utils.FormatDateTime, tmpMessageInfo.CreateTime.Format(utils.FormatDateTime), time.Local)
|
|
|
+ approvalInfo := company_approval_message.ApprovalInfo{
|
|
|
+ ApplyName: tmpMessageInfo.UserName,
|
|
|
+ Title: tmpMessageInfo.Content,
|
|
|
+ ApplyTime: createTime,
|
|
|
+ Content: tmpMessageInfo.Content,
|
|
|
+ CompanyName: tmpMessageInfo.CompanyName,
|
|
|
+ }
|
|
|
+ v.ApprovalInfo = approvalInfo
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// @Title 消息已读
|
|
|
// @Description 消息已读接口
|
|
|
// @Param request body company.CompanyApprovalMessageReadReq true "type json string"
|