<?php
namespace app\api\controller\v1;
use app\api\controller\Base;
use app\hander\HelpHander;
use think\Db;

class Notice extends Base
{
    public function lists(){
        $page = input('page',1);
        $size = input('size',20);
        $ret = model('Notice')->lists($page,$size,$this->userId,$this->orgId);
        $ret?HelpHander::success($ret):HelpHander::success(null);
    }

    public function details(){
        $id = input('id',0);
        $info = model('Notice')->details($id);
        if($info){
            HelpHander::success($info);
        }else{
            HelpHander::error('暂无数据');
        }
    }

    public function queryNoticeCount(){
        $ret = Db::name('notice')
            ->where('org_id',$this->orgId)
            ->where('user_id',$this->userId)
            ->where('is_read',0)
            ->where('del',0)
            ->count();
        HelpHander::success($ret);
    }


}