作者 Karson

优化上传配置和API接口上传配置

@@ -47,7 +47,7 @@ class Common extends Api @@ -47,7 +47,7 @@ class Common extends Api
47 } 47 }
48 48
49 $upload['cdnurl'] = $upload['cdnurl'] ? $upload['cdnurl'] : cdnurl('', true); 49 $upload['cdnurl'] = $upload['cdnurl'] ? $upload['cdnurl'] : cdnurl('', true);
50 - $upload['uploadurl'] = $upload['bucket'] == 'local' ? cdnurl('/api/common/upload', true) : url($upload['uploadurl'], '', false, true); 50 + $upload['uploadurl'] = preg_match("/^((?:[a-z]+:)?\/\/)(.*)/i", $upload['uploadurl']) ? $upload['uploadurl'] : url($upload['bucket'] == 'local' ? '/api/common/upload' : $upload['uploadurl'], '', false, true);
51 51
52 $content = [ 52 $content = [
53 'citydata' => Area::getCityFromLngLat($lng, $lat), 53 'citydata' => Area::getCityFromLngLat($lng, $lat),
@@ -171,7 +171,10 @@ class Config extends Model @@ -171,7 +171,10 @@ class Config extends Model
171 171
172 $uploadurl = request()->module() ? $uploadcfg['uploadurl'] : ($uploadcfg['uploadurl'] === 'ajax/upload' ? 'index/' . $uploadcfg['uploadurl'] : $uploadcfg['uploadurl']); 172 $uploadurl = request()->module() ? $uploadcfg['uploadurl'] : ($uploadcfg['uploadurl'] === 'ajax/upload' ? 'index/' . $uploadcfg['uploadurl'] : $uploadcfg['uploadurl']);
173 173
174 - $uploadurl = url($uploadurl, '', false, false); 174 + if (!preg_match("/^((?:[a-z]+:)?\/\/)(.*)/i", $uploadurl) && substr($uploadurl, 0, 1) !== '/') {
  175 + $uploadurl = url($uploadurl, '', false);
  176 + }
  177 +
175 $upload = [ 178 $upload = [
176 'cdnurl' => $uploadcfg['cdnurl'], 179 'cdnurl' => $uploadcfg['cdnurl'],
177 'uploadurl' => $uploadurl, 180 'uploadurl' => $uploadurl,