12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- <?php
- /**
- * Created by PhpStorm.
- * User: lts
- * Date: 19/9/18
- * Time: 下午7:06
- */
- namespace app\common\constants;
- class Menu
- {
- const MENU_URL_PATH_RECENT = '/index/user/recent';
- const MENU_URL_PATH_KEEPREADING = '/index/user/keepReading';
- public static $allLinks = [
- 1 => [
- 'title' => '最近阅读',
- 'menu_url' => self::MENU_URL_PATH_RECENT,
- ],
- 2 => [
- 'title' => '男频分类',
- 'menu_url' => '/index/category?sex=1',
- ],
- 3 => [
- 'title' => '女频分类',
- 'menu_url' => '/index/category?sex=2',
- ],
- 4 => [
- 'title' => '首页',
- 'menu_url' => null,
- ],
- 5 => [
- 'title' => '个人中心',
- 'menu_url' => '/index/user/index',
- ],
- 6 => [
- 'title' => '充值',
- 'menu_url' => '/index/recharge/pay',
- ],
- 7 => [
- 'title' => '搜索',
- 'menu_url' => '/index/index/search',
- ],
- 8 => [
- 'title' => '签到',
- 'menu_url' => '/index/user/sign',
- ],
- 9 => [
- 'title' => '女频专区',
- 'menu_url' => '?type=girl',
- ],
- 10 => [
- 'title' => '男频专区',
- 'menu_url' => '?type=boy',
- ],
- 11 => [
- 'title' => '限免专区',
- 'menu_url' => '/index/book/list?type=free',
- ],
- ];
- /**
- * 判断相对路径是否为菜单链接
- * @param $pathQuery
- * @return bool
- */
- public static function pathQueryIsMenu($pathQuery)
- {
- foreach (self::$allLinks as $link) {
- if (empty($link['menu_url'])) {
- continue;
- }
- if (strpos($pathQuery, $link['menu_url']) !== false) {
- return true;
- }
- }
- return false;
- }
- }
|