['project_id', 'contract_id', 'refund_type'], '%like%' => ['refund_user'] ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/14 16:58 */ public function lists(): array { $params = $this->request->get(['custom_id']); $where = []; if(isset($params['custom_id']) && $params['custom_id'] != ''){ $project_ids = Project::where('custom_id',$params['custom_id'])->column('id'); $where[] = ['project_id','in',$project_ids]; } return FinanceRefundApply::where($this->searchWhere)->where($where) ->field('id,refund_code,project_id,contract_id,refund_date,reason,amount,refund_type,refund_user,remark,collection_bank,collection_account,bank_account_id') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $contract = Contract::field('contract_name,contract_code')->where('id',$data['contract_id'])->findOrEmpty(); $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['custom_name'] = $custom['name']; $data['contract_name'] = $contract['contract_name']; $data['contract_code'] = $contract['contract_code']; $data['refund_type'] = $data->refund_type_text; $data['bank_account_info'] = BankAccount::field('account_sn,deposit_bank,account_name,account')->where('id',$data['bank_account_id'])->findOrEmpty(); return $data; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/14 16:58 */ public function count(): int { $params = $this->request->get(['custom_id']); $where = []; if(isset($params['custom_id']) && $params['custom_id'] != ''){ $project_ids = Project::where('custom_id',$params['custom_id'])->column('id'); $where[] = ['project_id','in',$project_ids]; } return FinanceRefundApply::where($this->searchWhere)->where($where)->count(); } }