building-sign/app/model/Message.php

51 lines
1.1 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
namespace app\model;
class Message extends Base
{
// 消息类型
public const TYPE_SYSTEM = 'system'; // 系统消息
public const TYPE_NOTICE = 'notice'; // 通知消息
public const TYPE_REMINDERS = 'reminders'; // 日程提醒
// 发送范围
public const TARGET_ALL = 'all'; // 所有用户
public const TARGET_PART = 'part'; // 部分用户与target_list组合查询
/**
* 消息类型文本描述
* @return string[]
*/
public static function typeTextList(): array
{
return [
self::TYPE_SYSTEM => '系统消息',
self::TYPE_NOTICE => '通知消息',
self::TYPE_REMINDERS => '日程提醒',
];
}
/**
* 消息类型文本描述
* @return string[]
*/
public static function targetTextList(): array
{
return [
self::TARGET_ALL => '所有用户',
self::TARGET_PART => '部分用户',
];
}
/**
* 获取列表
*/
public static function getList($per = 20)
{
return self::order("create_time desc")
->paginate($per);
}
}