From ec0700a6b62165939cdac5d29133f73dd956c7c2 Mon Sep 17 00:00:00 2001
From: ZF sun <34314687@qq.com>
Date: Thu, 18 Dec 2025 15:35:13 +0800
Subject: [PATCH] =?UTF-8?q?chore:=20=E5=AE=9E=E7=8E=B0=E6=9C=8D=E5=8A=A1?=
=?UTF-8?q?=E5=95=86=E7=9A=84=E6=9F=A5=E8=AF=A2=E4=B8=8E=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E5=AF=86=E7=A0=81=E7=9A=84=E5=85=B3=E8=81=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/application/admin/controller/Project.php | 4 +-
.../admin/template/project/password_add.htm | 35 +-
.../admin/template/project/password_index.htm | 40 +-
src/application/api/controller/Ajax.php | 173 +++---
src/template/pc/lists_service_query.htm | 558 +++++++++++-------
5 files changed, 509 insertions(+), 301 deletions(-)
diff --git a/src/application/admin/controller/Project.php b/src/application/admin/controller/Project.php
index f06c42f..2a67b3e 100644
--- a/src/application/admin/controller/Project.php
+++ b/src/application/admin/controller/Project.php
@@ -31,7 +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->projectQueryPasswordDb = Db::name('query_password'); // 查询密码表
// 是否开启支付功能设置
$this->userConfig = getUsersConfigData('all');
@@ -548,6 +548,8 @@ class Project extends Base {
'password' => trim($post['password']),
'allow_keywords' => trim($post['allow_keywords']),
'deny_keywords' => trim($post['deny_keywords']),
+ 'allow_servicer_keywords' => trim($post['allow_servicer_keywords']),
+ 'deny_servicer_keywords' => trim($post['deny_servicer_keywords']),
'status' => !empty($post['status']) ? 1 : 0,
'updatetime' => time()
];
diff --git a/src/application/admin/template/project/password_add.htm b/src/application/admin/template/project/password_add.htm
index db71602..f8bfbbe 100644
--- a/src/application/admin/template/project/password_add.htm
+++ b/src/application/admin/template/project/password_add.htm
@@ -17,7 +17,7 @@
- -
+ -
-
@@ -26,7 +26,7 @@
- -
+ -
-
@@ -34,21 +34,42 @@
+
+ -
+ -
+
+
+
在此输入允许查询的服务商名称包含的关键字,多个关键字用逗号分隔。留空表示允许查询所有服务商。
+
+
+
+
+ -
+ -
+
+
+
在此输入禁止查询的服务商名称包含的关键字,多个关键字用逗号分隔。留空表示不禁止任何服务商查询。
+
+
+
规则说明:
-
1. 当"允许查询"为空时:可以查询所有应用
-
2. 当"允许查询"有内容时:只能查询应用名称包含这些关键字的应用
-
3. 当"禁止查询"有内容时:不能查询应用名称包含这些关键字的应用
+
1. 当"允许查询"为空时:可以查询所有应用或服务商
+
2. 当"允许查询"有内容时:只能查询应用或服务商名称包含这些关键字的记录
+
3. 当"禁止查询"有内容时:不能查询应用或服务商名称包含这些关键字的记录
4. 优先级:禁止查询 > 允许查询
+
5. 应用关键字和对应的服务商关键字分别独立生效
示例说明:
-
- 设置"允许查询"为"电商,金融,教育":只能查询应用名称包含这些关键字的应用
-
- 设置"禁止查询"为"测试,临时":不能查询应用名称包含这些关键字的应用
+
- 设置应用"允许查询"为"电商,金融,教育":只能查询应用名称包含这些关键字的应用
+
- 设置应用"禁止查询"为"测试,临时":不能查询应用名称包含这些关键字的应用
+
- 设置服务商"允许查询"为"华东,华南":只能查询服务商名称包含这些关键字的服务商
+
- 设置服务商"禁止查询"为"测试中心,临时":不能查询服务商名称包含这些关键字的服务商
- 同时设置:允许"正式,生产",禁止"测试":可以查询包含"正式"或"生产"关键字的应用,但排除包含"测试"关键字的应用
diff --git a/src/application/admin/template/project/password_index.htm b/src/application/admin/template/project/password_index.htm
index 7cd32bc..d1be2dd 100644
--- a/src/application/admin/template/project/password_index.htm
+++ b/src/application/admin/template/project/password_index.htm
@@ -59,21 +59,21 @@
查询密码
|
-
- 允许查询的关键字
+ |
+ 允许查询的应用关键字
|
-
- 禁止查询的关键字
+ |
+ 禁止查询的应用关键字
|
-
+ |
+ 允许查询的服务商关键字
+ |
+
+ 禁止查询的服务商关键字
+ |
+
状态
|
-
- 创建时间
- |
-
- 更新时间
- |
操作
|
@@ -97,13 +97,19 @@
{$vo.password}
|
-
+ |
{$vo.allow_keywords|default='所有'}
|
-
+ |
{$vo.deny_keywords|default='无'}
|
-
+ |
+ {$vo.allow_servicer_keywords|default='所有'}
+ |
+
+ {$vo.deny_servicer_keywords|default='无'}
+ |
+
{if condition="$vo.status eq 1"}
启用
@@ -112,12 +118,6 @@
{/if}
|
-
- {$vo.createtime|date='Y-m-d H:i:s',###}
- |
-
- {$vo.updatetime|date='Y-m-d H:i:s',###|default='无'}
- |
编辑
diff --git a/src/application/api/controller/Ajax.php b/src/application/api/controller/Ajax.php
index 5f3d7f2..06ca0ef 100644
--- a/src/application/api/controller/Ajax.php
+++ b/src/application/api/controller/Ajax.php
@@ -1138,14 +1138,46 @@ class Ajax extends Base
public function projectsearch()
{
$type = intval(input('type'));
- if ($type == 1) {//服务商
- $item = Db::name('service')->where(['name' => input('realname')])->find();
+ $password = input('password'); // 获取密码
- if ($item) {
- echo json_encode(array('code' => 1, 'msg' => '操作成功', 'img' => $item['qrcode']));
+ // 检查密码是否在数据库中且状态为启用
+ $password_check = Db::name('query_password')->where(['password' => $password, 'status' => 1])->find();
+ if (!$password_check) {
+ echo json_encode(array('code' => -1, 'msg' => '密码无效或无权限'));
+ exit;
+ }
+
+ // ------------------------------------------
+ // ---------------- 服务商查询 ----------------
+ // ------------------------------------------
+ if ($type == 1) {//服务商
+ $keyword = input('realname'); // 关键字
+ // 从查询密码中获得允许的服务商关键字和禁止的服务商关键字, 都转换成数组
+ // 处理空字符串情况,将其转换为空数组
+ $allow_keywords = trim($password_check['allow_servicer_keywords']) === '' ? [] : explode(',', $password_check['allow_servicer_keywords']);
+ $deny_keywords = trim($password_check['deny_servicer_keywords']) === '' ? [] : explode(',', $password_check['deny_servicer_keywords']);
+
+ if (!empty($allow_keywords) && !in_array($keyword, $allow_keywords)) {
+ echo json_encode(array('code' => -1, 'msg' => '您没有该关键词的查询权限,请联系数据安全管理员'));
+ exit;
+ } elseif (!empty($deny_keywords) && in_array($keyword, $deny_keywords)) {
+ echo json_encode(array('code' => -1, 'msg' => '您没有该关键词的查询权限,请联系数据安全管理员'));
+ exit;
+ }
+
+ // SQL 查询
+ $where = [];
+ $where['name'] = ['like', '%' . $keyword . '%'];
+ $item_list = Db::name('service')->where($where)->select();
+
+ if (!empty($item_list)) {
+ // 获得其他服务商的名称
+ $service_names = array_column($item_list, 'name');
+ $item_counts = count($item_list);
+ echo json_encode(array('code' => 1, 'msg' => '操作成功', 'img' => $item_list[0]['qrcode'], 'service_names' => $service_names, 'counts' => $item_counts, 'keyword' => $keyword));
} else {
echo json_encode(array('code' => 0, 'msg' => '不存在'));
- }
+ }
exit;
}
@@ -1154,79 +1186,72 @@ class Ajax extends Base
// ---------------- 项目/应用查询 ----------------
// ------------------------------------------
$keyword = input('keyword'); // 关键字
- $password = input('password'); // 获取密码
$matchType = input('match_type', 1); // 匹配类型,默认为完全匹配
- // 检查密码是否在数据库中
- $password_check = Db::name('project_query_password')->where(['password' => $password])->find();
- if (!$password_check) {
- echo json_encode(array('code' => -1, 'msg' => '密码无效或无权限'));
+ // 检查关键字与应用名称是否存在匹配
+ // 应用名称与关键字有几种匹配情况
+ // 1. 完全匹配
+ // 2. 包含匹配
+ // 3. 前缀匹配
+ // 4. 后缀匹配
+
+ // 根据匹配类型构建查询条件
+ $where = [];
+ switch ($matchType) {
+ case 1: // 完全匹配
+ $where['name'] = $keyword;
+ break;
+ case 2: // 包含匹配
+ $where['name'] = ['like', '%' . $keyword . '%'];
+ break;
+ case 3: // 前缀匹配
+ $where['name'] = ['like', $keyword . '%'];
+ break;
+ case 4: // 后缀匹配
+ $where['name'] = ['like', '%' . $keyword];
+ break;
+ default: // 默认完全匹配
+ $where['name'] = $keyword;
+ }
+
+ // 查询匹配的应用列表
+ // $item_list = Db::name('project')->where($where)->select();
+ $item_list = Db::name('project')->where($where)->select();
+ $count = count($item_list);
+
+ $infoArray = array('name' => $keyword, 'match_type' => $matchType, 'count' => $count);
+
+ // 如果匹配的应用列表为空
+ if (empty($item_list)) {
+ echo json_encode(array_merge(array('code' => -2, 'msg' => '项目/应用不存在,可以申请'), $infoArray));
+ exit;
+ }
+
+ // 从查询密码中获得允许的关键字和禁止的关键字, 都转换成数组
+ // 处理空字符串情况,将其转换为空数组
+ $allow_keywords = trim($password_check['allow_keywords']) === '' ? [] : explode(',', $password_check['allow_keywords']);
+ $deny_keywords = trim($password_check['deny_keywords']) === '' ? [] : explode(',', $password_check['deny_keywords']);
+
+ // 检查关键字是否在允许列表中,或者是否在禁止列表中
+ $find = true;
+ if (!empty($allow_keywords) && !in_array($keyword, $allow_keywords)) {
+ echo json_encode(array('code' => -1, 'msg' => '您没有该关键词的查询权限,请联系数据安全管理员'));
+ exit;
+ $find = false;
+ } elseif (!empty($deny_keywords) && in_array($keyword, $deny_keywords)) {
+ echo json_encode(array('code' => -1, 'msg' => '您没有该关键词的查询权限,请联系数据安全管理员'));
+ exit;
+ $find = false;
+ }
+
+ // 如果找到匹配的应用
+ if ($find) {
+ $item = $item_list[0];
+ echo json_encode(array_merge(array('code' => 1, 'msg' => '项目/应用存在', 'img' => $item['qrcode']), $infoArray));
exit;
} else {
- // 检查关键字与应用名称是否存在匹配
- // 应用名称与关键字有几种匹配情况
- // 1. 完全匹配
- // 2. 包含匹配
- // 3. 前缀匹配
- // 4. 后缀匹配
-
- // 根据匹配类型构建查询条件
- $where = [];
- switch ($matchType) {
- case 1: // 完全匹配
- $where['name'] = $keyword;
- break;
- case 2: // 包含匹配
- $where['name'] = ['like', '%' . $keyword . '%'];
- break;
- case 3: // 前缀匹配
- $where['name'] = ['like', $keyword . '%'];
- break;
- case 4: // 后缀匹配
- $where['name'] = ['like', '%' . $keyword];
- break;
- default: // 默认完全匹配
- $where['name'] = $keyword;
- }
-
- // 查询匹配的应用列表
- // $item_list = Db::name('project')->where($where)->select();
- $item_list = Db::name('project')->where($where)->select();
- $count = count($item_list);
-
- $infoArray = array('name' => $keyword, 'match_type' => $matchType, 'count' => $count);
-
- // 如果匹配的应用列表为空
- if (empty($item_list)) {
- echo json_encode(array_merge(array('code' => -2, 'msg' => '项目/应用不存在,可以申请'), $infoArray));
- exit;
- }
-
- // 从查询密码中获得允许的关键字和禁止的关键字, 都转换成数组
- // 处理空字符串情况,将其转换为空数组
- $allow_keywords = trim($password_check['allow_keywords']) === '' ? [] : explode(',', $password_check['allow_keywords']);
- $deny_keywords = trim($password_check['deny_keywords']) === '' ? [] : explode(',', $password_check['deny_keywords']);
-
- // 检查关键字是否在允许列表中,或者是否在禁止列表中
- $find = true;
- if (!empty($allow_keywords) && !in_array($keyword, $allow_keywords)) {
- // echo json_encode(array('code'=>-1,'msg'=>'关键字不在允许列表中'));exit;
- $find = false;
- } elseif (!empty($deny_keywords) && in_array($keyword, $deny_keywords)) {
- // echo json_encode(array('code'=>-1,'msg'=>'关键字在禁止列表中'));exit;
- $find = false;
- }
-
- // 如果找到匹配的应用
- if ($find) {
- $item = $item_list[0];
- echo json_encode(array_merge(array('code' => 1, 'msg' => '项目/应用存在', 'img' => $item['qrcode']), $infoArray));
- exit;
- } else {
- echo json_encode(array_merge(array('code' => -2, 'msg' => '项目/应用不存在,可以申请'), $infoArray));
- exit;
- }
-
+ echo json_encode(array_merge(array('code' => -2, 'msg' => '项目/应用不存在,可以申请'), $infoArray));
+ exit;
}
}
}
\ No newline at end of file
diff --git a/src/template/pc/lists_service_query.htm b/src/template/pc/lists_service_query.htm
index 2d9a211..34bc3f7 100644
--- a/src/template/pc/lists_service_query.htm
+++ b/src/template/pc/lists_service_query.htm
@@ -19,84 +19,276 @@
{eyou:static file="users/skin/js/global.js" /}
+
{eyou:include file="header.htm" /}
@@ -105,161 +297,129 @@
{eyou:include file="layui.htm" /}
|