['contract_id', 'change_user'], ]; } /** * @notes 获取市场经营--合同信息--合同变更列表 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @author likeadmin * @date 2024/04/13 14:19 */ public function lists(): array { $params = $this->request->get(); $where = []; if (!empty($params['change_date'])) { $date = explode(',', $params['change_date']); $where[] = ['change_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]]; } return MarketingContractChange::withoutField('create_time,update_time,delete_time')->where($this->searchWhere)->where($where) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($data) { $contract = MarketingContract::field('contract_name,contract_type,business_nature,signed_amount')->where('id', $data['contract_id'])->findOrEmpty(); $data['contract_name'] = $contract?->contract_name; $data['contract_type'] = $contract?->contract_type_text; $data['business_nature'] = $contract?->business_nature_text; $data['signed_amount'] = $contract?->signed_amount; }) ->toArray(); } /** * @notes 获取市场经营--合同信息--合同变更数量 * @return int * @author likeadmin * @date 2024/04/13 14:19 */ public function count(): int { $params = $this->request->get(); $where = []; if (!empty($params['change_date'])) { $date = explode(',', $params['change_date']); $where[] = ['change_date', 'between', [strtotime($date[0] . ' 00:00:00'), strtotime($date[1] . ' 23:59:59')]]; } return MarketingContractChange::where($this->searchWhere)->where($where)->count(); } }