代码优化

This commit is contained in:
wong
2026-01-19 11:11:36 +08:00
parent 3a0621aab8
commit 44dbe20b03
10 changed files with 159 additions and 49 deletions

View File

@@ -41,11 +41,18 @@ class AllotRuleController extends BaseController
$result = requestCurl($this->baseUrl . 'api/AllotRule/all', [], 'GET', $header);
$response = handleApiResponse($result);
// 确保 response 是数组格式
if (!is_array($response)) {
$response = [];
}
// 保存数据到数据库
if (!empty($response)) {
AllotRuleModel::where('1=1')->update(['isDel' => 1]);
foreach ($response as $item) {
$this->saveAllotRule($item);
if (is_array($item)) {
$this->saveAllotRule($item);
}
}
}