notificationMessage.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import HttpAxios from '@/utils/axios'
  2. const base = import.meta.env.VITE_API_HOST
  3. const baseUrl = `${base}/main_new_version.php`
  4. /**
  5. * 保存用户个人信息或日期和数字格式化配置
  6. * @param save_model profile 代表基本信息的save, no_profile 代表格式信息的save
  7. * @param first_name
  8. * @param last_name
  9. * @param date_fromat
  10. * @param numbers_format
  11. */
  12. export const saveUserInfo = (params: any) => {
  13. return HttpAxios.post(`${baseUrl}`, {
  14. action: 'system_setting',
  15. operate: 'personal_profile_save',
  16. ...params
  17. })
  18. }
  19. /**
  20. * 获取notification消息列表
  21. * @param rules_type 特定类型的消息,all查全部
  22. * @param current_time 当前时间 轮询查询时使用
  23. */
  24. export const getNotificationList = (params: any) => {
  25. return HttpAxios.get(`${baseUrl}`, {
  26. action: 'notifications_rules',
  27. operate: 'notifications_init',
  28. ...params
  29. })
  30. }
  31. /**
  32. * 获取notification消息的see all详情
  33. */
  34. export const getNotificationDetails = (params: any) => {
  35. return HttpAxios.post(`${baseUrl}`, {
  36. action: 'notifications_rules',
  37. operate: 'notifications_see_all',
  38. ...params
  39. })
  40. }
  41. /**
  42. * 获取system message页面数据
  43. */
  44. export const getSystemMessageData = (params: any) => {
  45. return HttpAxios.get(`${baseUrl}`, {
  46. action: 'notifications_rules',
  47. operate: 'notifications_message_init',
  48. ...params
  49. })
  50. }
  51. /**
  52. * 将notification消息标记为已读
  53. * @param id 消息id Array
  54. * @param read_type 如果标记全部为已读 = true. 否则其他情况为false
  55. */
  56. export const setMessageRead = (params: any) => {
  57. return HttpAxios.post(`${baseUrl}`, {
  58. action: 'notifications_rules',
  59. operate: 'notifications_read',
  60. read_type: false,
  61. ...params
  62. })
  63. }
  64. /**
  65. * 检测是否有新消息
  66. */
  67. export const hasUnreadMessages = () => {
  68. return HttpAxios.post(`${baseUrl}`, {
  69. action: 'notifications_rules',
  70. operate: 'check_notifications_message'
  71. })
  72. }