路由规则,新增短地址
parent
3ea0a67677
commit
9e4eacc73a
|
|
@ -4,4 +4,7 @@
|
||||||
*.log
|
*.log
|
||||||
*.lock
|
*.lock
|
||||||
.tea
|
.tea
|
||||||
.htaccess
|
.htaccess
|
||||||
|
route.php
|
||||||
|
*payment_*_respond.php
|
||||||
|
*payment_*_notify.php
|
||||||
|
|
@ -73,7 +73,7 @@ class Seo extends Common
|
||||||
*/
|
*/
|
||||||
public function Save()
|
public function Save()
|
||||||
{
|
{
|
||||||
return ConfigService::ConfigSave($_POST);
|
return ConfigService::ConfigSave(input());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
@ -74,6 +74,7 @@ return array(
|
||||||
'seo_url_model_list' => array(
|
'seo_url_model_list' => array(
|
||||||
0 => array('value' => 0, 'name' => '兼容模式', 'checked' => true),
|
0 => array('value' => 0, 'name' => '兼容模式', 'checked' => true),
|
||||||
1 => array('value' => 1, 'name' => 'PATHINFO模式'),
|
1 => array('value' => 1, 'name' => 'PATHINFO模式'),
|
||||||
|
2 => array('value' => 2, 'name' => 'PATHINFO模式+短地址'),
|
||||||
),
|
),
|
||||||
|
|
||||||
// 缓存类型列表
|
// 缓存类型列表
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,10 @@
|
||||||
{{/foreach}}
|
{{/foreach}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="am-form-group">
|
||||||
|
<label>{{$data.common_route_separator.name}}<span class="fs-12 fw-100 cr-999">({{$data.common_route_separator.describe}})</span></label>
|
||||||
|
<input type="text" name="{{$data.common_route_separator.only_tag}}" placeholder="{{$data.common_route_separator.name}}" data-validation-message="{{$data.common_route_separator.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.common_route_separator.value}}"{{/if}} />
|
||||||
|
</div>
|
||||||
<div class="am-form-group">
|
<div class="am-form-group">
|
||||||
<label>{{$data.home_seo_url_html_suffix.name}}<span class="fs-12 fw-100 cr-999">({{$data.home_seo_url_html_suffix.describe}})</span></label>
|
<label>{{$data.home_seo_url_html_suffix.name}}<span class="fs-12 fw-100 cr-999">({{$data.home_seo_url_html_suffix.describe}})</span></label>
|
||||||
<input type="text" name="{{$data.home_seo_url_html_suffix.only_tag}}" pattern="{{:lang('common_regex_url_html_suffix')}}" maxlength="8" placeholder="{{$data.home_seo_url_html_suffix.name}}" data-validation-message="{{$data.home_seo_url_html_suffix.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.home_seo_url_html_suffix.value}}"{{/if}} />
|
<input type="text" name="{{$data.home_seo_url_html_suffix.only_tag}}" pattern="{{:lang('common_regex_url_html_suffix')}}" maxlength="8" placeholder="{{$data.home_seo_url_html_suffix.name}}" data-validation-message="{{$data.home_seo_url_html_suffix.error_tips}}" class="am-radius" {{if !empty($data)}}value="{{$data.home_seo_url_html_suffix.value}}"{{/if}} />
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,8 @@ class Search extends Common
|
||||||
{
|
{
|
||||||
if(input('post.'))
|
if(input('post.'))
|
||||||
{
|
{
|
||||||
return redirect(MyUrl('index/search/index', ['keywords'=>$this->params['keywords']]));
|
$p = empty($this->params['keywords']) ? [] : ['keywords'=>$this->params['keywords']];
|
||||||
|
return redirect(MyUrl('index/search/index', $p));
|
||||||
} else {
|
} else {
|
||||||
// 品牌列表
|
// 品牌列表
|
||||||
$this->assign('brand_list', BrandService::CategoryBrandList(['category_id'=>$this->params['category_id']]));
|
$this->assign('brand_list', BrandService::CategoryBrandList(['category_id'=>$this->params['category_id']]));
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,24 @@
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="<?php if(is_writable(ROOT.'route')){ echo 'yes'; } else { echo 'am-danger'; } ?>">
|
||||||
|
<td>./route</td>
|
||||||
|
<td>可写</td>
|
||||||
|
<td>
|
||||||
|
<?php if (is_writable(ROOT.'route')): ?>
|
||||||
|
可写
|
||||||
|
<?php else: ?>
|
||||||
|
不可写
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if (is_writable(ROOT.'route')): ?>
|
||||||
|
√
|
||||||
|
<?php else: ?>
|
||||||
|
×
|
||||||
|
<?php endif ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr class="<?php if(is_writable(ROOT.'runtime')){ echo 'yes'; } else { echo 'am-danger'; } ?>">
|
<tr class="<?php if(is_writable(ROOT.'runtime')){ echo 'yes'; } else { echo 'am-danger'; } ?>">
|
||||||
<td>./runtime</td>
|
<td>./runtime</td>
|
||||||
<td>可写</td>
|
<td>可写</td>
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,13 @@ class ConfigService
|
||||||
// 配置信息更新
|
// 配置信息更新
|
||||||
self::ConfigInit(1);
|
self::ConfigInit(1);
|
||||||
|
|
||||||
|
// 是否需要更新路由规则
|
||||||
|
$ret = self::RouteSeparatorHandle($params);
|
||||||
|
if($ret['code'] != 0)
|
||||||
|
{
|
||||||
|
return $ret;
|
||||||
|
}
|
||||||
|
|
||||||
return DataReturn('编辑成功'.'['.$success.']');
|
return DataReturn('编辑成功'.'['.$success.']');
|
||||||
}
|
}
|
||||||
return DataReturn('编辑失败', -100);
|
return DataReturn('编辑失败', -100);
|
||||||
|
|
@ -132,5 +139,59 @@ class ConfigService
|
||||||
cache($key, $data);
|
cache($key, $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 路由规则处理
|
||||||
|
* @author Devil
|
||||||
|
* @blog http://gong.gg/
|
||||||
|
* @version 0.0.1
|
||||||
|
* @datetime 2017-01-02T23:08:19+0800
|
||||||
|
* @param [array] $params [输入参数]
|
||||||
|
*/
|
||||||
|
public static function RouteSeparatorHandle($params = [])
|
||||||
|
{
|
||||||
|
if(isset($params['home_seo_url_model']))
|
||||||
|
{
|
||||||
|
$route_file = ROOT.'route'.DS.'route.txt';
|
||||||
|
$route_file_php = ROOT.'route'.DS.'route.php';
|
||||||
|
|
||||||
|
// 文件目录
|
||||||
|
if(!is_writable(ROOT.'route'))
|
||||||
|
{
|
||||||
|
return DataReturn('路由目录没有操作权限'.'[./route]', -11);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 路配置文件权限
|
||||||
|
if(file_exists($route_file_php) && !is_writable($route_file_php))
|
||||||
|
{
|
||||||
|
return DataReturn('路由配置文件没有操作权限'.'[./route/route.php]', -11);
|
||||||
|
}
|
||||||
|
|
||||||
|
// pathinfo+短地址模式
|
||||||
|
if($params['home_seo_url_model'] == 2)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!file_exists($route_file))
|
||||||
|
{
|
||||||
|
return DataReturn('路由规则文件不存在'.'[./route/route.txt]', -14);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始生成规则文件
|
||||||
|
if(file_put_contents($route_file_php, file_get_contents($route_file)) === false)
|
||||||
|
{
|
||||||
|
return DataReturn('路由规则文件生成失败', -10);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 兼容模式+pathinfo模式
|
||||||
|
} else {
|
||||||
|
if(file_exists($route_file_php) && @unlink($route_file_php) === false)
|
||||||
|
{
|
||||||
|
return DataReturn('路由规则处理失败', -10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DataReturn('处理成功', 0);
|
||||||
|
}
|
||||||
|
return DataReturn('无需处理', 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -109,7 +109,7 @@ color: #F5F5F2;font-size: 14px;cursor:pointer;border-radius:0px 0px; position: a
|
||||||
|
|
||||||
/* 顶部小导航 */
|
/* 顶部小导航 */
|
||||||
.header-top { background-color: #fafafa; border-bottom: solid 1px #f0f0f0; }
|
.header-top { background-color: #fafafa; border-bottom: solid 1px #f0f0f0; }
|
||||||
.header{ display:none; max-width:1000px; margin:0px auto; font-size:12px;position: relative; overflow: hidden; }
|
.header{ display:none; max-width:1000px; margin:0px auto; font-size:12px;position: relative; }
|
||||||
|
|
||||||
.am-footer { border-top: 2px solid #d2364c; }
|
.am-footer { border-top: 2px solid #d2364c; }
|
||||||
.footer-bd{ display:none}
|
.footer-bd{ display:none}
|
||||||
|
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
<?php
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
// | Author: Devil
|
|
||||||
// +----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// 首页
|
|
||||||
// Route::get('/', 'index/index');
|
|
||||||
|
|
||||||
// // 商品详情
|
|
||||||
// Route::get('goods-:id', 'index/goods/index');
|
|
||||||
|
|
||||||
// // 搜索
|
|
||||||
// Route::get('search-:category_id', 'index/search/index');
|
|
||||||
?>
|
|
||||||
|
|
@ -0,0 +1,83 @@
|
||||||
|
<?php
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | Author: Devil
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
// | 路由规则
|
||||||
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// 分隔符
|
||||||
|
$ds = MyC('common_route_separator', '-', true);
|
||||||
|
|
||||||
|
// 首页
|
||||||
|
Route::get('/', 'index/index');
|
||||||
|
|
||||||
|
// 商品详情
|
||||||
|
Route::get('goods'.$ds.':id', 'index/goods/index');
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
Route::get('search'.$ds.'c'.$ds.':category_id', 'index/search/index');
|
||||||
|
Route::get('search'.$ds.'k'.$ds.':keywords', 'index/search/index');
|
||||||
|
Route::rule('search', 'index/search/index', 'GET|POST');
|
||||||
|
|
||||||
|
// 分类
|
||||||
|
Route::get('category', 'index/category/index');
|
||||||
|
|
||||||
|
// 购物车
|
||||||
|
Route::get('cart', 'index/cart/index');
|
||||||
|
|
||||||
|
// 订单确认
|
||||||
|
Route::rule('buy', 'index/buy/index', 'GET|POST');
|
||||||
|
|
||||||
|
// 文章
|
||||||
|
Route::get('article'.$ds.':id', 'index/article/index');
|
||||||
|
|
||||||
|
// 用户
|
||||||
|
Route::get('user', 'index/user/index');
|
||||||
|
Route::get('login', 'index/user/logininfo');
|
||||||
|
Route::get('login'.$ds.'modal', 'index/user/modallogininfo');
|
||||||
|
Route::get('reg', 'index/user/reginfo');
|
||||||
|
Route::get('reg'.$ds.'sms', 'index/user/smsreginfo');
|
||||||
|
Route::get('reg'.$ds.'email', 'index/user/emailreginfo');
|
||||||
|
Route::get('forget', 'index/user/forgetpwdinfo');
|
||||||
|
Route::get('logout', 'index/user/logout');
|
||||||
|
|
||||||
|
// 用户消息
|
||||||
|
Route::rule('user'.$ds.'message', 'index/message/index', 'GET|POST');
|
||||||
|
|
||||||
|
// 用户积分
|
||||||
|
Route::rule('user'.$ds.'integral', 'index/userintegral/index', 'GET|POST');
|
||||||
|
|
||||||
|
// 我的足迹
|
||||||
|
Route::rule('user'.$ds.'goods'.$ds.'browse', 'index/usergoodsbrowse/index', 'GET|POST');
|
||||||
|
|
||||||
|
// 用户资料
|
||||||
|
Route::get('user'.$ds.'personal', 'index/personal/index');
|
||||||
|
Route::get('user'.$ds.'personal'.$ds.'save', 'index/personal/saveinfo');
|
||||||
|
|
||||||
|
// 用户地址
|
||||||
|
Route::get('user'.$ds.'address', 'index/useraddress/index');
|
||||||
|
|
||||||
|
// 用户安全
|
||||||
|
Route::get('user'.$ds.'safety', 'index/safety/index');
|
||||||
|
Route::get('user'.$ds.'safety'.$ds.'login', 'index/safety/loginpwdinfo');
|
||||||
|
Route::get('user'.$ds.'safety'.$ds.'mobile', 'index/safety/mobileinfo');
|
||||||
|
Route::get('user'.$ds.'safety'.$ds.'new'.$ds.'mobile', 'index/safety/newmobileinfo');
|
||||||
|
Route::get('user'.$ds.'safety'.$ds.'email', 'index/safety/emailinfo');
|
||||||
|
Route::get('user'.$ds.'safety'.$ds.'new'.$ds.'email', 'index/safety/newemailinfo');
|
||||||
|
|
||||||
|
// 用户订单
|
||||||
|
Route::rule('user'.$ds.'order', 'index/order/index', 'GET|POST');
|
||||||
|
Route::get('user'.$ds.'order'.$ds.'detail'.$ds.':id', 'index/order/detail');
|
||||||
|
Route::get('user'.$ds.'order'.$ds.'comments'.$ds.':id', 'index/order/comments');
|
||||||
|
|
||||||
|
// 用户收藏/商品
|
||||||
|
Route::rule('user'.$ds.'favor'.$ds.'goods', 'index/userfavor/goods', 'GET|POST');
|
||||||
|
?>
|
||||||
Loading…
Reference in New Issue