LiveAudit.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\merchant\model\live;
  12. /**
  13. * 直播审核
  14. */
  15. use basic\ModelBasic;
  16. use traits\ModelTrait;
  17. use app\merchant\model\live\LiveStudio;
  18. class LiveAudit extends ModelBasic
  19. {
  20. use ModelTrait;
  21. /**
  22. * 获取连表MOdel
  23. * @param $model
  24. * @return object
  25. */
  26. public static function getModelExamine($where = [])
  27. {
  28. $model = new self();
  29. $model = $model->alias('p');
  30. if (isset($where['store_name']) && $where['store_name'] != '') {
  31. $model = $model->where('p.live_title|p.stream_name', 'LIKE', "%$where[store_name]%");
  32. }
  33. if (isset($where['mer_id']) && $where['mer_id']) {
  34. $model = $model->where('p.mer_id', $where['mer_id']);
  35. }
  36. if (isset($where['order']) && $where['order'] != '') {
  37. $model = $model->order(self::setOrder($where['order']));
  38. } else {
  39. $model = $model->order('p.add_time DESC');
  40. }
  41. $model = $model->join('LiveStudio l', 'p.live_id=l.id');
  42. return $model;
  43. }
  44. /*
  45. * 获取直播审核列表
  46. * @param $where array
  47. * @return array
  48. *
  49. */
  50. public static function liveExamineList($where)
  51. {
  52. $model = self::getModelExamine($where)->field('p.*');
  53. $model = $model->page((int)$where['page'], (int)$where['limit']);
  54. $data = ($data = $model->select()) && count($data) ? $data->toArray() : [];
  55. foreach ($data as $key => &$volue) {
  56. $volue['live_strar_time'] = date('Y-m-d H:i:s', $volue['live_strar_time']);
  57. $volue['live_end_time'] = date('Y-m-d H:i:s', $volue['live_end_time']);
  58. $volue['fail_time'] = date('Y-m-d H:i:s', $volue['fail_time']);
  59. }
  60. $count = self::getModelExamine($where)->count();
  61. return compact('count', 'data');
  62. }
  63. }