<?php
namespace app\api\controller\v1\common;
use app\api\exception\DbLinkException;
use think\Db;

class Role
{
    public function getRoles(){
        $roles = Db::table('role')->field('id,title')->select();
        if(!$roles)
            throw new DbLinkException;

        return json([
            'status' => 1,
            'message' => 'ok',
            'data' => $roles
        ]);
    }
}