['bidding_decision_id', 'project_id', 'pay_type'], '%like%' => ['applier'] ]; } /** * @notes 获取列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2023/12/16 10:46 */ public function lists(): array { return BidSecurityApply::where($this->searchWhere) ->field('id,security_apply_code,project_id,bidding_decision_id,applier,refund_date,create_time') ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function($data){ $bidding_decision = BidBiddingDecision::field('code,margin_amount,bidding_time')->where('id',$data['bidding_decision_id'])->findOrEmpty(); $project = Project::field('custom_id,name,project_code')->where('id',$data['project_id'])->findOrEmpty(); $custom = Custom::field('name')->where('id',$project['custom_id'])->findOrEmpty(); $data['bidding_decision_cod'] = $bidding_decision['code']; $data['project_name'] = $project['name']; $data['project_code'] = $project['project_code']; $data['custom_name'] = $custom['name']; $data['bidding_time'] = $bidding_decision['bidding_time']; //保证金金额 $data['margin_amount'] = $bidding_decision['margin_amount']; //已退金额 $data['has_refund_amount'] = BidSecurityRefund::where('bid_security_apply_id',$data['id'])->sum('refund_amount'); //未退金额 $data['not_refund_amount'] = $data['margin_amount'] - $data['has_refund_amount']; return $data; }) ->toArray(); } /** * @notes 获取数量 * @return int * @author likeadmin * @date 2023/12/16 10:46 */ public function count(): int { return BidSecurityApply::where($this->searchWhere)->count(); } }