Lecturer.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\wap\model\special;
  12. use basic\ModelBasic;
  13. use traits\ModelTrait;
  14. class Lecturer extends ModelBasic
  15. {
  16. use ModelTrait;
  17. /**讲师列表
  18. * @param int $page
  19. * @param int $limit
  20. * @return array
  21. */
  22. public static function getLecturer($page=1,$limit=10)
  23. {
  24. $data=self::where(['is_del'=>0,'is_show'=>1])->page((int)$page,(int)$limit)
  25. ->field('id,lecturer_name,lecturer_head,label,curriculum,explain,study,sort,is_show,is_del')
  26. ->order('sort DESC,id DESC')->select();
  27. $data=count($data) > 0 ? $data->toArray() : [];
  28. foreach ($data as $key=>&$value){
  29. $value['label'] =json_decode($value['label']);
  30. }
  31. return $data;
  32. }
  33. /**讲师详情
  34. * @param int $id
  35. */
  36. public static function details($id=0)
  37. {
  38. $details=self::where(['is_del'=>0,'is_show'=>1])->where('id',$id)->find();
  39. if($details){
  40. $details['label']=json_decode($details['label']);
  41. $details['introduction'] = htmlspecialchars_decode($details['introduction']);
  42. return $details;
  43. }else{
  44. return null;
  45. }
  46. }
  47. }