ZxcZxc123 2 years ago
parent
commit
30ed0fdbeb

+ 33 - 0
app/api/controller/Education.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace app\api\controller;
+
+use Alipay\EasySDK\Kernel\Base;
+use think\facade\Db;
+
+class Education extends Base
+{
+    /**
+     * 课程列表页面
+     * @return \think\response\Json
+     */
+    public function index()
+    {
+        $EducationModel = new \app\model\api\Education();
+        $where["audit"] = 1;
+        $type1 = input("type1", "");
+        if ($type1 !== "") {
+            $where["type1"] = $type1;
+        }
+        $grlist = $EducationModel->getEducationGrList($where, 20, "od asc,recommend desc,gr_id desc");
+
+        $recommendList = $EducationModel->getRecommendEducationGrList(9, "od asc,recommend desc,gr_id desc");
+
+        $result = [
+            'grlist' => $grlist,
+            'recommendList' => $recommendList,
+        ];
+        return json($result);
+    }
+
+}

+ 0 - 43
app/api/controller/Pub.php

@@ -370,49 +370,6 @@ class Pub extends BaseController
     }
 
 
-    /**
-     * 课程列表页面
-     */
-//    public function index()
-//    {
-//        $userInfo = Db::name("document_user")->where('gr_id', $this->$gr_id)->find();
-//
-//        $EducationModel = new Education();
-//        $where["audit"] = 1;
-//        $type1 = input("type1", "");
-//        if ($type1 !== "") {
-//            $where["type1"] = $type1;
-//        }
-//        $grlist = $EducationModel->getEducationGrList($where, 20, "od asc,recommend desc,gr_id desc");
-//
-//        $recommendList = $EducationModel->getRecommendEducationGrList(9, "od asc,recommend desc,gr_id desc");
-//
-//        $result = [
-//            'userInfo' => $userInfo,
-//            'grlist' => $grlist,
-//            'recommendList' => $recommendList,
-//        ];
-//        return json($result);
-//    }
-    public function index()
-    {
-        $EducationModel = new Education();
-        $where["audit"] = 1;
-        $type1 = input("type1", "");
-        if ($type1 !== "") {
-            $where["type1"] = $type1;
-        }
-        $grlist = $EducationModel->getEducationGrList($where, 20, "od asc,recommend desc,gr_id desc");
-
-        $recommendList = $EducationModel->getRecommendEducationGrList(9, "od asc,recommend desc,gr_id desc");
-
-        $result = [
-            'grlist' => $grlist,
-            'recommendList' => $recommendList,
-        ];
-        return json($result);
-    }
-
     
     /**
      * bug提交

+ 30 - 0
app/api/route/education.php

@@ -0,0 +1,30 @@
+<?php
+// +----------------------------------------------------------------------
+// | [ WE CAN DO IT MORE SIMPLE  ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2018-2020 rights reserved.
+// +----------------------------------------------------------------------
+// | Author: TABLE ME
+// +----------------------------------------------------------------------
+// | Date: 2020-09-05 09:21
+// +----------------------------------------------------------------------
+
+use app\api\middleware\AllowOriginMiddleware;
+use app\api\middleware\SeretKeyMiddleware;
+use think\facade\Route;
+
+Route::group('Education', function () {
+    //课程列表页面
+    Route::rule('index','Education/index');
+
+
+
+    //bug提交
+    Route::rule('appBugSub', 'Pub/appBugSub');
+    //接口测试
+    Route::rule('appTest', 'Pub/appTest');
+
+})->middleware([
+    AllowOriginMiddleware::class,
+    SeretKeyMiddleware::class
+]);

+ 1 - 1
app/model/api/Education.php

@@ -25,7 +25,7 @@ class Education extends model
     // 获取课程总数和播放总数
     public function getCourseCount($grId)
     {
-        $count = $this->table('education_course')->where(['gr_id' => $grId, 'course_status' => 1, 'course_audit' => 1])->field('count(*) as count, sum(course_play_count) as alll')->find();
+        $count = $this->table('table_education_course')->where(['gr_id' => $grId, 'course_status' => 1, 'course_audit' => 1])->field('count(*) as count, sum(course_play_count) as alll')->find();
         return $count ?: ['count' => 0, 'alll' => 0];
     }