From 2c2296db20768f27619c635cffa6abdae766f79e Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Mon, 25 Sep 2023 12:00:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=95=E8=AF=89=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lists/CompanyComplaintFeedbackLists.php | 159 +++++++++--------- 1 file changed, 83 insertions(+), 76 deletions(-) diff --git a/app/adminapi/lists/CompanyComplaintFeedbackLists.php b/app/adminapi/lists/CompanyComplaintFeedbackLists.php index 479d8ab86..e3a4c5f27 100644 --- a/app/adminapi/lists/CompanyComplaintFeedbackLists.php +++ b/app/adminapi/lists/CompanyComplaintFeedbackLists.php @@ -1,77 +1,84 @@ - ['company_id', 'content'], - ]; - } - - - /** - * @notes 获取列表 - * @return array - * @throws \think\db\exception\DataNotFoundException - * @throws \think\db\exception\DbException - * @throws \think\db\exception\ModelNotFoundException - * @author likeadmin - * @date 2023/09/23 15:14 - */ - public function lists(): array - { - return CompanyComplaintFeedback::where($this->searchWhere) - ->field(['id', 'company_id', 'content']) - ->limit($this->limitOffset, $this->limitLength) - ->order(['id' => 'desc']) - ->select() - ->toArray(); - } - - - /** - * @notes 获取数量 - * @return int - * @author likeadmin - * @date 2023/09/23 15:14 - */ - public function count(): int - { - return CompanyComplaintFeedback::where($this->searchWhere)->count(); - } - + ['company_id', 'content'], + + ]; + } + + + /** + * @notes 获取列表 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + * @author likeadmin + * @date 2023/09/23 15:14 + */ + public function lists(): array + { + return CompanyComplaintFeedback::where($this->searchWhere) + ->field(['id', 'company_id', 'content']) + ->append(['company_name'], true) + ->limit($this->limitOffset, $this->limitLength) + ->order(['id' => 'desc']) + ->withAttr('company_name', function ($value, $data) { + $company = Company::where('id', $data['company_id'])->find(); + return $company['company_name']; + }) + ->select() + ->toArray(); + } + + + /** + * @notes 获取数量 + * @return int + * @author likeadmin + * @date 2023/09/23 15:14 + */ + public function count(): int + { + return CompanyComplaintFeedback::where($this->searchWhere)->count(); + } + } \ No newline at end of file