<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-present http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 老猫 <thinkcmf@126.com>
// +----------------------------------------------------------------------
namespace app\admin\model;

use app\admin\service\RouteService;
use think\Model;

class RouteModel extends Model
{
    /**
     * 模型名称
     * @var string
     */
    protected $name = 'route';

    /**
     * 获取所有url美化规则
     * @param boolean $refresh 是否强制刷新
     * @return array|mixed|string|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     * @deprecated
     */
    public function getRoutes($refresh = false)
    {
        return RouteService::getRoutes($refresh);
    }

    /**
     * @return array
     * @deprecated
     */
    public function getAppUrls()
    {
        return RouteService::getAppUrls();
    }

    /**
     * @param $action
     * @param $vars
     * @return mixed|string
     * @deprecated
     */
    public function getUrl($action, $vars)
    {
        return RouteService::getUrl($action, $vars);
    }

    /**
     * @param $url
     * @return mixed|string
     * @deprecated
     */
    public function getFullUrlByUrl($url)
    {
        return RouteService::getFullUrlByUrl($url);
    }

    /**
     * @param $action
     * @param $vars
     * @return mixed|string
     * @deprecated
     */
    public function buildFullUrl($action, $vars)
    {
        return RouteService::buildFullUrl($action, $vars);
    }

    /**
     * @param $url
     * @param $fullUrl
     * @return bool
     * @deprecated
     */
    public function existsRoute($url, $fullUrl)
    {
        return RouteService::existsRoute($url, $fullUrl);
    }

    /**
     * @param $url
     * @param $action
     * @param $vars
     * @param $type
     * @param $listOrder
     * @return void
     * @deprecated
     */
    public function setRoute($url, $action, $vars, $type = 2, $listOrder = 10000)
    {
        RouteService::setRoute($url, $action, $vars, $type, $listOrder);
    }

    /**
     * @param $action
     * @param $vars
     * @return bool
     * @throws \Exception
     * @deprecated
     */
    public function deleteRoute($action, $vars)
    {
        return RouteService::deleteRoute($action, $vars);
    }
}
