message.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. package seal
  2. import (
  3. "hongze/hz_crm_api/models/contract"
  4. "hongze/hz_crm_api/models/system"
  5. "hongze/hz_crm_api/services"
  6. )
  7. // 消息来源-用印
  8. var sourceType = 3
  9. func MessageToNodeUser(flowNodeId, createUserId, contractApprovalId, messageType, approvalStatus int, companyName, content string) (err error) {
  10. //获取审批单中抄送节点的所有数据列表
  11. contractApprovalRecordList, err := contract.GetContractApprovalRecordListByContractIdAndNode(contractApprovalId, flowNodeId)
  12. if err != nil {
  13. return
  14. }
  15. err = messageToUser(contractApprovalRecordList, createUserId, messageType, approvalStatus, companyName, content)
  16. return
  17. }
  18. func messageToUser(contractApprovalRecordList []*contract.ContractApprovalRecord, createUserId, messageType, approvalStatus int, companyName, content string) (err error) {
  19. for _, contractApprovalRecord := range contractApprovalRecordList {
  20. sysUserMobile := ""
  21. sysUser, _ := system.GetSysAdminById(contractApprovalRecord.ApproveUserId)
  22. if sysUser != nil {
  23. sysUserMobile = sysUser.Mobile
  24. }
  25. //接收人,就是审批记录里面的待审核人(抄送人)
  26. receiveUserId := contractApprovalRecord.ApproveUserId
  27. go services.AddCompanyApprovalMessage(createUserId, receiveUserId, 0, contractApprovalRecord.ContractApprovalRecordId, messageType, sourceType, approvalStatus, companyName, content, content, sysUserMobile)
  28. }
  29. return
  30. }