ソースを参照

分享积分fix

541469799@qq.com 1 年間 前
コミット
8239c65b66

+ 4 - 4
app/index/controller/Cart.php

@@ -36,8 +36,8 @@ class Cart extends Controller
     {
         $userId = Session::get('user_id');
         if (empty($userId)) {
-            Cache::set('returnuri','/index/cart/shoppingCart.html');
-            return redirect('/index/passport/login');
+            Cache::set('returnuri', '/index/cart/shoppingCart.html', 300);
+            return redirect('/index/passport/login.html');
             //return view('passport/logIn');
         }
 
@@ -140,12 +140,12 @@ class Cart extends Controller
      */
     public function add(int $goodsId, string $goodsSkuId, int $goodsNum): Json
     {
+        $key = $this->request->param('key', '');
         $userId = Session::get('user_id');
         if (empty($userId)) {
+            Cache::set('returnuri', '/index/index/productDetails.html?goodsId=' . $goodsId . '&key=' . $key, 300);
             return $this->renderJson(config('status.not_logged'), 'Log in please!');
         }
-
-        $key = $this->request->param('key', null);
         if (!empty($key)) {
             Cache::set(\app\index\model\User::SHARE_PREFIX . $userId, $key, 3600 * 24 * 30);
         }

+ 1 - 1
app/index/controller/Passport.php

@@ -75,7 +75,7 @@ class Passport extends Controller
     public function logout()
     {
         Session::clear();
-        return redirect('/index/passport/login');
+        return redirect('/index/passport/login.html');
         //return view('logIn');
     }
 

+ 4 - 1
app/index/controller/User.php

@@ -11,6 +11,7 @@ use app\index\model\user\PointsLog as PointsLogModel;
 use app\index\model\Goods as GoodsModel;
 use app\index\model\Order as OrderModel;
 use app\store\model\Express as ExpressModel;
+use think\facade\Cache;
 use think\facade\Log;
 use think\facade\Session;
 
@@ -44,6 +45,7 @@ class User extends Controller
     {
         $userId = Session::get('user_id');
         if (empty($userId)) {
+            Cache::set('returnuri', '/index/user/order.html', 300);
             return view('passport/logIn');
         }
         return view('order');
@@ -60,11 +62,12 @@ class User extends Controller
      */
     public function orderDetails($orderId)
     {
+        $orderId = intval($orderId);
         $userId = Session::get('user_id');
         if (empty($userId)) {
+            Cache::set('returnuri', '/index/user/orderDetails.html?orderId=' . $orderId, 300);
             return view('passport/logIn');
         }
-        $orderId = intval($orderId);
         $model = OrderModel::getUserOrderDetail($orderId);
         $orderAddress = OrderAddress::get(['order_id' => $orderId]);