Skip to content

Commit

Permalink
update v5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
evoxwht committed Jun 27, 2024
1 parent 3cd421d commit 2415bb7
Show file tree
Hide file tree
Showing 1,671 changed files with 45,493 additions and 34,816 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@
/template/uni-app/node_modules/
/template/uni-app/unpackage/
/template/uni-app/.hbuilderx/

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ APP下载:https://app.crmeb.cn/bzv (苹果手机直接在APP Store里搜索CR

---



### 📲 核心功能

![输入图片说明](readme/pic/功能列表.jpg)
Expand Down
4 changes: 2 additions & 2 deletions crmeb/.version
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version=CRMEB-KY v5.3.0
version_code=530
version=CRMEB-KY v5.4.0
version_code=540
platform=github
app_id=ze7x9rxsv09l6pvsyo
app_key=fuF7U9zaybLa5gageVQzxtxQMFnvU2OI
73 changes: 22 additions & 51 deletions crmeb/app/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Request extends \think\Request
* @var array
*/
protected $except = ['menu_path', 'api_url', 'unique_auth',
'description', 'custom_form', 'content', 'tableField', 'url'];
'description', 'custom_form', 'content', 'tableField', 'url', 'customCode'];

/**
* 获取请求的数据
Expand All @@ -49,7 +49,7 @@ public function more(array $params, bool $suffix = false, bool $filter = true):
$i = 0;
foreach ($params as $param) {
if (!is_array($param)) {
$p[$suffix == true ? $i++ : $param] = $this->filterWord(is_string($this->param($param)) ? trim($this->param($param)) : $this->param($param), $filter && !in_array($param, $this->except));
$p[$suffix == true ? $i++ : $param] = $this->param($param);
} else {
if (!isset($param[1])) $param[1] = null;
if (!isset($param[2])) $param[2] = '';
Expand All @@ -61,70 +61,41 @@ public function more(array $params, bool $suffix = false, bool $filter = true):
$keyName = $param[0];
}

$p[$suffix == true ? $i++ : ($param[3] ?? $keyName)] = $this->filterWord(
is_string($this->param($name, $param[1], $param[2])) ?
trim($this->param($name, $param[1], $param[2])) :
$this->param($name, $param[1], $param[2]),
$filter && !in_array($keyName, $this->except));
$p[$suffix == true ? $i++ : ($param[3] ?? $keyName)] = $this->param($name, $param[1], $param[2]);
}
}

if ($filter && $p) {
$p = $this->filterArrayValues($p);
}

return $p;
}

/**
* 过滤接受的参数
* 过滤接数组中的字符串
* @param $str
* @param bool $filter
* @return array|mixed|string|string[]
*/
public function filterWord($str, bool $filter = true)
public function filterArrayValues($array)
{
if (!$str || !$filter) return $str;
// 把数据过滤
$farr = [
"/<(\\/?)(script|i?frame|style|html|body|title|link|meta|object|\\?|\\%)([^>]*?)>/isU",
"/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",
'/phar/is',
"/select|join|where|drop|like|modify|rename|insert|update|table|database|alter|truncate|\'|\/\*|\.\.\/|\.\/|union|into|load_file|outfile/is"
];
if (is_array($str)) {
foreach ($str as &$v) {
if (is_array($v)) {
foreach ($v as &$vv) {
if (!is_array($vv)) {
$vv = $this->replaceWord($farr, $vv);
}
}
$result = [];
foreach ($array as $key => $value) {
if (is_array($value)) {
// 如果值是数组,递归调用 filterArrayValues
$result[$key] = $this->filterArrayValues($value);
} else {
if (in_array($key, $this->except) || is_int($value) || is_null($value)) {
$result[$key] = $value;
} else {
$v = $this->replaceWord($farr, $v);
// 如果值是字符串,过滤特殊字符
$result[$key] = filter_str($value);
}
}
} else {
$str = $this->replaceWord($farr, $str);
}
return $str;
}

/**
* 替换
* @param $farr
* @param $str
* @return array|string|string[]|null
* @author: 吴汐
* @email: [email protected]
* @date: 2023/9/19
*/
public function replaceWord($farr, $str)
{
if (filter_var($str, FILTER_VALIDATE_URL)) {
$url = parse_url($str);
if (!isset($url['scheme'])) return $str;
$host = $url['scheme'] . ':https://' . $url['host'];
$str = $host . preg_replace($farr, '', str_replace($host, '', $str));
} else {
$str = preg_replace($farr, '', $str);
}
}
return $str;
return $result;
}

/**
Expand Down
31 changes: 3 additions & 28 deletions crmeb/app/adminapi/controller/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,6 @@ public function auth()
'version' => $version
]);
$res = $res ? json_decode($res, true) : [];

//兼容test.
if (!isset($res['data']['status']) || $res['data']['status'] !== 1) {
$host = str_replace('test.', '', $host);
$res = HttpService::request('https://authorize.crmeb.net/api/auth_cert_query', 'post', [
'domain_name' => $host,
'label' => 34,
'version' => $version
]);
$res = $res ? json_decode($res, true) : [];
}

//如果是主域名兼容www.
if (!isset($res['data']['status']) || $res['data']['status'] !== 1) {
$host = str_replace('www.', '', $host);
$res = HttpService::request('https://authorize.crmeb.net/api/auth_cert_query', 'post', [
'domain_name' => $host,
'label' => 34,
'version' => $version
]);
$res = $res ? json_decode($res, true) : [];
}

//升级状态
// /** @var UpgradeServices $upgradeServices */
// $upgradeServices = app()->make(UpgradeServices::class);
// $upgradeStatus = $upgradeServices->getUpgradeStatus();

$status = $res['data']['status'] ?? -9;
switch ((int)$status) {
case 1:
Expand Down Expand Up @@ -447,6 +419,9 @@ public function menusSearch()
$configMenusList = $menusServices->getColumn([['id', 'in', $configTabIds]], 'menu_name as title,menu_path as path,id', 'id');
// 将配置项列表中的菜单ID与配置项标签对应的菜单ID对应起来
foreach ($configAllList as $item2) {
if ($item2['menus_id'] == 0) {
continue;
}
$menusList[] = [
'title' => $configMenusList[$item2['menus_id']]['title'] . '-' . $item2['title'],
'path' => $configMenusList[$item2['menus_id']]['path'] . '?tab_id=' . $item2['config_tab_id'],
Expand Down
Loading

0 comments on commit 2415bb7

Please sign in to comment.