<?php

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;
/**
 * 系统消息
 */
class Message extends Api
{
    protected $noNeedLogin = [];
    protected $noNeedRight = ['*'];

    //我的消息列表
    public function mylist(){
        $list = Db::name('message')->where('user_id',$this->auth->id)->autopage()->order('id desc')->select();

        //读取即为已读
        $map = [
            'user_id' => $this->auth->id,
            'status' => 0,
        ];
        Db::name('message')->where($map)->update(['status'=>1]);
        $this->success('success',$list);
    }

}
