Education.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. $grlist = $EducationModel->getEducationGrList($where, 20, "od asc,recommend desc,gr_id desc");
  27. $result = ['grlist' => $grlist,];
  28. return app('json')->success($result);
  29. }
  30. /**
  31. * 获取轮播列表
  32. * @return mixed
  33. */
  34. public function recommend()
  35. {
  36. $EducationModel = new \app\model\api\Education();
  37. $where = [
  38. 'audit' => 1,
  39. 'recommend' => 1,
  40. ];
  41. $recommendList = $EducationModel->getEducationGrList($where, 9, "od asc,recommend desc,gr_id desc");
  42. $result = ['recommendList' => $recommendList];
  43. return app('json')->success($result);
  44. }
  45. }