You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/application/merchant/model/live/LiveAudit.php

73 lines
2.7 KiB

9 months ago
<?php
// +----------------------------------------------------------------------
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
// +----------------------------------------------------------------------
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
// +----------------------------------------------------------------------
namespace app\merchant\model\live;
/**
* 直播审核
*/
use basic\ModelBasic;
use traits\ModelTrait;
use app\merchant\model\live\LiveStudio;
class LiveAudit extends ModelBasic
{
use ModelTrait;
/**
* 获取连表MOdel
* @param $model
* @return object
*/
public static function getModelExamine($where = [])
{
$model = new self();
$model = $model->alias('p');
if (isset($where['store_name']) && $where['store_name'] != '') {
$model = $model->where('p.live_title|p.stream_name', 'LIKE', "%$where[store_name]%");
}
if (isset($where['mer_id']) && $where['mer_id']) {
$model = $model->where('p.mer_id', 'in', $where['mer_id']);
}
if (isset($where['institution_id']) && $where['institution_id']) {
$model = $model->where('p.institution_id', 'in', $where['institution_id']);
}
if (isset($where['order']) && $where['order'] != '') {
$model = $model->order(self::setOrder($where['order']));
} else {
$model = $model->order('p.add_time DESC');
}
$model = $model->join('LiveStudio l', 'p.live_id=l.id');
return $model;
}
/*
* 获取直播审核列表
* @param $where array
* @return array
*
*/
public static function liveExamineList($where)
{
$model = self::getModelExamine($where)->field('p.*');
$model = $model->page((int)$where['page'], (int)$where['limit']);
$data = ($data = $model->select()) && count($data) ? $data->toArray() : [];
foreach ($data as $key => &$volue) {
$volue['live_strar_time'] = date('Y-m-d H:i:s', $volue['live_strar_time']);
$volue['live_end_time'] = date('Y-m-d H:i:s', $volue['live_end_time']);
$volue['fail_time'] = date('Y-m-d H:i:s', $volue['fail_time']);
}
$count = self::getModelExamine($where)->count();
return compact('count', 'data');
}
}