You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.3 KiB

  1. MessageManager = class("MessageManager");
  2. function MessageManager:ctor()
  3. end
  4. function MessageManager:init()
  5. if app.php.activityRedPoint then
  6. --活动数据处理
  7. app.php.activityRedPoint.tasks.count = 0
  8. for k,v in pairs(NOTICE_REDPOINT) do
  9. local value = app.php.activityRedPoint.tasks[v]
  10. if value == 1 then
  11. app.php.activityRedPoint.tasks.count = app.php.activityRedPoint.tasks.count + 1
  12. end
  13. end
  14. --dump(app.php.activityRedPoint,"initMessageManager")
  15. end
  16. end
  17. --[[
  18. 一维红点key传空,name传对应的红点字段
  19. 多维红点key,name都需要传
  20. ]]
  21. function MessageManager:removeMsg(key,name)
  22. --本地内存数据改变
  23. if app.php.activityRedPoint then
  24. if key then
  25. if app.php.activityRedPoint[key][name] and app.php.activityRedPoint[key][name] == 0 then
  26. return
  27. end
  28. app.php.activityRedPoint[key][name] = 0
  29. if app.php.activityRedPoint[key].count then
  30. app.php.activityRedPoint[key].count = app.php.activityRedPoint[key].count - 1
  31. if app.php.activityRedPoint[key].count <= 0 then
  32. app.php.activityRedPoint[key].count = 0;
  33. end
  34. end
  35. else
  36. app.php.activityRedPoint[name] = 0
  37. end
  38. --dump(app.php.activityRedPoint,"removeMsgMessageManager")
  39. end
  40. --服务器数据发送
  41. app.php:requestReadRedPoint(name)
  42. end
  43. return MessageManager