|
|
@@ -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]);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|