['contract_id', 'invoice_id'], '%like%' => ['create_user'] ]; } /** * @notes 获取财务管理--到账台账列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/03/25 14:46 */ public function lists(): array { return FinancialRefund::where($this->searchWhere) ->field(['id', 'contract_id', 'invoice_id', 'amount', 'date', 'remark', 'create_user', 'create_time']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($data) { $contract = MarketingContract::field('contract_name,contract_type,part_a,part_b')->where('id', $data['contract_id'])->findOrEmpty(); $invoice = FinancialInvoice::field('invoice_code,apply_amount')->where('id', $data['invoice_id'])->findOrEmpty(); $custom = MarketingCustom::field('name')->where('id', 'part_a')->findOrEmpty(); $data['contract_name'] = $contract['contract_name']; $data['contract_type'] = !$contract->isEmpty() ? $contract->contract_type_text : ''; $data['part_a'] = $custom['name']; $data['part_b'] = $contract['part_b']; $data['invoice_code'] = $invoice['invoice_code']; $data['apply_amount'] = $invoice['apply_amount']; }) ->toArray(); } /** * @notes 获取财务管理--到账台账数量 * @return int * @author likeadmin * @date 2024/03/25 14:46 */ public function count(): int { return FinancialRefund::where($this->searchWhere)->count(); } }