From 20d788e986bff605408d07368d6f8f184cc2c74d Mon Sep 17 00:00:00 2001
From: wangzhi <wangzhi@bronet.cn>
Date: Sat, 18 Jul 2020 15:49:22 +0800
Subject: [PATCH] 222

---
 application/api/controller/Index.php  | 20 ++++++++++++++++----
 application/common/controller/Api.php |  2 +-
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/application/api/controller/Index.php b/application/api/controller/Index.php
index 3e2c1b1..619bbc1 100644
--- a/application/api/controller/Index.php
+++ b/application/api/controller/Index.php
@@ -781,11 +781,23 @@ class Index extends Api
         foreach ($class_a as $k => $v) {
             $first_list[$k]['id']=$v['id'];
             $first_list[$k]['title']=$v['class'];
-            $second_lists[$k]=Db::name('class_con')->where(['class_ids'=>$v['id']])->select();
+            $second_lists[0]=Db::name('class_con')->where(['class_ids'=>$v['id']])->select();
+            foreach ($second_lists as $value) {
+                foreach ($value as $v2) {
+                    if(empty($v2['class_con'])){
+                        foreach ($value as $k4=>$v4){
+                            $value['class_con']=null;
+                        }
+                    }
+                }
+            }
             $list = $this->three_arr($second_lists);
-            $first_list[$k]['list']=$list;
-
+            foreach ($list as $k1=>$v1){
+                $list2[$k1]['id']=$v1['id'];
+                $list2[$k1]['title']=$v1['class_con'];
+            }
+            $first_list[$k]['list']=$list2;
         }
-        print_r($first_list);
+        $this->success('成功',$first_list);
     }
 }
\ No newline at end of file
diff --git a/application/common/controller/Api.php b/application/common/controller/Api.php
index b143145..6e96fdb 100644
--- a/application/common/controller/Api.php
+++ b/application/common/controller/Api.php
@@ -329,7 +329,7 @@ class Api
      */
     protected function is_token($token)
     {
-        if (empty($token['token'])) {
+        if (empty($token['Authorization'])) {
             $this->error('请登录后在操作');
         }
         $is_token = Db::name('user')->where(['token' => $token['token']])->find();
--
libgit2 0.24.0