|
@@ -8,7 +8,18 @@ class Education extends Model
|
|
|
{
|
|
{
|
|
|
protected $table = 'table_education_gr';
|
|
protected $table = 'table_education_gr';
|
|
|
|
|
|
|
|
- // 获取教育组列表
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取教育组列表
|
|
|
|
|
+ * @param array $where
|
|
|
|
|
+ * @param int $limit
|
|
|
|
|
+ * @param string $order
|
|
|
|
|
+ * @return \think\Collection
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ */
|
|
|
public function getEducationGrList($where = [], $limit = 20, $order = 'od asc,recommend desc,gr_id desc')
|
|
public function getEducationGrList($where = [], $limit = 20, $order = 'od asc,recommend desc,gr_id desc')
|
|
|
{
|
|
{
|
|
|
$query = $this->where($where)->limit($limit)->order($order);
|
|
$query = $this->where($where)->limit($limit)->order($order);
|
|
@@ -22,7 +33,15 @@ class Education extends Model
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- // 获取课程总数和播放总数
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取课程总数和播放量
|
|
|
|
|
+ * @param $grId
|
|
|
|
|
+ * @return array|int[]|Model
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ */
|
|
|
public function getCourseCount($grId)
|
|
public function getCourseCount($grId)
|
|
|
{
|
|
{
|
|
|
$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();
|
|
$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();
|
|
@@ -30,7 +49,17 @@ class Education extends Model
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
- // 获取推荐教育组列表
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取推荐教育组列表
|
|
|
|
|
+ * @param int $limit
|
|
|
|
|
+ * @param string $order
|
|
|
|
|
+ * @return array
|
|
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
+ */
|
|
|
public function getRecommendEducationGrList($limit = 9, $order = 'od asc,recommend desc,gr_id desc')
|
|
public function getRecommendEducationGrList($limit = 9, $order = 'od asc,recommend desc,gr_id desc')
|
|
|
{
|
|
{
|
|
|
$recommendList = $this->where(['recommend' => 1])->limit($limit)->order($order)->select();
|
|
$recommendList = $this->where(['recommend' => 1])->limit($limit)->order($order)->select();
|