Commit 12c08315 by xmy

Merge remote-tracking branch 'origin/master'

parents 16c6a9ef dbce7ed1
# 2.0.74
- 公共函数库
# 2.0.73 # 2.0.73
- 店员统计筛选 - 店员统计筛选
......
<?php <?php
/**
* Created by PhpStorm. // 加载公共函数库
* User: Administrator include __DIR__.'/../../Func.php';
* Date: 2018/7/16
* Time: 9:32 // 以下用于swoft加载自定义的类
*/
$scanPaths = include __DIR__.'/PathConfig.php'; $scanPaths = include __DIR__.'/PathConfig.php';
$data = []; $data = [];
foreach ($scanPaths as $basePath) { foreach ($scanPaths as $basePath) {
$files = \Swoft\Helper\DirHelper::glob($basePath,'*.php'); $files = \Swoft\Helper\DirHelper::glob($basePath,'*.php');
$baseNamespace = "Hdll\Services\\"; $baseNamespace = "Hdll\Services\\";
...@@ -42,11 +40,8 @@ foreach ($scanPaths as $basePath) { ...@@ -42,11 +40,8 @@ foreach ($scanPaths as $basePath) {
} }
} }
} }
return $data; return $data;
\ No newline at end of file
<?php
//================================//
// 公共函数库
//================================//
// 执行数据库操作,并对返回结果进行处理
if(!function_exists('dbQuery')) {
function dbQuery($result) {
if($result instanceof \Swoft\Core\ResultInterface) {
$result = $result->getResult();
}
if($result === false) {
throw new \Exception('数据库操作错误[return:false]');
}
if(!is_array($result) && !is_object($result)) {
return $result; //字符串或数字等类型直接返回
}
if(is_object($result) && \method_exists($result, 'toArray')) {
$result = $result->toArray();
}
foreach ($result as $key => $value) {
if(is_array($value) || is_object($value)) {
$result[$key] = dbQuery($value);
continue;
}
if($key == 'deleteTime') unset($result[$key]);
}
return $result;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment