541469799@qq.com 1 سال پیش
والد
کامیت
6da956bfc0
2فایلهای تغییر یافته به همراه7 افزوده شده و 3 حذف شده
  1. 2 2
      app/index/controller/Checkout.php
  2. 5 1
      app/index/view/cart/shoppingCart.html

+ 2 - 2
app/index/controller/Checkout.php

@@ -68,8 +68,8 @@ class Checkout extends Controller
     public function submit(string $mode = 'buyNow'): Json
     {
         $userId = Session::get('user_id');
-        if (empty($userId)){
-            return view('passport/login');
+        if (empty($userId)) {
+            return $this->renderJson(config('status.not_logged'), 'Log in please!');
         }
 
         return $this->order($mode);

+ 5 - 1
app/index/view/cart/shoppingCart.html

@@ -425,9 +425,13 @@
             console.log(params)
             const res = await orderPayment(params)
             console.log(res)
-            const {status, data} = res || {}
+            const {status, message, data} = res || {}
             if (status === 200 || status === "200") {
                 window.open(data.payment.approval_link, "_blank");
+            }else if (status === 401 || status === "401"){
+                window.location.replace('../passport/logIn.html')
+            }else {
+                showToast(message)
             }
         });