Skip to content

Commit d0dbce7

Browse files
authored
fixed 批量生成接口 报错
报错信息如下: > Warning: count(): Parameter must be an array or an object that implements Countable in … // PHP 7.2 起 自 PHP 7.2 起 对 count 函数参数类型加了限制,数组或者 `Countable` 对象,所以这里改成 !empty 更为合适并且兼容。
1 parent 73e1af2 commit d0dbce7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/Http/Controllers/AdminController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ public function batchAddUsers(Request $request)
310310
$user->save();
311311

312312
// 初始化默认标签
313-
if (count(self::$systemConfig['initial_labels_for_user']) > 0) {
313+
if (!empty(self::$systemConfig['initial_labels_for_user'])) {
314314
$labels = explode(',', self::$systemConfig['initial_labels_for_user']);
315315
$this->makeUserLabels($user->id, $labels);
316316
}
@@ -2437,4 +2437,4 @@ private function makeUserLabels($userId, $labels = [])
24372437
}
24382438
}
24392439
}
2440-
}
2440+
}

0 commit comments

Comments
 (0)