Education.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace app\api\controller;
  3. use Alipay\EasySDK\Kernel\Base;
  4. use think\facade\Db;
  5. class Education
  6. {
  7. /**
  8. * 课程列表页面
  9. * @return \think\response\Json
  10. */
  11. public function index()
  12. {
  13. $EducationModel = new \app\model\api\Education();
  14. $where["audit"] = 1;
  15. $type1 = input("type1", "");
  16. if ($type1 !== "") {
  17. $where["type1"] = $type1;
  18. } else {
  19. $type1 = 2;
  20. }
  21. if ($type1 == 0) {
  22. $where["type1"] = 0;
  23. } elseif ($type1 == 1) {
  24. $where["type1"] = 1;
  25. }
  26. $page = input('page/d', 1);
  27. $pageSize = input('pageSize/d', 20);
  28. $grlist = $EducationModel->where($where)
  29. ->order("od asc,recommend desc,gr_id desc")
  30. ->paginate($pageSize, false, ['page' => $page]);
  31. $result = ['grlist' => $grlist->items(), 'total' => $grlist->total()];
  32. return app('json')->success($result);
  33. }
  34. /**
  35. * 获取轮播列表
  36. * @return mixed
  37. */
  38. public function recommend()
  39. {
  40. $EducationModel = new \app\model\api\Education();
  41. $where = [
  42. 'audit' => 1,
  43. 'recommend' => 1,
  44. ];
  45. $recommendList = $EducationModel->getEducationGrList($where, 9, "od asc,recommend desc,gr_id desc");
  46. $result = ['recommendList' => $recommendList];
  47. return app('json')->success($result);
  48. }
  49. }