package services import ( "fmt" "hongze/hongze_mobile_admin/models/tables/company_approval_message" "time" ) func AddCompanyApprovalMessage(createUserId, receiveUserId, companyId, companyApprovalId, msgType, sourceType, approvalStatus int, companyName, remark, content, mobile string) (err error) { var err1 error defer func() { if err != nil { fmt.Println("AddCompanyApprovalMessage Err:", err) } if err1 != nil { fmt.Println("ModifyCompanyApprovalMessage Err:", err) } }() if msgType == 2 { company_approval_message.ModifyCompanyApprovalMessage(companyApprovalId, sourceType) } msgItem := new(company_approval_message.CompanyApprovalMessage) msgItem.CreateUserId = createUserId msgItem.ReceiveUserId = receiveUserId msgItem.MessageStatus = 0 //消息状态:0未读,1:已读,2:作废 msgItem.Remark = remark msgItem.Content = content msgItem.CompanyId = companyId msgItem.CompanyName = companyName msgItem.CreateTime = time.Now() msgItem.ModifyTime = time.Now() msgItem.CompanyApprovalId = companyApprovalId msgItem.OperationStatus = 1 //消息状态:1:待审批,2:已审批 msgItem.MessageType = msgType //1:申请消息,2:审批结果,3:消息通知 msgItem.SourceType = sourceType //消息来源,1:客户,2:合同,3:用印 msgItem.ApprovalStatus = approvalStatus //审批状态,1:待审批,2:已审批,3:已驳回 err = company_approval_message.AddCompanyApprovalMessage(msgItem) if mobile != "" { go SendCompanyApplyWxTemplateMsg(mobile, content) } return }