提交 f1527bfc 编写于 作者: R root

url redirect部分的bug处理

上级 64f90955
......@@ -25,8 +25,8 @@ class Add {
if(Yii::$app->user->isGuest){
$url = Yii::$service->url->getCurrentUrl();
Yii::$service->customer->setLoginSuccessRedirectUrl($url);
Yii::$service->url->redirectByUrlKey('customer/account/login');
exit;
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
$identity = Yii::$app->user->identity;
......@@ -39,11 +39,11 @@ class Add {
$favoriteParam = Yii::$app->getModule('catalog')->params['favorite'];
# 跳转。
if(isset($favoriteParam['addSuccessRedirectFavoriteList']) && $favoriteParam['addSuccessRedirectFavoriteList']){
Yii::$service->url->redirectByUrlKey('customer/productfavorite');
return Yii::$service->url->redirectByUrlKey('customer/productfavorite');
}else{
$product = Yii::$service->product->getByPrimaryKey($product_id);
$urlKey = $product['url_key'];
Yii::$service->url->redirectByUrlKey($urlKey);
return Yii::$service->url->redirectByUrlKey($urlKey);
}
}
......
......@@ -21,7 +21,7 @@ class FavoriteproductController extends AppfrontController
# 增加收藏
public function actionAdd()
{
$data = $this->getBlock()->getLastData();
return $this->getBlock()->getLastData();
//return $this->render($this->action->id,$data);
}
......
......@@ -31,7 +31,7 @@ class ReviewproductController extends AppfrontController
Yii::$service->customer->setLoginSuccessRedirectUrl($currentUrl);
# 如果评论产品必须登录用户,则跳转到用户登录页面
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
$editForm = Yii::$app->request->post('editForm');
......
......@@ -31,7 +31,7 @@ class Index {
$cartInfo = Yii::$service->cart->getCartInfo();
if(!isset($cartInfo['products']) || !is_array($cartInfo['products']) || empty($cartInfo['products'])){
Yii::$service->url->redirectByUrlKey('checkout/cart');
return Yii::$service->url->redirectByUrlKey('checkout/cart');
}
$currency_info = Yii::$service->page->currency->getCurrencyInfo();
$this->initAddress();
......@@ -549,4 +549,4 @@ class Index {
}
\ No newline at end of file
}
......@@ -38,8 +38,11 @@ class OnepageController extends AppfrontController
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
if(is_array($data) && !empty($data) ){
return $this->render($this->action->id,$data);
}else{
return $data;
}
}
......
......@@ -53,11 +53,7 @@ class Login {
}
}
Yii::$service->page->message->addByHelperErrors();
if(!Yii::$app->user->isGuest){
//Yii::$service->url->redirectByUrlKey('customer/account');
Yii::$service->customer->loginSuccessRedirect('customer/account');
}
return;
}
/**
* 发送登录邮件
......@@ -70,4 +66,4 @@ class Login {
}
\ No newline at end of file
}
......@@ -221,7 +221,7 @@ class Edit {
$identity = Yii::$app->user->identity;
$arr['customer_id'] = $identity['id'];
Yii::$service->customer->address->save($arr);
Yii::$service->url->redirectByUrlKey('customer/address');
return Yii::$service->url->redirectByUrlKey('customer/address');
}
......@@ -230,4 +230,4 @@ class Edit {
}
\ No newline at end of file
}
......@@ -20,18 +20,18 @@ class Reorder {
public function getLastData(){
$order_id = Yii::$app->request->get('order_id');
if(!$order_id){
$this->errorMessage('The order id is empty');
return $this->errorMessage('The order id is empty');
}
$order = Yii::$service->order->getByPrimaryKey($order_id);
if(!$order['increment_id']){
$this->errorMessage('The order is not exist');
return $this->errorMessage('The order is not exist');
}
$customer_id = Yii::$app->user->identity->id;
if(!$order['customer_id'] || ($order['customer_id'] != $customer_id)){
$this->errorMessage('The order does not belong to you');
return $this->errorMessage('The order does not belong to you');
}
$this->addOrderProductToCart($order_id);
Yii::$service->url->redirectByUrlKey('checkout/cart');
return Yii::$service->url->redirectByUrlKey('checkout/cart');
}
public function addOrderProductToCart($order_id){
$items = Yii::$service->order->item->getByOrderId($order_id);
......@@ -55,10 +55,9 @@ class Reorder {
*/
public function errorMessage($message){
Yii::$service->page->message->addError($message);
Yii::$service->url->redirectByUrlKey('customer/order');
exit;
return Yii::$service->url->redirectByUrlKey('customer/order');
}
}
\ No newline at end of file
}
......@@ -51,6 +51,9 @@ class AccountController extends AppfrontController
$param = Yii::$app->request->post('editForm');
if(!empty($param) && is_array($param)){
$this->getBlock()->login($param);
if(!Yii::$app->user->isGuest){
return Yii::$service->customer->loginSuccessRedirect('customer/account');
}
}
$data = $this->getBlock()->getLastData($param);
return $this->render($this->action->id,$data);
......@@ -82,7 +85,7 @@ class AccountController extends AppfrontController
if(isset($params_register['loginSuccessRedirectUrlKey']) && $params_register['loginSuccessRedirectUrlKey'] ){
$urlKey = $params_register['loginSuccessRedirectUrlKey'];
}
Yii::$service->customer->loginSuccessRedirect($urlKey);
return Yii::$service->customer->loginSuccessRedirect($urlKey);
}
}
}
......
......@@ -22,7 +22,7 @@ class AddressController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class EditaccountController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class OrderController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......@@ -39,7 +39,7 @@ class OrderController extends AppfrontController
}
public function actionReorder(){
$this->getBlock()->getLastData();
return $this->getBlock()->getLastData();
//return $this->render($this->action->id,$data);
}
......
......@@ -21,7 +21,7 @@ class PointController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class ProductfavoriteController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class ProductreviewController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -56,7 +56,7 @@ class Review {
$cartInfo = Yii::$service->cart->getCartInfo();
if(!isset($cartInfo['products']) || !is_array($cartInfo['products']) || empty($cartInfo['products'])){
Yii::$service->url->redirectByUrlKey('checkout/cart');
return Yii::$service->url->redirectByUrlKey('checkout/cart');
}
$currency_info = Yii::$service->page->currency->getCurrencyInfo();
$this->initAddress();
......
......@@ -34,7 +34,12 @@ class ExpressController extends AppfrontController
}
}
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
if(is_array($data) && !empty($data) ){
return $this->render($this->action->id,$data);
}else{
return $data;
}
}
......
......@@ -26,7 +26,7 @@ class StandardController extends AppfrontController
if(is_array($data) && !empty($data)){
return $this->render($this->action->id,$data);
}else{
Yii::$service->url->redirectByUrlKey('checkout/onepage');
return Yii::$service->url->redirectByUrlKey('checkout/onepage');
}
}
......@@ -45,8 +45,7 @@ class StandardController extends AppfrontController
public function actionCancel(){
Yii::$service->order->cancel();
Yii::$service->url->redirectByUrlKey('checkout/onepage');
exit;
return Yii::$service->url->redirectByUrlKey('checkout/onepage');
}
public function actionTest(){
......
......@@ -25,8 +25,7 @@ class Add {
if(Yii::$app->user->isGuest){
$url = Yii::$service->url->getCurrentUrl();
Yii::$service->customer->setLoginSuccessRedirectUrl($url);
Yii::$service->url->redirectByUrlKey('customer/account/login');
exit;
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
$identity = Yii::$app->user->identity;
......@@ -39,11 +38,11 @@ class Add {
$favoriteParam = Yii::$app->getModule('catalog')->params['favorite'];
# 跳转。
if(isset($favoriteParam['addSuccessRedirectFavoriteList']) && $favoriteParam['addSuccessRedirectFavoriteList']){
Yii::$service->url->redirectByUrlKey('customer/productfavorite');
return Yii::$service->url->redirectByUrlKey('customer/productfavorite');
}else{
$product = Yii::$service->product->getByPrimaryKey($product_id);
$urlKey = $product['url_key'];
Yii::$service->url->redirectByUrlKey($urlKey);
return Yii::$service->url->redirectByUrlKey($urlKey);
}
}
......
......@@ -22,6 +22,7 @@ class FavoriteproductController extends AppfrontController
public function actionAdd()
{
$data = $this->getBlock()->getLastData();
return $data;
//return $this->render($this->action->id,$data);
}
......
......@@ -31,7 +31,7 @@ class ReviewproductController extends AppfrontController
Yii::$service->customer->setLoginSuccessRedirectUrl($currentUrl);
# 如果评论产品必须登录用户,则跳转到用户登录页面
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
$editForm = Yii::$app->request->post('editForm');
......
......@@ -31,7 +31,7 @@ class Index {
$cartInfo = Yii::$service->cart->getCartInfo();
if(!isset($cartInfo['products']) || !is_array($cartInfo['products']) || empty($cartInfo['products'])){
Yii::$service->url->redirectByUrlKey('checkout/cart');
return Yii::$service->url->redirectByUrlKey('checkout/cart');
}
$currency_info = Yii::$service->page->currency->getCurrencyInfo();
$this->initAddress();
......@@ -549,4 +549,4 @@ class Index {
}
\ No newline at end of file
}
......@@ -38,8 +38,11 @@ class OnepageController extends AppfrontController
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
if(is_array($data) && !empty($data) ){
return $this->render($this->action->id,$data);
}else{
return $data;
}
}
......
......@@ -53,11 +53,7 @@ class Login {
}
}
Yii::$service->page->message->addByHelperErrors();
if(!Yii::$app->user->isGuest){
//Yii::$service->url->redirectByUrlKey('customer/account');
Yii::$service->customer->loginSuccessRedirect('customer/account');
}
return;
}
/**
* 发送登录邮件
......@@ -70,4 +66,4 @@ class Login {
}
\ No newline at end of file
}
......@@ -221,7 +221,7 @@ class Edit {
$identity = Yii::$app->user->identity;
$arr['customer_id'] = $identity['id'];
Yii::$service->customer->address->save($arr);
Yii::$service->url->redirectByUrlKey('customer/address');
return Yii::$service->url->redirectByUrlKey('customer/address');
}
......@@ -230,4 +230,4 @@ class Edit {
}
\ No newline at end of file
}
......@@ -20,18 +20,18 @@ class Reorder {
public function getLastData(){
$order_id = Yii::$app->request->get('order_id');
if(!$order_id){
$this->errorMessage('The order id is empty');
return $this->errorMessage('The order id is empty');
}
$order = Yii::$service->order->getByPrimaryKey($order_id);
if(!$order['increment_id']){
$this->errorMessage('The order is not exist');
return $this->errorMessage('The order is not exist');
}
$customer_id = Yii::$app->user->identity->id;
if(!$order['customer_id'] || ($order['customer_id'] != $customer_id)){
$this->errorMessage('The order does not belong to you');
return $this->errorMessage('The order does not belong to you');
}
$this->addOrderProductToCart($order_id);
Yii::$service->url->redirectByUrlKey('checkout/cart');
return Yii::$service->url->redirectByUrlKey('checkout/cart');
}
public function addOrderProductToCart($order_id){
$items = Yii::$service->order->item->getByOrderId($order_id);
......@@ -55,10 +55,9 @@ class Reorder {
*/
public function errorMessage($message){
Yii::$service->page->message->addError($message);
Yii::$service->url->redirectByUrlKey('customer/order');
exit;
return Yii::$service->url->redirectByUrlKey('customer/order');
}
}
\ No newline at end of file
}
......@@ -37,7 +37,7 @@ class AccountController extends AppfrontController
/**
* 登录
*/
public function actionLogin()
public function actionLogin()
{
/**
$toEmail = 'zqy234@126.com';
......@@ -51,6 +51,9 @@ class AccountController extends AppfrontController
$param = Yii::$app->request->post('editForm');
if(!empty($param) && is_array($param)){
$this->getBlock()->login($param);
if(!Yii::$app->user->isGuest){
return Yii::$service->customer->loginSuccessRedirect('customer/account');
}
}
$data = $this->getBlock()->getLastData($param);
return $this->render($this->action->id,$data);
......@@ -82,7 +85,7 @@ class AccountController extends AppfrontController
if(isset($params_register['loginSuccessRedirectUrlKey']) && $params_register['loginSuccessRedirectUrlKey'] ){
$urlKey = $params_register['loginSuccessRedirectUrlKey'];
}
Yii::$service->customer->loginSuccessRedirect($urlKey);
return Yii::$service->customer->loginSuccessRedirect($urlKey);
}
}
}
......
......@@ -22,7 +22,7 @@ class AddressController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class EditaccountController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class OrderController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......@@ -39,7 +39,7 @@ class OrderController extends AppfrontController
}
public function actionReorder(){
$this->getBlock()->getLastData();
return $this->getBlock()->getLastData();
//return $this->render($this->action->id,$data);
}
......
......@@ -21,7 +21,7 @@ class PointController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class ProductfavoriteController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -21,7 +21,7 @@ class ProductreviewController extends AppfrontController
public function init(){
if(Yii::$app->user->isGuest){
Yii::$service->url->redirectByUrlKey('customer/account/login');
return Yii::$service->url->redirectByUrlKey('customer/account/login');
}
parent::init();
}
......
......@@ -56,7 +56,7 @@ class Review {
$cartInfo = Yii::$service->cart->getCartInfo();
if(!isset($cartInfo['products']) || !is_array($cartInfo['products']) || empty($cartInfo['products'])){
Yii::$service->url->redirectByUrlKey('checkout/cart');
return Yii::$service->url->redirectByUrlKey('checkout/cart');
}
$currency_info = Yii::$service->page->currency->getCurrencyInfo();
$this->initAddress();
......
......@@ -34,7 +34,11 @@ class ExpressController extends AppfrontController
}
}
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id,$data);
if(is_array($data) && !empty($data)){
return $this->render($this->action->id,$data);
}else{
return $data;
}
}
......
......@@ -26,7 +26,7 @@ class StandardController extends AppfrontController
if(is_array($data) && !empty($data)){
return $this->render($this->action->id,$data);
}else{
Yii::$service->url->redirectByUrlKey('checkout/onepage');
return Yii::$service->url->redirectByUrlKey('checkout/onepage');
}
}
......@@ -45,8 +45,7 @@ class StandardController extends AppfrontController
public function actionCancel(){
Yii::$service->order->cancel();
Yii::$service->url->redirectByUrlKey('checkout/onepage');
exit;
return Yii::$service->url->redirectByUrlKey('checkout/onepage');
}
public function actionTest(){
......
......@@ -288,10 +288,10 @@ class Customer extends Service
Yii::$app->session->remove($this::USER_LOGIN_SUCCESS_REDIRECT_URL_KEY);
//echo Yii::$app->session->get($this::USER_LOGIN_SUCCESS_REDIRECT_URL_KEY);
//exit;
Yii::$service->url->redirect($url);
return Yii::$service->url->redirect($url);
}else{
Yii::$service->url->redirectByUrlKey($urlKey);
return Yii::$service->url->redirectByUrlKey($urlKey);
}
}
/**
......@@ -394,4 +394,4 @@ class Customer extends Service
return $authnum;
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册