123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- /**
- * MessageConst.php UTF-8
- *
- *
- * @date : 2018/6/19 16:07
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : luowei <lw@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huolib\constant;
- class MessageConst {
- const TYPE_ACTIVITY = 1;//活动消息
- const TYPE_SYSTEM = 2;//系统消息
- const TYPE_CARD = 3;//卡券消息
- const TYPE_PREFERENTIAL = 4;//优惠活动
- /**
- * @param $type
- * @param bool $all
- *
- * @return array|bool|mixed
- */
- public static function getTypeMsg($type, $all = false) {
- $_msg = array(
- self::TYPE_ACTIVITY => '活动消息',
- self::TYPE_SYSTEM => '系统消息',
- self::TYPE_CARD => '卡券消息',
- self::TYPE_PREFERENTIAL => '优惠活动',
- );
- if (true == $all) {
- return $_msg;
- }
- if (!isset($_msg[$type])) {
- return false;
- }
- return $_msg[$type];
- }
- /**
- * @param bool $inc
- *
- * @return array
- */
- public static function getTypes($inc = false) {
- $_types = self::getTypeMsg(null, true);
- if (true == $inc) {
- $_default = ["0" => "选择类型"];
- $_types = $_default + $_types;
- }
- return $_types;
- }
- }
|