|
|
@@ -24,7 +24,7 @@ use think\db\exception\DataNotFoundException;
|
|
|
use think\db\exception\DbException;
|
|
|
use think\db\exception\ModelNotFoundException;
|
|
|
use think\response\Json;
|
|
|
-
|
|
|
+use app\common\traits\GpsTrait;
|
|
|
/**
|
|
|
* Class Attachment
|
|
|
* @package app\controller\admin\system\attachment
|
|
|
@@ -33,6 +33,7 @@ use think\response\Json;
|
|
|
*/
|
|
|
class Attachment extends BaseController
|
|
|
{
|
|
|
+ use GpsTrait;
|
|
|
/**
|
|
|
* @var AttachmentRepository
|
|
|
*/
|
|
|
@@ -91,7 +92,6 @@ class Attachment extends BaseController
|
|
|
'fileExt' => 'jpg,jpeg,png,bmp,gif',
|
|
|
'fileMime' => 'image/jpeg,image/png,image/gif',
|
|
|
]])->check([$field => $file]);
|
|
|
-
|
|
|
$type = (int)systemConfig('upload_type') ?: 1;
|
|
|
$upload = UploadService::create($type);
|
|
|
$data = $upload->to($info['enname'])->move($field);
|
|
|
@@ -99,6 +99,35 @@ class Attachment extends BaseController
|
|
|
return app('json')->fail($upload->getError());
|
|
|
}
|
|
|
$res = $upload->getUploadInfo();
|
|
|
+ // var_dump($res['dir']);
|
|
|
+ //获取图片地址
|
|
|
+ // $imgPath = app()->getRootPath() . 'public'.$res['dir'];
|
|
|
+ // $imgInfoAll = exif_read_data($imgPath,0,1);
|
|
|
+ // foreach($imgInfoAll as $section => $arrValue){
|
|
|
+ // foreach($arrValue as $key => $value){
|
|
|
+ // $infoAllKey[] = $key;
|
|
|
+ // $infoAllValue[] = $value;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // $infoAll = array_combine($infoAllKey,$infoAllValue);
|
|
|
+ // $lat = $long = '';
|
|
|
+ // if(isset($infoAll['GPSLatitude']) && !empty($infoAll['GPSLatitude']) )
|
|
|
+ // {
|
|
|
+ // $latitude = $infoAll['GPSLatitude']; //纬度
|
|
|
+ // $longitude = $infoAll['GPSLongitude']; //经度
|
|
|
+ // $GPSLatitudeRef = $infoAll['GPSLatitudeRef']; //南半球 S 北半球 N
|
|
|
+ // $GPSLongitudeRef = $infoAll['GPSLongitudeRef']; //东半球 S 西半球 N
|
|
|
+ // $latitude = $this->getGps($latitude);
|
|
|
+ // $lat = bcadd($latitude['degrees'] , bcadd($latitude['minutes']/60 , $latitude['seconds']/3600,6),6);
|
|
|
+ // $longitude = $this->getGps($longitude);
|
|
|
+ // $long = bcadd($longitude['degrees'] , bcadd($longitude['minutes']/60 , $longitude['seconds']/3600,6),6);
|
|
|
+
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // //是否强制要求使用带gps信息定位的图片
|
|
|
+
|
|
|
+ // }
|
|
|
$res['dir'] = tidy_url($res['dir']);
|
|
|
$_name = '.' . $file->getOriginalExtension();
|
|
|
$data = [
|
|
|
@@ -117,6 +146,8 @@ class Attachment extends BaseController
|
|
|
return app('json')->success(['src' => $data['attachment_src']]);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 获取列表
|
|
|
* @return Json
|