<?php
|
|
namespace app\operations\model\plus\live;
|
|
use app\common\model\plus\live\LiveProduct as LiveProductModel;
|
|
/**
|
* 房间模型
|
*/
|
class LiveProduct extends LiveProductModel
|
{
|
// 定义全局的查询范围
|
protected $globalScope = ['status'];
|
public function scopeStatus($query)
|
{
|
$shop_supplier_ids = \app\operations\model\supplier\Supplier::getSupplierIdsByUser(session('jjjshop_operations')['user']);
|
if (empty($shop_supplier_ids)){
|
$query->where($query->getTable() . '.shop_supplier_id', -1);
|
}else{
|
$query->where($query->getTable() . '.shop_supplier_id', 'in', $shop_supplier_ids);
|
}
|
}
|
/**
|
* 列表
|
*/
|
public function getList($params)
|
{
|
$model = $this;
|
if(isset($params['shop_supplier_id'])){
|
$model = $model->where('shop_supplier_id', '=', $params['shop_supplier_id']);
|
}
|
return $model->with(['product.image.file'])->order(['create_time' => 'asc'])
|
->paginate($params);
|
}
|
|
}
|