ZxcZxc123 %!s(int64=2) %!d(string=hai) anos
pai
achega
173effe777

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

@@ -3,8 +3,10 @@
 namespace app\api\controller;
 
 use Alipay\EasySDK\Kernel\Base;
+use app\model\api\EducationCourse;
 use think\facade\Db;
 
+
 class Education
 {
     /**
@@ -59,5 +61,36 @@ class Education
     }
 
 
+    /**
+     * 获取课程组列表
+     * @return mixed
+     */
+    public function getCourseList()
+    {
+        $where['audit'] = 1;
+        $type1 = input('type', '');
+        if ($type1 !== '') {
+            $where['type1'] = $type1;
+        }
+        $grlist = \app\model\api\Education::where($where)
+            ->limit(20)
+            ->order('od asc,recommend desc,gr_id desc')
+            ->select()
+            ->toArray();
+        foreach ($grlist as &$v) {
+            $count = EducationCourse::where('course_status', 1)
+                ->where('gr_id', $v['gr_id'])
+                ->where('course_audit', 1)
+                ->field('count(*) as count,sum(course_play_count) as alll')
+                ->find();
+            $v['count'] = $count['count'];
+            $count['alll'] += $v['times'];
+            $v['alll'] = $count['alll'] ? $count['alll'] : 0;
+        }
+        return app('json')->success(['data' => $grlist]);
+    }
+
+
+
 
 }

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

@@ -2,9 +2,9 @@
 
 namespace app\model\api;
 
-use think\model;
+use think\Model;
 
-class Education extends model
+class Education extends Model
 {
     protected $table = 'table_education_gr';
 
@@ -44,4 +44,4 @@ class Education extends model
         return $recommendListResult;
     }
 
-}
+}

+ 14 - 0
app/model/api/EducationCourse.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace app\model\api;
+
+use think\Model;
+
+class EducationCourse extends Model
+{
+    protected $table = 'table_education_course';
+
+
+
+
+}