作者 黎建湛

云订单的助手类函数修复

@@ -7,7 +7,6 @@ use yii\helpers\Json; @@ -7,7 +7,6 @@ use yii\helpers\Json;
7 // 应用公共文件 7 // 应用公共文件
8 class Helper 8 class Helper
9 { 9 {
10 -  
11 /** 10 /**
12 * 输出通用API接口数据格式 11 * 输出通用API接口数据格式
13 * string $message 信息提示 12 * string $message 信息提示
@@ -66,7 +65,7 @@ class Helper @@ -66,7 +65,7 @@ class Helper
66 'field' => [],//空规则不验证 65 'field' => [],//空规则不验证
67 ] 66 ]
68 */ 67 */
69 - foreach ($rule as $key => $value) { 68 + foreach ($rule as $key => $value){
70 if(empty($value)) continue; 69 if(empty($value)) continue;
71 if(isset($value[1]) && $value[1] == 1 && empty($param[$key])) continue; 70 if(isset($value[1]) && $value[1] == 1 && empty($param[$key])) continue;
72 if(!isset($param[$key])) self::show('缺少参数:'.$key,'', 201); 71 if(!isset($param[$key])) self::show('缺少参数:'.$key,'', 201);
@@ -117,8 +116,7 @@ class Helper @@ -117,8 +116,7 @@ class Helper
117 return true; 116 return true;
118 } 117 }
119 118
120 - public static function writeLog($tag, $content)  
121 - { 119 + public static function writeLog($tag, $content){
122 if(empty(Yii::$app->params['helper_writeLog_off']) || Yii::$app->params['helper_writeLog_off'] == 0) return;//没配置默认关闭写日志 120 if(empty(Yii::$app->params['helper_writeLog_off']) || Yii::$app->params['helper_writeLog_off'] == 0) return;//没配置默认关闭写日志
123 $dir = __DIR__. '/../runtime/logs/'.date('Ymd'); 121 $dir = __DIR__. '/../runtime/logs/'.date('Ymd');
124 if (!is_dir($dir)) mkdir($dir,0777,true); 122 if (!is_dir($dir)) mkdir($dir,0777,true);
@@ -136,8 +134,7 @@ class Helper @@ -136,8 +134,7 @@ class Helper
136 * @param array $string [查找的内容] 134 * @param array $string [查找的内容]
137 * @return int|boolean [成功返回一维下标,否则false] 135 * @return int|boolean [成功返回一维下标,否则false]
138 */ 136 */
139 - public static function supArraySearch($array,$string)  
140 - { 137 + public static function supArraySearch($array,$string){
141 if(!is_array($array)) return false; 138 if(!is_array($array)) return false;
142 foreach ($array as $key => $value) { 139 foreach ($array as $key => $value) {
143 $sea = array_search($string, $value); 140 $sea = array_search($string, $value);