106 lines
2.9 KiB
PHP
106 lines
2.9 KiB
PHP
<?php
|
|
|
|
namespace app\common\repository;
|
|
|
|
use app\common\newmodel\SkitsVideoModel;
|
|
|
|
class SkitsVideoReposotpry extends SkitsVideoModel
|
|
{
|
|
/**
|
|
* 查询列表 function
|
|
*
|
|
* @author dotdotdot <6383846@qq.com>
|
|
* @date 2022-08-17
|
|
* @param array $fields
|
|
* @param integer $sid
|
|
* @param integer $page
|
|
* @param integer $limit
|
|
* @return array
|
|
*/
|
|
public function selectList(array $fields, int $sid, int $page, int $limit): array
|
|
{
|
|
return SkitsVideoModel::field($fields)->where(['sid' => $sid, 'status' => 1])->order('order', 'asc')->limit($page, $limit)->select()->toArray();
|
|
}
|
|
|
|
/**
|
|
* 查询列表 function
|
|
*
|
|
* @author dotdotdot <6383846@qq.com>
|
|
* @date 2022-08-17
|
|
* @param array $fields
|
|
* @param integer $sid
|
|
* @return integer
|
|
*/
|
|
public function selectListCount(array $fields, int $sid): int
|
|
{
|
|
return SkitsVideoModel::field($fields)->where(['sid' => $sid, 'status' => 1])->select()->count('id');
|
|
}
|
|
|
|
/**
|
|
* 根据Id和Sid查询 function
|
|
*
|
|
* @author dotdotdot <6383846@qq.com>
|
|
* @date 2022-08-17
|
|
* @param array $fields
|
|
* @param integer $id
|
|
* @param integer $sid
|
|
* @return array
|
|
*/
|
|
public function selectByIdAndSid(array $fields, int $id, int $sid): array
|
|
{
|
|
$object = SkitsVideoModel::field($fields)->where(['id' => $id, 'sid' => $sid, 'status' => 1])->find();
|
|
|
|
return empty($object) ? [] : $object->toArray();
|
|
}
|
|
|
|
/**
|
|
* 根据Sid查询 function
|
|
*
|
|
* @author dotdotdot <6383846@qq.com>
|
|
* @date 2022-08-17
|
|
* @param array $fields
|
|
* @param integer $sid
|
|
* @return array
|
|
*/
|
|
public function selectBySidOnOrderAsc(array $fields, int $sid): array
|
|
{
|
|
$object = SkitsVideoModel::field($fields)->where(['sid' => $sid, 'status' => 1])->order('order', 'asc')->find();
|
|
|
|
return empty($object) ? [] : $object->toArray();
|
|
}
|
|
|
|
/**
|
|
* 查询上一集ID function
|
|
*
|
|
* @author dotdotdot <6383846@qq.com>
|
|
* @date 2022-10-08
|
|
* @param array $fields
|
|
* @param integer $sid
|
|
* @param integer $order
|
|
* @return array
|
|
*/
|
|
public function selectBeforeBySidAndOrder(array $fields, int $sid, int $order)
|
|
{
|
|
$object = SkitsVideoModel::field($fields)->where(['sid' => ['=', $sid], 'order' => ['<', $order], 'status' => ['=', 1]])->find();
|
|
|
|
return empty($object) ? [] : $object->toArray();
|
|
}
|
|
|
|
/**
|
|
* 查询下一集ID function
|
|
*
|
|
* @author dotdotdot <6383846@qq.com>
|
|
* @date 2022-10-08
|
|
* @param array $fields
|
|
* @param integer $sid
|
|
* @param integer $order
|
|
* @return array
|
|
*/
|
|
public function selectAfterBySidAndOrder(array $fields, int $sid, int $order)
|
|
{
|
|
$object = SkitsVideoModel::field($fields)->where(['sid' => ['=', $sid], 'order' => ['>', $order], 'status' => ['=', 1]])->find();
|
|
|
|
return empty($object) ? [] : $object->toArray();
|
|
}
|
|
}
|