<?php
namespace app\controller\manager;

use app\model\Message as MMessage;

/**
 * 留言
 * Class Message
 * @package app\controller\manager
 */
class Message extends Base
{
    // 留言消息
    public function index()
    {
        $keyword = trim(input('param.keyword', ''));
        $this->data['list'] = MMessage::getPaginateList(20, $keyword, false);
        $this->data['keyword'] = $keyword;
        return $this->view();
    }

    public function del()
    {
        $id = input('param.id/d', 0);
        $msg = MMessage::getById($id);
        if(count($msg) == 0) {
            return $this->json(1, '该消息不存在');
        }
        MMessage::destroy($id);
        return $this->json();
    }
}