| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\api\controller;
- use Alipay\EasySDK\Kernel\Base;
- use think\facade\Db;
- class Education
- {
- /**
- * 课程列表页面
- * @return \think\response\Json
- */
- public function index()
- {
- $EducationModel = new \app\model\api\Education();
- $where["audit"] = 1;
- $type1 = input("type1", "");
- if ($type1 !== "") {
- $where["type1"] = $type1;
- } else {
- $type1 = 2;
- }
- if ($type1 == 0) {
- $where["type1"] = 0;
- } elseif ($type1 == 1) {
- $where["type1"] = 1;
- }
- $page = input('page/d', 1);
- $pageSize = input('pageSize/d', 20);
- $grlist = $EducationModel->where($where)
- ->order("od asc,recommend desc,gr_id desc")
- ->paginate($pageSize, false, ['page' => $page]);
- $result = ['grlist' => $grlist->items(), 'total' => $grlist->total()];
- return app('json')->success($result);
- }
- /**
- * 获取轮播列表
- * @return mixed
- */
- public function recommend()
- {
- $EducationModel = new \app\model\api\Education();
- $where = [
- 'audit' => 1,
- 'recommend' => 1,
- ];
- $recommendList = $EducationModel->getEducationGrList($where, 9, "od asc,recommend desc,gr_id desc");
- $result = ['recommendList' => $recommendList];
- return app('json')->success($result);
- }
- }
|