54 lines
1.9 KiB
PHP
54 lines
1.9 KiB
PHP
<?php
|
|
namespace app\common\dao\common;
|
|
|
|
|
|
use app\common\dao\BaseDao;
|
|
use app\common\model\common\PayRecord;
|
|
|
|
class PayRecordDao extends BaseDao{
|
|
|
|
protected function getModel(): string{
|
|
return PayRecord::class;
|
|
}
|
|
/**
|
|
* Common: 公共搜索查询
|
|
* Author: wu-hui
|
|
* Time: 2024/07/09 16:09
|
|
* @param array $params
|
|
* @return PayRecord
|
|
*/
|
|
public function searchList(array $params){
|
|
return (new PayRecord())
|
|
->when(isset($params['id']) && $params['id'] !== '',function($query) use ($params){
|
|
$query->where('id', (int)$params['id']);
|
|
})
|
|
->when(isset($params['uid']) && $params['uid'] !== '',function($query) use ($params){
|
|
$query->where('uid', (int)$params['uid']);
|
|
})
|
|
->when(isset($params['object_id']) && $params['object_id'] !== '',function($query) use ($params){
|
|
$query->where('object_id', (int)$params['object_id']);
|
|
})
|
|
->when(isset($params['pay_type']) && $params['pay_type'] !== '',function($query) use ($params){
|
|
if(is_array($params['pay_type'])) $query->whereIn('pay_type', (array)$params['pay_type']);
|
|
else $query->where('pay_type', (int)$params['pay_type']);
|
|
})
|
|
->when(isset($params['pay_status']) && $params['pay_status'] !== '',function($query) use ($params){
|
|
$query->where('pay_status', (int)$params['pay_status']);
|
|
})
|
|
->with([
|
|
'user' => function($query){
|
|
$query->field('uid,nickname,real_name,avatar,phone');
|
|
},
|
|
'agent' => function($query){
|
|
$query->field('id,uid,contact_name,contact_phone,agent_type')->append(['agent_type_text']);
|
|
},
|
|
])
|
|
->order('create_time DESC,id DESC');
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|