|
|
@@ -367,6 +367,49 @@ class Pub extends BaseController
|
|
|
return app('json')->success(['list' => [$article], 'count' => 1]);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 课程列表页面
|
|
|
+ */
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ $userInfo = Db::name("document_user")->where('uid', $this->uid)->find();
|
|
|
+
|
|
|
+ $EducationModel = model('Education');
|
|
|
+ $where["audit"] = 1;
|
|
|
+ $type = input("type", "");
|
|
|
+ if ($type !== "") {
|
|
|
+ $where["type1"] = $type;
|
|
|
+ }
|
|
|
+ $grlist = Db::name("education_gr")->where($where)->limit(20)->order("od asc,recommend desc,gr_id desc")->select();
|
|
|
+ foreach ($grlist as $v) {
|
|
|
+ $count = Db::name("education_course")->where("course_status", 1)->where(["gr_id" => $v["gr_id"], "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;;
|
|
|
+ $ngrlist[] = $v;
|
|
|
+ }
|
|
|
+
|
|
|
+ $where["recommend"] = 1;
|
|
|
+ $recommendList = Db::name("education_gr")->where($where)->limit(9)->order("od asc,recommend desc,gr_id desc")->select();
|
|
|
+ $recommendListResult = array();
|
|
|
+ if (count($recommendList) > 0) {
|
|
|
+ foreach ($recommendList as $recommend) {
|
|
|
+ $recommendListResult[] = array(
|
|
|
+ "img" => $recommend["indeximg"],
|
|
|
+ "href" => url('kcz', array("gr_id" => $recommend["gr_id"]))
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = [
|
|
|
+ 'userInfo' => $userInfo,
|
|
|
+ 'grlist' => $ngrlist,
|
|
|
+ 'recommendList' => $recommendListResult,
|
|
|
+ ];
|
|
|
+ return json($result);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* bug提交
|