44 lines
1.5 KiB
PHP
44 lines
1.5 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
namespace app\dao\syj;
|
|
|
|
use app\dao\BaseDao;
|
|
use app\model\syj\PromoteSettlement;
|
|
|
|
class PromoteSettlementDao extends BaseDao
|
|
{
|
|
protected function setModel(): string
|
|
{
|
|
return PromoteSettlement::class;
|
|
}
|
|
|
|
public function getUserList(int $uid, int $page, int $limit): array
|
|
{
|
|
$model = $this->getModel()->where('uid', $uid);
|
|
$count = (clone $model)->count();
|
|
$list = $model->order('add_time', 'desc')->page($page, $limit)->select()->toArray();
|
|
return compact('list', 'count');
|
|
}
|
|
|
|
public function getAdminList(array $where, int $page, int $limit): array
|
|
{
|
|
$model = $this->getModel()->alias('s')
|
|
->leftJoin('user u', 'u.uid = s.uid')
|
|
->leftJoin('syj_promote_task t', 't.id = s.task_id')
|
|
->field('s.*,t.task_no,u.nickname,u.phone');
|
|
if (isset($where['audit_status']) && $where['audit_status'] !== '') {
|
|
$model = $model->where('s.audit_status', (int)$where['audit_status']);
|
|
}
|
|
if (!empty($where['settle_type'])) {
|
|
$model = $model->where('s.settle_type', $where['settle_type']);
|
|
}
|
|
if (!empty($where['keyword'])) {
|
|
$model = $model->where('t.task_no|u.nickname|u.phone|u.uid', 'like', '%' . $where['keyword'] . '%');
|
|
}
|
|
$count = (clone $model)->count();
|
|
$list = $model->order('s.add_time', 'desc')->page($page, $limit)->select()->toArray();
|
|
return compact('list', 'count');
|
|
}
|
|
}
|