<?php
namespace app\user\model;

use think\Model;

/**
 * 用户信息管理
 */
class UserMessage extends Model
{
    //获取用户消息
    public function getUserMessage($condition)
    {

        $message_list = $this
            ->where($condition)
            ->order('userMessage_create desc')
            ->paginate(10);

        return $message_list;

    }

    //获取用户未读消息
    public function getMessage($user_id)
    {
        $message = $this
            ->where('user_id',$user_id)
            ->where('userMessage_status',0)
            ->select();

        return $message;

    }

    public function getOneMessage($userMessage_id)
    {
        $result = $this
            ->where('userMessage_id',$userMessage_id)
            ->find();

        return $result;
    }

}
