SpecialTask.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 app\wap\model\live\LiveStudio;
  13. use basic\ModelBasic;
  14. use traits\ModelTrait;
  15. class SpecialTask extends ModelBasic
  16. {
  17. use ModelTrait;
  18. public static function defaultWhere()
  19. {
  20. return self::where(['is_show'=>1,'is_del' => 0]);
  21. }
  22. public static function getTashCount($course_id)
  23. {
  24. return self::where(['coures_id' => $course_id,'is_del' => 0, 'is_show' => 1])->count();
  25. }
  26. public static function getTashList($course_id)
  27. {
  28. $list = self::where(['is_show' => 1,'is_del' => 0, 'coures_id' => $course_id])->order('sort desc')->field('image,title,id,is_pay,is_del,is_show,play_count,live_id')->select();
  29. $list = count($list) ? $list->toArray() : [];
  30. foreach ($list as &$item) {
  31. $item['stream_name'] = '';
  32. $item['studio_pwd'] = '';
  33. if ($item['live_id']) {
  34. $liveInfo = LiveStudio::where('id', $item['live_id'])->field(['stream_name', 'studio_pwd'])->find();
  35. if ($liveInfo) {
  36. $item['stream_name'] = $liveInfo['stream_name'];
  37. $item['studio_pwd'] = $liveInfo['studio_pwd'];
  38. }
  39. }
  40. }
  41. return $list;
  42. }
  43. public static function getSpecialTaskOne($task_id) {
  44. if (!$task_id) {
  45. return false;
  46. }
  47. return self::where('is_del',0)->order('sort DESC')->field('id,special_id,title,is_del,detail,type,is_pay,image,abstract,sort,play_count,is_show,add_time,live_id')->find($task_id);
  48. }
  49. }