From befdd0dbb9b143235bff44535eb0f2620dc05087 Mon Sep 17 00:00:00 2001
From: ZF sun <34314687@qq.com>
Date: Thu, 18 Dec 2025 09:32:04 +0800
Subject: [PATCH] =?UTF-8?q?chore:=20=E8=B0=83=E6=95=B4=E5=AF=BC=E5=85=A5Ex?=
=?UTF-8?q?cel=EF=BC=8C=E6=97=A5=E6=9C=9F=E9=80=89=E6=8B=A9=E5=99=A8?=
=?UTF-8?q?=E7=9A=84=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/application/admin/controller/Project.php | 149 +++++++++++++++++-
.../admin/template/project/add.htm | 37 +++--
.../admin/template/project/users_index.htm | 36 +++--
3 files changed, 181 insertions(+), 41 deletions(-)
diff --git a/src/application/admin/controller/Project.php b/src/application/admin/controller/Project.php
index 193914c..f06c42f 100644
--- a/src/application/admin/controller/Project.php
+++ b/src/application/admin/controller/Project.php
@@ -31,6 +31,7 @@ class Project extends Base {
/*会员中心数据表*/
$this->project_db = Db::name('project'); //
$this->service_db = Db::name('service'); //
+ $this->projectQueryPasswordDb = Db::name('project_query_password'); // 查询密码表
// 是否开启支付功能设置
$this->userConfig = getUsersConfigData('all');
@@ -106,7 +107,6 @@ class Project extends Base {
// 添加表信息
$data = array(
'name' => $post['name'],
- 'pwd' => $post['pwd'],
'enterprise' => $post['enterprise'],
'filing' => $post['filing'],
'sid' =>$post['sid'],
@@ -400,19 +400,18 @@ class Project extends Base {
$rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE)[0];
// 确保行数据完整
- if (count($rowData) >= 6) {
+ if (count($rowData) >= 5) {
// 验证必要字段不为空
- if (empty(trim($rowData[0])) || empty(trim($rowData[1]))) {
+ if (empty(trim($rowData[0]))) {
continue; // 跳过必填字段为空的行
}
$data[] = [
'name' => trim($rowData[0]),
- 'pwd' => trim($rowData[1]),
- 'enterprise' => trim($rowData[2]),
- 'filing' => trim($rowData[3]),
- 'sid' => trim($rowData[4]),
- 'limitationdate' => trim($rowData[5]),
+ 'enterprise' => trim($rowData[1]),
+ 'filing' => trim($rowData[2]),
+ 'sid' => trim($rowData[3]),
+ 'limitationdate' => trim($rowData[4]),
'createtime' => getTime()
];
}
@@ -487,4 +486,138 @@ class Project extends Base {
imagedestroy($target);
echo '
';
}
+
+ // 查询密码列表
+ public function password_index()
+ {
+ $list = array();
+
+ $param = input('param.');
+ $condition = array();
+ // 应用搜索条件
+ foreach (['keywords'] as $key) {
+ if (isset($param[$key]) && $param[$key] !== '') {
+ if ($key == 'keywords') {
+ $condition['password'] = array('LIKE', "%{$param[$key]}%");
+ }
+ }
+ }
+
+ /**
+ * 数据查询
+ */
+ $count = $this->projectQueryPasswordDb->where($condition)->count();// 查询满足要求的总记录数
+ $Page = new Page($count, config('paginate.list_rows'));// 实例化分页类 传入总记录数和每页显示的记录数
+ $list = $this->projectQueryPasswordDb
+ ->where($condition)
+ ->order('id desc')
+ ->limit($Page->firstRow.','.$Page->listRows)
+ ->select();
+
+ $show = $Page->show();// 分页显示输出
+ $this->assign('page',$show);// 赋值分页输出
+ $this->assign('list',$list);// 赋值数据集
+ $this->assign('pager',$Page);// 赋值分页集
+
+ return $this->fetch('password_index');
+ }
+
+ // 新增/编辑查询密码
+ public function password_add()
+ {
+ $id = input('id/d', 0);
+
+ if ($id > 0) {
+ $info = $this->projectQueryPasswordDb->where(['id' => $id])->find();
+ if (empty($info)) {
+ $this->error('数据不存在');
+ }
+ $this->assign('info', $info);
+ }
+
+ if (IS_POST) {
+ $post = input('post.');
+
+ // 验证数据
+ if (empty($post['password'])) {
+ $this->error('查询密码不能为空');
+ }
+
+ // 准备数据
+ $data = [
+ 'password' => trim($post['password']),
+ 'allow_keywords' => trim($post['allow_keywords']),
+ 'deny_keywords' => trim($post['deny_keywords']),
+ 'status' => !empty($post['status']) ? 1 : 0,
+ 'updatetime' => time()
+ ];
+
+ if (empty($info)) {
+ // 新增
+ $data['createtime'] = time();
+ $result = $this->projectQueryPasswordDb->insert($data);
+ $msg = '新增';
+ } else {
+ // 编辑
+ $result = $this->projectQueryPasswordDb->where(['id' => $id])->update($data);
+ $msg = '编辑';
+ }
+
+ if ($result !== false) {
+ $this->success($msg . "成功", url('Project/password_index'));
+ } else {
+ $this->error($msg . "失败");
+ }
+ }
+
+ $this->assign('id', $id);
+ return $this->fetch('password_add');
+ }
+
+ // 删除查询密码
+ public function password_del()
+ {
+ $id = input('del_id/d', 0);
+ if (IS_AJAX_POST && !empty($id)) {
+ $result = $this->projectQueryPasswordDb->where(['id' => $id])->delete();
+ if ($result) {
+ $this->success('删除成功');
+ } else {
+ $this->error('删除失败');
+ }
+ }
+ $this->error('参数有误');
+ }
+
+ // 批量删除查询密码
+ public function password_batch_del()
+ {
+ $ids = input('del_id/a');
+ if (IS_AJAX_POST && !empty($ids)) {
+ $result = $this->projectQueryPasswordDb->where(['id' => ['IN', $ids]])->delete();
+ if ($result) {
+ $this->success('批量删除成功');
+ } else {
+ $this->error('批量删除失败');
+ }
+ }
+ $this->error('参数有误');
+ }
+
+ // 修改状态
+ public function password_change_status()
+ {
+ $id = input('id/d', 0);
+ $status = input('status/d', 0);
+
+ if (IS_AJAX_POST && !empty($id)) {
+ $result = $this->projectQueryPasswordDb->where(['id' => $id])->update(['status' => $status, 'updatetime' => time()]);
+ if ($result) {
+ $this->success('状态修改成功');
+ } else {
+ $this->error('状态修改失败');
+ }
+ }
+ $this->error('参数有误');
+ }
}
\ No newline at end of file
diff --git a/src/application/admin/template/project/add.htm b/src/application/admin/template/project/add.htm
index 00142ca..cb42418 100644
--- a/src/application/admin/template/project/add.htm
+++ b/src/application/admin/template/project/add.htm
@@ -8,24 +8,16 @@