Skip to content

Commit 0377e7f

Browse files
committed
优化:CurlUtil资源返回不为200时返回空
1 parent 04821db commit 0377e7f

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

vendor/modstart/modstart/resources/asset/src/svue/lib/storage.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ const Storage = {
1717
*/
1818
get: function (key, defaultValue) {
1919
let value = window.localStorage.getItem(key)
20+
if (null === value) {
21+
return defaultValue
22+
}
2023
try {
2124
return JSON.parse(value);
2225
} catch (e) {

vendor/modstart/modstart/src/Core/Util/CurlUtil.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ public static function getRaw($url, $param = [], $option = [])
340340
curl_setopt($ch, CURLOPT_USERAGENT, $option['userAgent']);
341341
}
342342
$temp = curl_exec($ch);
343+
$statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
343344
curl_close($ch);
345+
if (200 != $statusCode) {
346+
return null;
347+
}
344348
return $temp;
345349
}
346350

0 commit comments

Comments
 (0)