本文整理汇总了PHP中Core\Helper\Utility\Route::reRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::reRoute方法的具体用法?PHP Route::reRoute怎么用?PHP Route::reRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core\Helper\Utility\Route
的用法示例。
在下文中一共展示了Route::reRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
public function get($f3)
{
// 设置 order_refer 记录,记录在客户端
$orderRefer = array();
// 检查彩贝的记录
$caibeiRefer = $f3->get('SESSION[yiqifa_caibei_order_refer]');
if (!empty($caibeiRefer)) {
$orderRefer = $caibeiRefer;
unset($orderRefer['refer_host']);
// 去掉彩贝的 refer_host
}
// 清除彩贝记录
$f3->set('SESSION[yiqifa_caibei_order_refer]', null);
$orderRefer['utm_source'] = 'YIQIFACPS';
// 保存额外的 亿起发 参数
$validator = new Validator($_REQUEST);
$referParamArray = array();
$referParamArray['src'] = $validator->validate('src');
$referParamArray['cid'] = $validator->validate('cid');
$referParamArray['wi'] = $validator->validate('wi');
$referParamArray['channel'] = $validator->validate('channel');
$orderRefer['refer_param'] = json_encode($referParamArray);
//设置 cookie
ReferHelper::setOrderReferSpecific($f3, $orderRefer, YiqifaCpsPlugin::getOptionValue('yiqifacps_duration'));
// 页面跳转到商品
$url = $validator->validate('url');
$redirectUrl = empty($url) ? '/' : $url;
RouteHelper::reRoute($this, $redirectUrl);
return;
}
示例2: get
public function get($f3)
{
AuthHelper::removeAuthUser();
$f3->clear('SESSION');
$this->addFlashMessage('成功退出登陆');
// 返回首页
RouteHelper::reRoute($this, '/', false);
}
示例3: get
public function get($f3)
{
global $smarty;
// 首先做参数合法性验证
$validator = new Validator($f3->get('GET'));
$goods_id = $validator->required('商品id不能为空')->digits('商品id非法')->min(1, true, '商品id非法')->validate('goods_id');
if (!$this->validate($validator)) {
goto out_fail;
}
// 生成 smarty 的缓存 id
$smartyCacheId = 'Goods|' . $goods_id . '|View';
// 开启并设置 smarty 缓存时间
enableSmartyCache(true, MobileThemePlugin::getOptionValue('smarty_cache_time_goods_view'));
// 缓存页面
if ($smarty->isCached('goods_view.tpl', $smartyCacheId)) {
goto out_display;
}
// 查询商品信息
$goodsBasicService = new GoodsBasicService();
$goodsInfo = $goodsBasicService->loadGoodsById($goods_id);
// 商品不存在,退出
if ($goodsInfo->isEmpty() || !Utils::isTagExist(PluginHelper::SYSTEM_MOBILE, $goodsInfo['system_tag_list'])) {
$this->addFlashMessage('商品 [' . $goods_id . '] 不存在');
goto out_fail;
}
// 取商品推广信息设置
$goodsPromote = $goodsBasicService->loadGoodsPromoteByGoodsId($goods_id);
// 取商品图片集
$goodsGalleryArray = GoodsGalleryCache::getGoodsGallery($goods_id);
foreach ($goodsGalleryArray as &$galleryItem) {
$galleryItem['img_url'] = RouteHelper::makeImageUrl($galleryItem['img_url']);
$galleryItem['thumb_url'] = RouteHelper::makeImageUrl($galleryItem['thumb_url']);
}
unset($galleryItem);
// 设置商品页面的 SEO 信息
$smarty->assign('seo_title', $goodsInfo['seo_title'] . ',' . $f3->get('sysConfig[site_name]'));
$smarty->assign('seo_description', $goodsInfo['seo_description']);
$smarty->assign('seo_keywords', $goodsInfo['seo_keyword']);
// 给模板赋值
$smarty->assign('goodsInfo', $goodsInfo);
$smarty->assign('goodsPromote', $goodsPromote);
if (!Utils::isEmpty($goodsGalleryArray)) {
$smarty->assign('goodsGalleryArray', $goodsGalleryArray);
}
// 设置商品规格
if (!empty($goodsInfo['goods_spec'])) {
$goodsSpecService = new GoodsSpecService();
$goodsSpecService->initWithJson($goodsInfo['goods_spec']);
$smarty->assign('goodsSpec', $goodsSpecService->getGoodsSpecDataArray());
}
out_display:
$smarty->display('goods_view.tpl', $smartyCacheId);
return;
out_fail:
// 失败从这里返回
RouteHelper::reRoute($this, '/');
// 返回首页
}
示例4: get
public function get($f3)
{
AdminLog::logAdminOperate('user.logout', '用户退出', 'IP:' . $f3->get('IP'));
AuthHelper::removeAuthUser();
$f3->clear('SESSION');
$this->addFlashMessage('成功退出登陆');
// 刷新当前页面
RouteHelper::reRoute($this, '/', false);
}
示例5: beforeRoute
public function beforeRoute($f3)
{
parent::beforeRoute($f3);
// 用户没有登陆,让用户去登陆
if (!AuthHelper::isAuthUser()) {
// 如果已经记录了一个回跳 URL ,则不要再覆盖这个记录了
RouteHelper::reRoute($this, '/User/Login', !RouteHelper::hasRememberUrl());
}
}
示例6: post
public function post($f3)
{
// 权限检查
$this->requirePrivilege('manage_plugin_theme_configure');
// 保存数据
ShopThemePlugin::saveOptionValue('head_nav_json_data', json_encode($f3->get('POST[headNav]')));
// 清除 所有页面
$shopClear = new ShopClear();
$shopClear->clearAllCache();
$this->addFlashMessage('保存设置成功');
RouteHelper::reRoute($this, '/Theme/Shop/HeadNav');
}
示例7: beforeRoute
public function beforeRoute($f3)
{
global $smarty;
parent::beforeRoute($f3);
// 用户没有登陆,让用户去登陆
if (!AuthHelper::isAuthUser()) {
// 如果已经记录了一个回跳 URL ,则不要再覆盖这个记录了
RouteHelper::reRoute($this, '/User/Login', !RouteHelper::hasRememberUrl());
return;
}
//把认证用户放入到 smarty 中
$smarty->assign('authSupplierUser', AuthHelper::getAuthUser());
}
示例8: get
public function get($f3)
{
// 权限检查
$this->requirePrivilege('manage_goods_edit_edit_get');
global $smarty;
// 参数验证
$validator = new Validator($f3->get('GET'));
$goods_id = $validator->required('商品ID不能为空')->digits()->min(1)->validate('goods_id');
$smarty->display('goods_edit_linkgoods.tpl');
return;
out_fail:
RouteHelper::reRoute($this, '/Goods/Search');
}
示例9: post
public function post($f3)
{
global $smarty;
// 首先做参数合法性验证
$validator = new Validator($f3->get('POST'));
$input = array();
$input['phone'] = $validator->validate('phone');
$input['address'] = $validator->validate('address');
$input['oldpassword'] = $validator->validate('oldpassword');
$input['password'] = $validator->validate('password');
// 用户打算修改密码
if (!Utils::isBlank($input['password'])) {
$validator->required('必须提供旧密码才能修改密码')->validate('oldpassword');
}
// 提供的旧密码,但是新密码为空
if (!Utils::isBlank($input['oldpassword'])) {
$validator->required('新密码不能为空')->validate('password');
}
if (!$this->validate($validator)) {
goto out;
}
$authSupplierUser = AuthHelper::getAuthUser();
$supplierUserService = new SupplierUserService();
// 验证用户登陆
$supplierUser = $supplierUserService->loadSupplierById($authSupplierUser['suppliers_id']);
if ($supplierUser->isEmpty()) {
$this->addFlashMessage("非法登陆用户");
RouteHelper::reRoute($this, '/User/Logout', false);
}
// 用户打算修改密码,但是旧密码不对
if (!empty($input['password']) && !$supplierUserService->verifyPassword($authSupplierUser['suppliers_id'], $input['oldpassword'])) {
$this->addFlashMessage('旧密码不对');
goto out;
}
// 更新数据
unset($input['oldpassword']);
$supplierUserService->updateSupplier($supplierUser, $input);
// 记录用户的登陆信息
$supplierUserInfo = $supplierUser->toArray();
unset($supplierUserInfo['password']);
// 不要记录密码
AuthHelper::saveAuthUser($supplierUserInfo);
$this->addFlashMessage("修改资料成功");
$smarty->assign($supplierUserInfo);
out:
// 从这里出去
$smarty->display('my_profile.tpl');
}
示例10: post
public function post($f3)
{
global $smarty;
// 首先做参数合法性验证
$validator = new Validator($f3->get('POST'));
$input = array();
$input['oldpassword'] = $validator->validate('oldpassword');
$input['password'] = $validator->validate('password');
$input['email'] = $validator->validate('email');
$input['mobile_phone'] = $validator->digits('手机号格式不对')->validate('mobile_phone');
// 用户打算修改密码
if (!Utils::isBlank($input['password'])) {
$validator->required('必须提供旧密码才能修改密码')->validate('oldpassword');
}
// 提供的旧密码,但是新密码为空
if (!Utils::isBlank($input['oldpassword'])) {
$validator->required('新密码不能为空')->validate('password');
}
if (!$this->validate($validator)) {
goto out_fail;
}
$userInfo = AuthHelper::getAuthUser();
$userService = new UserService();
$user = $userService->loadUserById($userInfo['user_id']);
if (!$user) {
// 非法用户,应该让它自动登陆出去
$this->addFlashMessage('非法登陆用户');
RouteHelper::reRoute($this, '/User/Logout', false);
}
// 用户打算修改密码,但是旧密码不对
if (!empty($input['password']) && !$userService->verifyPassword($userInfo['user_id'], $input['oldpassword'])) {
$this->addFlashMessage('旧密码不对');
goto out_fail;
}
// 更新数据
unset($input['oldpassword']);
$userService->updateUser($user, $input);
// 更新认证记录
AuthHelper::removeAuthUser();
AuthHelper::saveAuthUser($user->toArray());
$this->addFlashMessage('资料更新成功');
RouteHelper::reRoute($this, '/My/Profile');
return;
// 这里正常返回
out_fail:
// 失败返回
$smarty->display('my_profile.tpl', 'post');
}
示例11: get
public function get($f3)
{
// 清除客户端所有数据
ClientData::clearClientData();
// 清除服务器端数据
AuthHelper::removeAuthUser();
$f3->clear('SESSION');
$this->addFlashMessage('成功退出登陆');
$backUrl = RouteHelper::getRefer();
if (Utils::isBlank($backUrl)) {
// 没有来路域名则返回首页
$backUrl = '/';
}
// 刷新当前页面
RouteHelper::reRoute($this, $backUrl, false);
}
示例12: clearArticleCacheById
public function clearArticleCacheById($f3)
{
// 权限检查
$this->requirePrivilege('manage_misc_cache');
// 参数验证
$validator = new Validator($f3->get('POST'));
$article_id = $validator->required('商品ID不能为空')->digits()->validate('article_id');
if (!$this->validate($validator)) {
goto out;
}
ClearHelper::clearArticleCacheById($article_id);
$this->addFlashMessage('商品[' . $article_id . ']页面清理成功');
out:
// 从这里退出
RouteHelper::reRoute($this, RouteHelper::getRefer(), false);
}
示例13: get
public function get($f3)
{
// 权限检查
$this->requirePrivilege('manage_goods_edit_edit_get');
// 参数验证
$validator = new Validator($f3->get('GET'));
$goods_id = $validator->required('商品ID不能为空')->digits()->min(1)->validate('goods_id');
if (!$this->validate($validator)) {
goto out;
}
// 清除商品缓存
ClearHelper::clearGoodsCacheById($goods_id);
$this->addFlashMessage('商品[' . $goods_id . '] 缓存清除成功');
out:
RouteHelper::reRoute($this, RouteHelper::getRefer(), false);
}
示例14: Edit
/**
* 更新或者新建一个快递公司
*
* @param $f3
*/
public function Edit($f3)
{
// 权限检查
$this->requirePrivilege('manage_misc_express_edit');
global $smarty;
// 参数验证
$validator = new Validator($f3->get('GET'));
$meta_id = $validator->digits()->validate('meta_id');
$meta_id = $meta_id ?: 0;
// 加载 快递信息
$expressService = new ExpressService();
$expressInfo = $expressService->loadMetaById($meta_id);
if (Request::isRequestGet()) {
goto out_assign;
}
// 安全性检查
if ($meta_id > 0) {
if ($expressInfo->isEmpty() || ExpressService::META_TYPE != $expressInfo->meta_type) {
$this->addFlashMessage('非法ID[' . $meta_id . ']');
goto out;
}
}
unset($validator);
$validator = new Validator($f3->get('POST'));
$inputArray = array();
$inputArray['meta_type'] = ExpressService::META_TYPE;
$inputArray['meta_name'] = $validator->required()->validate('meta_name');
$inputArray['meta_ename'] = $validator->required()->validate('meta_ename');
$inputArray['meta_sort_order'] = $validator->digits()->validate('meta_sort_order');
$inputArray['meta_status'] = $validator->digits()->validate('meta_status');
$inputArray['meta_desc'] = $validator->validate('meta_desc');
if (!$this->validate($validator)) {
goto out;
}
// 保存
$expressInfo->copyFrom($inputArray);
$expressInfo->save();
$this->addFlashMessage('快递信息保存成功');
// POST 成功从这里退出
RouteHelper::reRoute($this, RouteHelper::makeUrl('/Misc/Express/Edit', array('meta_id' => $expressInfo->meta_id), true));
return;
out_assign:
$smarty->assign($expressInfo->toArray());
out:
$smarty->display('misc_express_edit.tpl');
}
示例15: get
public function get($f3)
{
global $smarty;
// 参数验证
$validator = new Validator($f3->get('GET'));
$pageNo = $validator->digits()->min(0)->validate('pageNo');
$pageSize = $validator->digits()->min(0)->validate('pageSize');
// 设置缺省值
$pageNo = isset($pageNo) && $pageNo > 0 ? $pageNo : 0;
$pageSize = isset($pageSize) && $pageSize > 0 ? $pageSize : 10;
if (!$this->validate($validator)) {
goto out_display;
}
$userInfo = AuthHelper::getAuthUser();
// 构造查询条件
$searchFormQuery = array();
$searchFormQuery['oi.user_id'] = $userInfo['user_id'];
// 合并查询参数
$searchParamArray = array_merge(QueryBuilder::buildSearchParamArray($searchFormQuery), $this->searchExtraCondArray);
// 查询订单
$totalCount = SearchHelper::count(SearchHelper::Module_OrderGoodsOrderInfo, $searchParamArray);
if ($totalCount <= 0) {
// 没订单,可以直接退出了
goto out_display;
}
// 页数超过最大值,返回第一页
if ($pageNo * $pageSize >= $totalCount) {
RouteHelper::reRoute($this, '/My/Order');
}
// 订单排序
$orderByParam = array();
$orderByParam[] = array('og.rec_id', 'desc');
// 订单列表
$orderGoodsArray = SearchHelper::search(SearchHelper::Module_OrderGoodsOrderInfo, 'og.order_id, og.goods_id, og.goods_attr, og.goods_number, og.goods_price, og.shipping_fee' . ', og.create_time, og.order_goods_status, oi.order_sn, oi.pay_time', $searchParamArray, $orderByParam, $pageNo * $pageSize, $pageSize);
foreach ($orderGoodsArray as &$orderGoodsItem) {
$orderGoodsItem['order_goods_status_desc'] = OrderGoodsService::$orderGoodsStatusDesc[$orderGoodsItem['order_goods_status']];
}
unset($orderGoodsItem);
// 给模板赋值
$smarty->assign('totalCount', $totalCount);
$smarty->assign('pageNo', $pageNo);
$smarty->assign('pageSize', $pageSize);
$smarty->assign('orderGoodsArray', $orderGoodsArray);
out_display:
$smarty->display('my_order.tpl', 'get');
}