“zq” 2 weeks ago
parent
commit
5cfc73acba
1 changed files with 11 additions and 2 deletions
  1. 11 2
      app/Http/Controllers/AllExcelController.php

+ 11 - 2
app/Http/Controllers/AllExcelController.php

@@ -21,6 +21,9 @@ class AllExcelController extends Controller{
             ->where('code',$code)
             ->select('month','nickname','mobile','num','nun1','total','money','all_money','m_nickname','m_mobile','m_type')
             ->get();
+        if (!$data){
+            return '<script>alert("没有可查看的内容!")</script>';
+        }
         $arr=[];
         foreach ($data as $k=>$v){
 
@@ -34,8 +37,11 @@ class AllExcelController extends Controller{
             $re=\DB::table('banzui_copy1')
                 ->where('mobile',$data[0]->m_mobile)
                 ->select('money','remark')
-                ->first()->toArray();
-            $arr[]=array_values($re);
+                ->first();
+            if ($re){
+                $arr[]=array_values(json_decode(json_encode($re),true));
+            }
+
         }
         \DB::table('banzui')
             ->where('code',$code)
@@ -56,6 +62,9 @@ class AllExcelController extends Controller{
             ->where('code',$code)
             ->select('month','nickname','mobile','jz','jy','gy','qc','wz','all_money','m_nickname','m_mobile','m_type','price','money')
             ->get();
+        if (!$data){
+            return '<script>alert("没有可查看的内容!")</script>';
+        }
         $arr=[];
         foreach ($data as $k=>$v){