MessageConst.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. * MessageConst.php UTF-8
  4. *
  5. *
  6. * @date : 2018/6/19 16:07
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huolib\constant;
  13. class MessageConst {
  14. const TYPE_ACTIVITY = 1;//活动消息
  15. const TYPE_SYSTEM = 2;//系统消息
  16. const TYPE_CARD = 3;//卡券消息
  17. const TYPE_PREFERENTIAL = 4;//优惠活动
  18. /**
  19. * @param $type
  20. * @param bool $all
  21. *
  22. * @return array|bool|mixed
  23. */
  24. public static function getTypeMsg($type, $all = false) {
  25. $_msg = array(
  26. self::TYPE_ACTIVITY => '活动消息',
  27. self::TYPE_SYSTEM => '系统消息',
  28. self::TYPE_CARD => '卡券消息',
  29. self::TYPE_PREFERENTIAL => '优惠活动',
  30. );
  31. if (true == $all) {
  32. return $_msg;
  33. }
  34. if (!isset($_msg[$type])) {
  35. return false;
  36. }
  37. return $_msg[$type];
  38. }
  39. /**
  40. * @param bool $inc
  41. *
  42. * @return array
  43. */
  44. public static function getTypes($inc = false) {
  45. $_types = self::getTypeMsg(null, true);
  46. if (true == $inc) {
  47. $_default = ["0" => "选择类型"];
  48. $_types = $_default + $_types;
  49. }
  50. return $_types;
  51. }
  52. }