From 854e86b4450df0375cc143cfb6cc8bc0b270bbf1 Mon Sep 17 00:00:00 2001 From: qinzexin <“731344816@qq.com”> Date: Thu, 3 Apr 2025 15:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E6=96=B0=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/AdditionAndSubtractionRecords.php | 2 +- application/api/controller/backend/AuthGroup.php | 12 ++++++++++++ application/api/controller/backend/AuthRule.php | 14 +++++++++++++- .../api/controller/backend/AutomaticPublicity.php | 14 ++++++++++++++ application/api/controller/backend/BasicRating.php | 12 ++++++++++++ application/api/controller/backend/Evaluate.php | 12 ++++++++++++ .../api/controller/backend/EvaluationSchedule.php | 13 ++++++++++++- .../api/controller/backend/Evaluationlevel.php | 12 ++++++++++++ .../api/controller/backend/ExcelController.php | 12 ++++++++++++ .../api/controller/backend/Logrecording.php | 12 ++++++++++++ application/api/controller/backend/Mail.php | 13 ++++++++++++- application/api/controller/backend/Monthly.php | 12 ++++++++++++ application/api/controller/backend/PartyGroup.php | 12 ++++++++++++ application/api/controller/backend/PartyStyle.php | 12 ++++++++++++ application/api/controller/backend/Pdf.php | 12 ++++++++++++ .../api/controller/backend/PlusMinusScoring.php | 12 ++++++++++++ application/api/controller/backend/Politics.php | 12 ++++++++++++ .../api/controller/backend/PublicAnnouncement.php | 12 ++++++++++++ application/api/controller/backend/Quarter.php | 13 ++++++++++++- .../api/controller/backend/Questionnaire.php | 12 ++++++++++++ .../api/controller/backend/ScoringrecordDate.php | 12 ++++++++++++ .../api/controller/backend/Solicitopinions.php | 13 ++++++++++++- application/api/controller/backend/User.php | 13 +++++++++++++ application/api/controller/backend/UserGroup.php | 13 +++++++++++++ application/api/controller/backend/Year.php | 13 +++++++++++++ 25 files changed, 295 insertions(+), 6 deletions(-) diff --git a/application/api/controller/backend/AdditionAndSubtractionRecords.php b/application/api/controller/backend/AdditionAndSubtractionRecords.php index 1fa1937..a7ad69c 100644 --- a/application/api/controller/backend/AdditionAndSubtractionRecords.php +++ b/application/api/controller/backend/AdditionAndSubtractionRecords.php @@ -25,7 +25,7 @@ class AdditionAndSubtractionRecords extends Api } $user = Db::name('user')->where('token', $id)->find(); if(!$user){ - return $this->error('用户不存在'); + return $this->error('用户不存在','',99998); } $this->user_id = $user['id']; $this->auth_group = $user['auth_group_id']; diff --git a/application/api/controller/backend/AuthGroup.php b/application/api/controller/backend/AuthGroup.php index c66f857..3b9a413 100644 --- a/application/api/controller/backend/AuthGroup.php +++ b/application/api/controller/backend/AuthGroup.php @@ -13,6 +13,18 @@ class AuthGroup extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/AuthRule.php b/application/api/controller/backend/AuthRule.php index 4857dac..f9e7201 100644 --- a/application/api/controller/backend/AuthRule.php +++ b/application/api/controller/backend/AuthRule.php @@ -13,7 +13,19 @@ class AuthRule extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; - + + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 * diff --git a/application/api/controller/backend/AutomaticPublicity.php b/application/api/controller/backend/AutomaticPublicity.php index ef4e33a..e37f4ae 100644 --- a/application/api/controller/backend/AutomaticPublicity.php +++ b/application/api/controller/backend/AutomaticPublicity.php @@ -7,6 +7,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; use think\Db; + /** * 评价 */ @@ -14,6 +15,19 @@ class AutomaticPublicity extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function index (){ $lr_evaluation_schedule = Db::name('evaluation_schedule') diff --git a/application/api/controller/backend/BasicRating.php b/application/api/controller/backend/BasicRating.php index e45dac3..5a984e4 100644 --- a/application/api/controller/backend/BasicRating.php +++ b/application/api/controller/backend/BasicRating.php @@ -13,6 +13,18 @@ class BasicRating extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/Evaluate.php b/application/api/controller/backend/Evaluate.php index 7117e54..07e10ce 100644 --- a/application/api/controller/backend/Evaluate.php +++ b/application/api/controller/backend/Evaluate.php @@ -12,6 +12,18 @@ class Evaluate extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function index (){ $token = $this->request->header('Token'); diff --git a/application/api/controller/backend/EvaluationSchedule.php b/application/api/controller/backend/EvaluationSchedule.php index 65efc8f..6e47b11 100644 --- a/application/api/controller/backend/EvaluationSchedule.php +++ b/application/api/controller/backend/EvaluationSchedule.php @@ -13,7 +13,18 @@ class EvaluationSchedule extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; - + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 * diff --git a/application/api/controller/backend/Evaluationlevel.php b/application/api/controller/backend/Evaluationlevel.php index 312d723..6ecdc5c 100644 --- a/application/api/controller/backend/Evaluationlevel.php +++ b/application/api/controller/backend/Evaluationlevel.php @@ -17,6 +17,18 @@ class Evaluationlevel extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = '*'; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 列表 diff --git a/application/api/controller/backend/ExcelController.php b/application/api/controller/backend/ExcelController.php index f9d9ac2..05c2016 100644 --- a/application/api/controller/backend/ExcelController.php +++ b/application/api/controller/backend/ExcelController.php @@ -10,6 +10,18 @@ use think\Db; class ExcelController extends Api { protected $noNeedLogin = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function dailyexport() diff --git a/application/api/controller/backend/Logrecording.php b/application/api/controller/backend/Logrecording.php index f746a13..c90ac5c 100644 --- a/application/api/controller/backend/Logrecording.php +++ b/application/api/controller/backend/Logrecording.php @@ -17,6 +17,18 @@ class Logrecording extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = '*'; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public static function addLogrecordingData($user_id = 0, $content = null) { diff --git a/application/api/controller/backend/Mail.php b/application/api/controller/backend/Mail.php index 493fc97..e64b7f0 100644 --- a/application/api/controller/backend/Mail.php +++ b/application/api/controller/backend/Mail.php @@ -12,7 +12,18 @@ class Mail extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; - + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 * diff --git a/application/api/controller/backend/Monthly.php b/application/api/controller/backend/Monthly.php index f71dcde..fab783e 100644 --- a/application/api/controller/backend/Monthly.php +++ b/application/api/controller/backend/Monthly.php @@ -14,6 +14,18 @@ class Monthly extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function getEvaluation() { diff --git a/application/api/controller/backend/PartyGroup.php b/application/api/controller/backend/PartyGroup.php index e06bdaf..f9b9689 100644 --- a/application/api/controller/backend/PartyGroup.php +++ b/application/api/controller/backend/PartyGroup.php @@ -13,6 +13,18 @@ class PartyGroup extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/PartyStyle.php b/application/api/controller/backend/PartyStyle.php index 3d7e807..c15a72f 100644 --- a/application/api/controller/backend/PartyStyle.php +++ b/application/api/controller/backend/PartyStyle.php @@ -13,6 +13,18 @@ class PartyStyle extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/Pdf.php b/application/api/controller/backend/Pdf.php index 197b5bf..f6f22fe 100644 --- a/application/api/controller/backend/Pdf.php +++ b/application/api/controller/backend/Pdf.php @@ -15,6 +15,18 @@ class Pdf extends Api protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function exportPdf() { diff --git a/application/api/controller/backend/PlusMinusScoring.php b/application/api/controller/backend/PlusMinusScoring.php index 388ff4c..48c9d79 100644 --- a/application/api/controller/backend/PlusMinusScoring.php +++ b/application/api/controller/backend/PlusMinusScoring.php @@ -13,6 +13,18 @@ class PlusMinusScoring extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/Politics.php b/application/api/controller/backend/Politics.php index 450130a..96797a0 100644 --- a/application/api/controller/backend/Politics.php +++ b/application/api/controller/backend/Politics.php @@ -13,6 +13,18 @@ class Politics extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/PublicAnnouncement.php b/application/api/controller/backend/PublicAnnouncement.php index 31cd49b..b94011d 100644 --- a/application/api/controller/backend/PublicAnnouncement.php +++ b/application/api/controller/backend/PublicAnnouncement.php @@ -17,6 +17,18 @@ class PublicAnnouncement extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = '*'; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 用户列表 diff --git a/application/api/controller/backend/Quarter.php b/application/api/controller/backend/Quarter.php index 24cda66..e7d99fb 100644 --- a/application/api/controller/backend/Quarter.php +++ b/application/api/controller/backend/Quarter.php @@ -13,7 +13,18 @@ class Quarter extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; - + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function getEvaluation() { $id = $this->request->header('Token'); diff --git a/application/api/controller/backend/Questionnaire.php b/application/api/controller/backend/Questionnaire.php index f5c215c..0486cb2 100644 --- a/application/api/controller/backend/Questionnaire.php +++ b/application/api/controller/backend/Questionnaire.php @@ -26,6 +26,18 @@ class Questionnaire extends Api protected $noNeedRight = ['test2']; protected $dataLimit = 'personal'; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * diff --git a/application/api/controller/backend/ScoringrecordDate.php b/application/api/controller/backend/ScoringrecordDate.php index 90efd86..f8324b2 100644 --- a/application/api/controller/backend/ScoringrecordDate.php +++ b/application/api/controller/backend/ScoringrecordDate.php @@ -13,6 +13,18 @@ class ScoringrecordDate extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * Undocumented function diff --git a/application/api/controller/backend/Solicitopinions.php b/application/api/controller/backend/Solicitopinions.php index 3e43283..806ab67 100644 --- a/application/api/controller/backend/Solicitopinions.php +++ b/application/api/controller/backend/Solicitopinions.php @@ -13,7 +13,18 @@ class Solicitopinions extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; - + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 * diff --git a/application/api/controller/backend/User.php b/application/api/controller/backend/User.php index 06c0110..719b39e 100644 --- a/application/api/controller/backend/User.php +++ b/application/api/controller/backend/User.php @@ -18,6 +18,19 @@ class User extends Api protected $noNeedLogin = ['*']; protected $noNeedRight = '*'; + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } + public function getEvaluation() { $id = $this->request->header('Token'); diff --git a/application/api/controller/backend/UserGroup.php b/application/api/controller/backend/UserGroup.php index a34d88a..a847a4c 100644 --- a/application/api/controller/backend/UserGroup.php +++ b/application/api/controller/backend/UserGroup.php @@ -13,6 +13,19 @@ class UserGroup extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } /** * 首页 diff --git a/application/api/controller/backend/Year.php b/application/api/controller/backend/Year.php index 62e0c2f..7dc181a 100644 --- a/application/api/controller/backend/Year.php +++ b/application/api/controller/backend/Year.php @@ -13,6 +13,19 @@ class Year extends Api { protected $noNeedLogin = ['*']; protected $noNeedRight = ['*']; + + public function _initialize() + { + parent::_initialize(); + $id = $this->request->header('Token'); + if(!$id){ + return $this->error('缺少参数'); + } + $user = Db::name('user')->where('token', $id)->find(); + if(!$user){ + return $this->error('用户不存在','',99998); + } + } public function getEvaluation() {