管理页面
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace app\controller;
|
||||
|
||||
use app\model\Location;
|
||||
use app\util\Util;
|
||||
use util\Util;
|
||||
use support\Request;
|
||||
|
||||
class LocationController
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
//use support\Request;
|
||||
//use support\Log;
|
||||
//use Webman\Http\Response;
|
||||
|
||||
use app\service\OssService;
|
||||
use Shopwwi\WebmanFilesystem\Facade\Storage;
|
||||
use support\Log;
|
||||
use support\Request;
|
||||
use util\Util;
|
||||
|
||||
class UploadController
|
||||
{
|
||||
|
||||
/**
|
||||
* 不需要登录的方法
|
||||
*/
|
||||
protected $noNeedLogin = ['uploadImage'];
|
||||
|
||||
// 上传单文件图片
|
||||
public function uploadImage(Request $request)
|
||||
{
|
||||
try {
|
||||
$file = $request->file('files');
|
||||
|
||||
if (!$file || !$file->isValid()) {
|
||||
return Util::fail($file,'上传失败');
|
||||
}
|
||||
|
||||
$result = Storage::adapter('oss')
|
||||
->path('lingke_crm/'.date('Ymd'))
|
||||
->size(1024*1024*5)
|
||||
->extYes(['image/jpeg','image/png'])
|
||||
->extNo(['image/gif'])
|
||||
->upload($file);
|
||||
|
||||
$ossservice = new OssService();
|
||||
|
||||
$data = [
|
||||
'path' => $result->file_name,
|
||||
'original_name' => $result->origin_name,
|
||||
'image_url' => $ossservice->generatePrivateUrl($result->file_name)
|
||||
];
|
||||
|
||||
|
||||
return Util::success($data,'上传成功');
|
||||
}catch (\Throwable $e){
|
||||
Log::error('文件上传失败: ' . $e->getMessage());
|
||||
|
||||
return Util::fail([],'file:'.$e->getFile().'line:'.$e->getLine().'message:'.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,14 @@
|
||||
namespace app\controller;
|
||||
|
||||
use app\model\Vehicle;
|
||||
use app\util\Util;
|
||||
use plugin\admin\app\model\Location;
|
||||
use util\Util;
|
||||
use support\Request;
|
||||
|
||||
class VehicleController
|
||||
{
|
||||
|
||||
protected $status = ['未知','待发车','在途(发往fbo港口)','抵达发货港口','在途(发往目的地仓库)','抵达仓库','售出'];
|
||||
/**
|
||||
* Mask VIN number by showing only first 2 and last 6 characters
|
||||
*/
|
||||
@@ -29,6 +32,14 @@ class VehicleController
|
||||
if (isset($vehicle->vin)) {
|
||||
$vehicle->vin = $this->maskVin($vehicle->vin);
|
||||
}
|
||||
|
||||
$vehicle->status = $this->status[$vehicle->status]??$this->status[0];
|
||||
// $location = Location::find($vehicle->locations_id);
|
||||
// $vehicle->location_name = $location ? $location->name : '';
|
||||
// $final_location = Location::find($vehicle->final_locations_id);
|
||||
// $vehicle->final_location_name = $final_location ? $final_location->name : '';
|
||||
$fbo_location = Location::find($vehicle->fbo_locations_id);
|
||||
$vehicle->fbo_destination = $fbo_location ? $fbo_location->name : '';
|
||||
});
|
||||
$result = ['list' => $vehicles,'count'=>count($vehicles)];
|
||||
return Util::success($result);
|
||||
|
||||
Reference in New Issue
Block a user