8000 update 引用默认路径 && 表名过滤 · APIJSON/hyperf-APIJSON@9701daa · GitHub
[go: up one dir, main page]

Skip to content

Commit 9701daa

Browse files
committed
update 引用默认路径 && 表名过滤
1 parent 8113307 commit 9701daa

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/ApiJson/Parse/Parse.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ public function handle(bool $isQueryMany = false, array $extendData = []): array
5656
if (str_ends_with($tableName, '[]')) {
5757
$isQueryMany = true;
5858
}
59-
// if (!preg_match("/^[A-Za-z]+$/", $tableName) || !is_array($condition)) {
60-
// continue; //不满足表名规范 跳出不往下执行
61-
// }
59+
if (!preg_match("/^[A-Z].+/", $tableName) || !is_array($condition)) {
60+
continue; //不满足表名规范 跳出不往下执行
61+
}
6262
$this->tableEntities[$tableName] = new TableEntity($tableName, $this->json, $this->getGlobalArgs(), array_merge($result, $extendData));
6363
foreach ($this->supMethod as $methodClass) {
6464
/** @var AbstractMethod $method */
@@ -93,6 +93,9 @@ protected function handleArray(array $jsonData, array $extendData = []): array
9393
{
9494
$result = [[]];
9595
foreach ($jsonData as $tableName => $condition) { //可以优化成协程行为(如果没有依赖赋值的前提下)
96+
if (!preg_match("/^[A-Z].+/", $tableName) || !is_array($condition)) {
97+
continue; //不满足表名规范 跳出不往下执行
98+
}
9699
foreach ($result as $key => $item) {
97100
if (in_array($tableName, $this->filterKey())) {
98101
$this->tagColumn[$tableName] = $condition;

app/ApiJson/Replace/QuoteReplace.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ protected function process()
1313
}, ARRAY_FILTER_USE_KEY) as $key => $value)
1414
{
1515
$path = str_replace(['/', '[]'], ['.', 'currentItem'], $value);
16+
if (str_starts_with($path, '.')) {
17+
$path = 'currentItem' . $path;
18+
}
1619
$newKey = substr($key, 0, strlen($key) - 1);
1720
$condition[$newKey] = data_get($this->condition->getExtendData(), $path);
1821
unset($condition[$key]);

0 commit comments

Comments
 (0)
0