Commit 8b9ba646 authored by zhoujun's avatar zhoujun

图片

parent d250ba77
<?php
namespace App\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
use App\Models\WxUserImg;
use App\Services\UploadServer;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
class UploadOOSImg extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'UploadOOSImg';
/**
* The console command description.
*
* @var string
*/
protected $description = '上传云图片';
/**
* @var ActivityOrder
*/
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
set_time_limit(0);
$this->line('开始');
$imgs = WxUserImg::where('is_upload', 0)->where('status',1)->select('id','loacl_url','img_url','is_upload')->limit(100)->get();
foreach($imgs as $img){
if($img->loacl_url != ''){
$url = UploadServer::getUploadAliyun('aldzn-img', $img->loacl_url,public_path().'/'.$img->loacl_url);
if($url){
$img->is_upload = 1;
$img->img_url = $url;
$img->save();
if($img->loacl_url != '' && file_exists(public_path().'/'.$img->loacl_url)) unlink(public_path().'/'.$img->loacl_url);
}
}
}
$this->line('结束');
}
}
\ No newline at end of file
...@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel ...@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array * @var array
*/ */
protected $commands = [ protected $commands = [
// 'App\Console\Commands\UploadOOSImg',
]; ];
/** /**
...@@ -24,8 +24,7 @@ class Kernel extends ConsoleKernel ...@@ -24,8 +24,7 @@ class Kernel extends ConsoleKernel
*/ */
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
// $schedule->command('inspire') $schedule->command('UploadOOSImg')->everyMinute()->withoutOverlapping(5);
// ->hourly();
} }
/** /**
......
...@@ -95,7 +95,7 @@ class AdminController extends Controller ...@@ -95,7 +95,7 @@ class AdminController extends Controller
return $query->where('updated_at','<',$endTime); return $query->where('updated_at','<',$endTime);
})->when($status == 0, function ($query) use ($status) { })->when($status == 0, function ($query) use ($status) {
return $query->orderBy('status','ASC'); return $query->orderBy('status','ASC');
})->orderBy('updated_at','DESC')->select('id', 'uid', 'img_url', 'status', 'updated_at')->paginate($pageNum); })->orderBy('updated_at','DESC')->select('id', 'uid', 'loacl_url','img_url', 'status','is_upload', 'updated_at')->paginate($pageNum);
if($startTime != '') $paginateAppends['startTime'] = $startTime; if($startTime != '') $paginateAppends['startTime'] = $startTime;
if($endTime != '') $paginateAppends['endTime'] = $endTime; if($endTime != '') $paginateAppends['endTime'] = $endTime;
if($userName != '') $paginateAppends['user'] = $userName; if($userName != '') $paginateAppends['user'] = $userName;
...@@ -144,6 +144,16 @@ class AdminController extends Controller ...@@ -144,6 +144,16 @@ class AdminController extends Controller
$ids = explode('#',$postData['ids']); $ids = explode('#',$postData['ids']);
$status = $postData['status']; $status = $postData['status'];
if(!in_array($status,[1,2]) || empty($ids)) return $this->getErrorMsg('10060', '参数错误'); if(!in_array($status,[1,2]) || empty($ids)) return $this->getErrorMsg('10060', '参数错误');
// $imgs = WxUserImg::whereIn('id',$ids)->select('id','loacl_url','status')->get();
// $result = true;
// foreach($imgs as $img){
// $img->status = 1;
// if($img->save()){
// if($status == 2) unlink(storage_path('app').'/'.$img->loacl_url);
// }else{
// $result = false;
// }
// }
$result = WxUserImg::whereIn('id',$ids)->update(['status' => $status]); $result = WxUserImg::whereIn('id',$ids)->update(['status' => $status]);
if($result) return $this->getSuccessMsg([]); if($result) return $this->getSuccessMsg([]);
return $this->getErrorMsg('10063', '审核失败'); return $this->getErrorMsg('10063', '审核失败');
......
...@@ -82,6 +82,7 @@ class CardController extends Controller ...@@ -82,6 +82,7 @@ class CardController extends Controller
$userId = $request->session()->get("uid"); $userId = $request->session()->get("uid");
$result = $this->getVerityLogin($userId); $result = $this->getVerityLogin($userId);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']); if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
if(Cache::has($userId.':card:bind:role')) return $this->jsonReturn(10022, '绑定角色过于频繁,请稍后再试');
$roleId = $request->input('roleId'); $roleId = $request->input('roleId');
$serverId = $request->input('serverId'); $serverId = $request->input('serverId');
...@@ -91,8 +92,11 @@ class CardController extends Controller ...@@ -91,8 +92,11 @@ class CardController extends Controller
$this->getCheckRoleInfoTable($tableName); $this->getCheckRoleInfoTable($tableName);
$verity = DB::connection('wx_mysql')->table($tableName)->where('uid',$userId)->where('role_id',$roleId)->select('id')->first(); $verity = DB::connection('wx_mysql')->table($tableName)->where('uid',$userId)->where('role_id',$roleId)->select('id')->first();
if($verity) return $this->jsonReturn(0, '角色绑定成功'); if($verity) return $this->jsonReturn(0, '角色绑定成功');
Cache::put($userId.':card:bind:role',1,30);
$insert = $this->getInsertRoleInfo($userId,$roleId,$serverId,$serverName,$tableName); $insert = $this->getInsertRoleInfo($userId,$roleId,$serverId,$serverName,$tableName);
if($insert['code'] == 200) return $this->jsonReturn(0, '角色绑定成功'); if($insert['code'] == 200) return $this->jsonReturn(0, '角色绑定成功');
Cache::forget($userId.':card:bind:role');
return $this->jsonReturn($insert['code'], $insert['msg']); return $this->jsonReturn($insert['code'], $insert['msg']);
} }
...@@ -277,17 +281,21 @@ class CardController extends Controller ...@@ -277,17 +281,21 @@ class CardController extends Controller
$serverId = $request->input('serverId'); $serverId = $request->input('serverId');
$result = $this->getVerityLogin($userId); $result = $this->getVerityLogin($userId);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']); if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
if(Cache::has($userId.':card:upload:image')) return $this->jsonReturn(10022, '上传图片过于频繁,请稍后再试');
$postData = $request->all(); $postData = $request->all();
if($request->hasFile('imgFile') && $request->file('imgFile')->isValid()){ if($request->hasFile('imgFile') && $request->file('imgFile')->isValid()){
$file = $request->file('imgFile'); $file = $request->file('imgFile');
$upload = new UploadServer(); $upload = new UploadServer();
$result = $upload->getUpload($postData,$file); $result = $upload->getUpload($postData,$file);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']); if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
Cache::put($userId.':card:upload:image',1,30);
$tableName = 'wx_card_role_'.$serverId; $tableName = 'wx_card_role_'.$serverId;
$role = DB::connection('wx_mysql')->table($tableName)->where('uid',$userId)->where('role_id',$roleId)->select('id')->first(); $role = DB::connection('wx_mysql')->table($tableName)->where('uid',$userId)->where('role_id',$roleId)->select('id')->first();
$img = $this->getUpdateImg($result['data'],$userId,$role->id,$serverId); $img = $this->getUpdateImg($result['data'],$userId,$role->id,$serverId);
if($img) return $this->jsonReturn(0, '上传成功',['src'=>$result['data']]); if($img) return $this->jsonReturn(0, '上传成功');
Cache::forget($userId.':card:upload:image');
return $this->jsonReturn(10060, '上传失败'); return $this->jsonReturn(10060, '上传失败');
} }
return $this->jsonReturn(10056, '请选择要上传的图片'); return $this->jsonReturn(10056, '请选择要上传的图片');
...@@ -302,9 +310,11 @@ class CardController extends Controller ...@@ -302,9 +310,11 @@ class CardController extends Controller
{ {
$img = WxUserImg::where('uid',$userId)->where('role_id',$roleId)->where('server_id',$serverId)->first(); $img = WxUserImg::where('uid',$userId)->where('role_id',$roleId)->where('server_id',$serverId)->first();
if($img){ if($img){
if($img->loacl_url != '' && file_exists(public_path().'/'.$img->loacl_url)) unlink(public_path().'/'.$img->loacl_url);
$img->loacl_url = $data['url']; $img->loacl_url = $data['url'];
$img->img_url = $data['yunUrl']; $img->img_url = $data['yunUrl'];
$img->status = 0; $img->status = 0;
$img->is_upload = 0;
if($img->save()) return true; if($img->save()) return true;
}else{ }else{
$row = new WxUserImg(); $row = new WxUserImg();
...@@ -314,6 +324,7 @@ class CardController extends Controller ...@@ -314,6 +324,7 @@ class CardController extends Controller
$row->loacl_url = $data['url']; $row->loacl_url = $data['url'];
$row->img_url = $data['yunUrl']; $row->img_url = $data['yunUrl'];
$row->status = 0; $row->status = 0;
$row->is_upload = 0;
$row->remark = ''; $row->remark = '';
if($row->save()) return true; if($row->save()) return true;
} }
...@@ -328,116 +339,121 @@ class CardController extends Controller ...@@ -328,116 +339,121 @@ class CardController extends Controller
public function getCardHtml(Request $request) public function getCardHtml(Request $request)
{ {
$userId = $request->session()->get("uid"); $userId = $request->session()->get("uid");
$result = $this->getVerityLogin($userId);
if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
$roleId = $request->input('roleId'); $roleId = $request->input('roleId');
$serverId = $request->input('serverId'); $serverId = $request->input('serverId');
if (empty($roleId) || empty($serverId)) return $this->jsonReturn(7002, '参数错误'); if(Cache::has('card:info:'.$userId.':'.$roleId)){
if (!Schema::connection('wx_mysql')->hasTable('wx_card_role_'.$serverId)) return redirect(route('index')); $data = Cache::get('card:info:'.$userId.':'.$roleId,[]);
$info = DB::connection('wx_mysql')->table('wx_card_role_'.$serverId)->where('uid',$userId)->where('role_id',$roleId)->where('server_id',$serverId)->first(); }else{
if(!$info) return redirect(route('index')); $result = $this->getVerityLogin($userId);
$serverName = ''; if($result['code'] != 200) return $this->jsonReturn($result['code'], $result['msg']);
if($info->server_name != ''){ if (empty($roleId) || empty($serverId)) return $this->jsonReturn(7002, '参数错误');
$serverName = str_replace('非硬核-','',$info->server_name); if (!Schema::connection('wx_mysql')->hasTable('wx_card_role_'.$serverId)) return redirect(route('index'));
$serverName = str_replace('硬核-','',$serverName); $info = DB::connection('wx_mysql')->table('wx_card_role_'.$serverId)->where('uid',$userId)->where('role_id',$roleId)->where('server_id',$serverId)->first();
$serverName = str_replace('越狱-','',$serverName); if(!$info) return redirect(route('index'));
} $serverName = '';
if($info->server_name != ''){
$serverName = str_replace('非硬核-','',$info->server_name);
$serverName = str_replace('硬核-','',$serverName);
$serverName = str_replace('越狱-','',$serverName);
}
$user = User::where('uid',$userId)->select('uid','account')->first(); $user = User::where('uid',$userId)->select('uid','account')->first();
$data['userName'] = $user->account ?? ''; $data['userName'] = $user->account ?? '';
$data['serverName'] = $serverName; $data['serverName'] = $serverName;
$img = WxUserImg::where('uid',$userId)->where('role_id',$info->id)->where('server_id',$info->server_id)->select('id','img_url','status')->first(); $img = WxUserImg::where('uid',$userId)->where('role_id',$info->id)->where('server_id',$info->server_id)->select('id','img_url','status')->first();
if($img){ if($img){
$data['userImgStatus'] = $img->status; $data['userImgStatus'] = $img->status;
$data['userImg'] = $img->img_url; $data['userImg'] = $img->img_url;
}else{ }else{
$data['userImg'] = ''; $data['userImg'] = '';
$data['userImgStatus'] = -1; $data['userImgStatus'] = -1;
} }
$armsScore = []; $armsScore = [];
$armsStrong = []; $armsStrong = [];
$armsExciting = []; $armsExciting = [];
if($info->arms_score != '') $armsScore = json_decode($info->arms_score,true); if($info->arms_score != '') $armsScore = json_decode($info->arms_score,true);
if($info->arms_strong != '') $armsStrong = json_decode($info->arms_strong,true); if($info->arms_strong != '') $armsStrong = json_decode($info->arms_strong,true);
if($info->arms_exciting != '') $armsExciting = json_decode($info->arms_exciting,true); if($info->arms_exciting != '') $armsExciting = json_decode($info->arms_exciting,true);
$roleScore = '00000'; $roleScore = '00000';
if(strlen($info->role_score) == 1) $roleScore = '0000'.(string)$info->role_score; if(strlen($info->role_score) == 1) $roleScore = '0000'.(string)$info->role_score;
if(strlen($info->role_score) == 2) $roleScore = '000'.(string)$info->role_score; if(strlen($info->role_score) == 2) $roleScore = '000'.(string)$info->role_score;
if(strlen($info->role_score) == 3) $roleScore = '00'.(string)$info->role_score; if(strlen($info->role_score) == 3) $roleScore = '00'.(string)$info->role_score;
if(strlen($info->role_score) == 4) $roleScore = '0'.(string)$info->role_score; if(strlen($info->role_score) == 4) $roleScore = '0'.(string)$info->role_score;
if(strlen($info->role_score) == 5) $roleScore = (string)$info->role_score; if(strlen($info->role_score) == 5) $roleScore = (string)$info->role_score;
$jobInco = config('sign.jobInco'); $jobInco = config('sign.jobInco');
$data['info'] = $info; $data['info'] = $info;
$data['roleScore'] = $roleScore; $data['roleScore'] = $roleScore;
$data['jobImg'] = $jobInco[$info->job] ?? ''; $data['jobImg'] = $jobInco[$info->job] ?? '';
$honorConfig = config('sign.honor'); $honorConfig = config('sign.honor');
$data['honor'] = $honorConfig[$info->honor_level] ?? $honorConfig[0]; $data['honor'] = $honorConfig[$info->honor_level] ?? $honorConfig[0];
if($info->mercenary_score == 2){ if($info->mercenary_score == 2){
$data['ybImg'] = 'img-B'; $data['ybImg'] = 'img-B';
}elseif($info->mercenary_score == 3){ }elseif($info->mercenary_score == 3){
$data['ybImg'] = 'img-A'; $data['ybImg'] = 'img-A';
}elseif($info->mercenary_score == 4){ }elseif($info->mercenary_score == 4){
$data['ybImg'] = 'img-S'; $data['ybImg'] = 'img-S';
}elseif($info->mercenary_score == 5){ }elseif($info->mercenary_score == 5){
$data['ybImg'] = 'img-SS'; $data['ybImg'] = 'img-SS';
}elseif($info->mercenary_score == 6){ }elseif($info->mercenary_score == 6){
$data['ybImg'] = 'img-SSS'; $data['ybImg'] = 'img-SSS';
}else{ }else{
$data['ybImg'] = 'img-C'; $data['ybImg'] = 'img-C';
} }
$data['rank'] = empty($info->max_rank) ? '青铜5' : $info->max_rank; $data['rank'] = empty($info->max_rank) ? '青铜5' : $info->max_rank;
if(!empty($armsScore)){ if(!empty($armsScore)){
$armsScoreNum = '00000'; $armsScoreNum = '00000';
if(strlen($armsScore[0]['score']) == 1) $armsScoreNum = '0000'.(string)$armsScore[0]['score']; if(strlen($armsScore[0]['score']) == 1) $armsScoreNum = '0000'.(string)$armsScore[0]['score'];
if(strlen($armsScore[0]['score']) == 2) $armsScoreNum = '000'.(string)$armsScore[0]['score']; if(strlen($armsScore[0]['score']) == 2) $armsScoreNum = '000'.(string)$armsScore[0]['score'];
if(strlen($armsScore[0]['score']) == 3) $armsScoreNum = '00'.(string)$armsScore[0]['score']; if(strlen($armsScore[0]['score']) == 3) $armsScoreNum = '00'.(string)$armsScore[0]['score'];
if(strlen($armsScore[0]['score']) == 4) $armsScoreNum = '0'.(string)$armsScore[0]['score']; if(strlen($armsScore[0]['score']) == 4) $armsScoreNum = '0'.(string)$armsScore[0]['score'];
if(strlen($armsScore[0]['score']) == 5) $armsScoreNum = (string)$armsScore[0]['score']; if(strlen($armsScore[0]['score']) == 5) $armsScoreNum = (string)$armsScore[0]['score'];
$data['armsScoreName'] = $armsScore[0]['name']; $data['armsScoreName'] = $armsScore[0]['name'];
$data['armsScore'] = $armsScoreNum; $data['armsScore'] = $armsScoreNum;
}else{ }else{
$data['armsScoreName'] = ''; $data['armsScoreName'] = '';
$data['armsScore'] = '00000'; $data['armsScore'] = '00000';
} }
if(!empty($armsStrong)){ if(!empty($armsStrong)){
$armsStrongNum = '00'; $armsStrongNum = '00';
if(strlen($armsStrong[0]['level']) == 1) $armsStrongNum = '0'.(string)$armsStrong[0]['level']; if(strlen($armsStrong[0]['level']) == 1) $armsStrongNum = '0'.(string)$armsStrong[0]['level'];
if(strlen($armsStrong[0]['level']) == 2) $armsStrongNum = (string)$armsStrong[0]['level']; if(strlen($armsStrong[0]['level']) == 2) $armsStrongNum = (string)$armsStrong[0]['level'];
$data['armsStrongName'] = $armsStrong[0]['name']; $data['armsStrongName'] = $armsStrong[0]['name'];
$data['armsStrong'] = $armsStrongNum; $data['armsStrong'] = $armsStrongNum;
}else{ }else{
$data['armsStrongName'] = ''; $data['armsStrongName'] = '';
$data['armsStrong'] = '00'; $data['armsStrong'] = '00';
} }
if(!empty($armsExciting)){ if(!empty($armsExciting)){
$armsExcitingNum = '00'; $armsExcitingNum = '00';
if(strlen($armsExciting[0]['level']) == 1) $armsExcitingNum = '0'.(string)$armsExciting[0]['level']; if(strlen($armsExciting[0]['level']) == 1) $armsExcitingNum = '0'.(string)$armsExciting[0]['level'];
if(strlen($armsExciting[0]['level']) == 2) $armsExcitingNum = (string)$armsExciting[0]['level']; if(strlen($armsExciting[0]['level']) == 2) $armsExcitingNum = (string)$armsExciting[0]['level'];
$data['armsExcitingName'] = $armsExciting[0]['name']; $data['armsExcitingName'] = $armsExciting[0]['name'];
$data['armsExciting'] = $armsExcitingNum; $data['armsExciting'] = $armsExcitingNum;
}else{ }else{
$data['armsExcitingName'] = ''; $data['armsExcitingName'] = '';
$data['armsExciting'] = '00'; $data['armsExciting'] = '00';
} }
if($info->brave_time > 0){ if($info->brave_time > 0){
$His = strtotime(date('Y-m-d')) + $info->brave_time; $His = strtotime(date('Y-m-d')) + $info->brave_time;
if(date('H',$His) > 0){ if(date('H',$His) > 0){
$data['braveTime'] = date('H:i',$His); $data['braveTime'] = date('H:i',$His);
}else{
$data['braveTime'] = date('i:s',$His);
}
}else{ }else{
$data['braveTime'] = date('i:s',$His); $data['braveTime'] = '00:00';
} }
}else{ Cache::put('card:info:'.$userId.':'.$roleId,300,$data);
$data['braveTime'] = '00:00';
} }
return view('card.card', $data); return view('card.card', $data);
} }
......
...@@ -141,8 +141,8 @@ class AldGmService { ...@@ -141,8 +141,8 @@ class AldGmService {
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_POST, count($submitData)); curl_setopt($curl, CURLOPT_POST, count($submitData));
curl_setopt($curl, CURLOPT_POSTFIELDS, $submitData); curl_setopt($curl, CURLOPT_POSTFIELDS, $submitData);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl); $result = curl_exec($curl);
curl_close($curl); curl_close($curl);
...@@ -160,8 +160,8 @@ class AldGmService { ...@@ -160,8 +160,8 @@ class AldGmService {
$url .= "?" . http_build_query($submitData); $url .= "?" . http_build_query($submitData);
curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET"); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_TIMEOUT, 30); curl_setopt($curl, CURLOPT_TIMEOUT, 5);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($curl); $result = curl_exec($curl);
curl_close($curl); curl_close($curl);
......
...@@ -38,7 +38,7 @@ class UploadServer ...@@ -38,7 +38,7 @@ class UploadServer
return $array; return $array;
} }
$originName = $file->getClientOriginalName(); $originName = $file->getClientOriginalName();
self::getCheckDir( storage_path('app'),'card'); self::getCheckDir(public_path(),'card');
$fileUrl = self::getUploadFile($file,'card','aldzn-img',$originName); $fileUrl = self::getUploadFile($file,'card','aldzn-img',$originName);
if($fileUrl['error'] != ''){ if($fileUrl['error'] != ''){
$array['code'] = 10059; $array['code'] = 10059;
...@@ -102,7 +102,8 @@ class UploadServer ...@@ -102,7 +102,8 @@ class UploadServer
$realPath = $file->getRealPath(); $realPath = $file->getRealPath();
if(Storage::disk('upload')->put($path.'/'.$fileName, file_get_contents($realPath))){ if(Storage::disk('upload')->put($path.'/'.$fileName, file_get_contents($realPath))){
$imgUrl['url'] = $folder.'/'.date('Ym').'/'.date('d').'/'.$fileName; $imgUrl['url'] = $folder.'/'.date('Ym').'/'.date('d').'/'.$fileName;
$imgUrl['yunUrl'] = self::getUploadAliyun($bucket, $folder.'/'.date('Ym').'/'.date('d').'/'.$fileName,storage_path('app').'/'.$imgUrl['url']); $imgUrl['yunUrl'] = '';
//$imgUrl['yunUrl'] = self::getUploadAliyun($bucket, $folder.'/'.date('Ym').'/'.date('d').'/'.$fileName,storage_path('app').'/'.$imgUrl['url']);
}else{ }else{
$imgUrl['error'] = '文件上传失败!'; $imgUrl['error'] = '文件上传失败!';
} }
...@@ -128,10 +129,7 @@ class UploadServer ...@@ -128,10 +129,7 @@ class UploadServer
$client = $manager->init($aliyunConfig); $client = $manager->init($aliyunConfig);
$result = $client->uploadFile($object, $fileUrl); $result = $client->uploadFile($object, $fileUrl);
if($result == false){ if($result == false) return false;
exit($client->getError());
}
unset($result,$manager,$client); unset($result,$manager,$client);
return config('sign.OSS_CDN').$object; return config('sign.OSS_CDN').$object;
} }
......
...@@ -50,7 +50,7 @@ return [ ...@@ -50,7 +50,7 @@ return [
'upload' => [ 'upload' => [
'driver' => 'local', 'driver' => 'local',
'root' => storage_path('app'), 'root' => public_path(),
], ],
'public' => [ 'public' => [
......
...@@ -67,9 +67,21 @@ ...@@ -67,9 +67,21 @@
@if($li->status == 1) 审核通过 @endif @if($li->status == 1) 审核通过 @endif
@if($li->status == 2) 审核拒绝 @endif @if($li->status == 2) 审核拒绝 @endif
</td> </td>
<td><img src="{{ $li->img_url }}" width="50px" height="30px"></td> <td>
@if($li->status == 1 && $li->is_upload)
<img src="{{ $li->img_url }}" width="50px" height="30px">
@else
<img src="/{{ $li->loacl_url }}" width="50px" height="30px">
@endif
</td>
<td>{{ @$li->updated_at }}</td> <td>{{ @$li->updated_at }}</td>
<td> <button type="button" class="btn btn-default" onclick="return showImg('{{ $li->img_url }}');">查看</button></td> <td>
@if($li->status == 1 && $li->is_upload)
<button type="button" class="btn btn-default" onclick="return showImg('{{ $li->img_url }}');">查看</button>
@else
<button type="button" class="btn btn-default" onclick="return showImg('/{{ $li->loacl_url }}');">查看</button>
@endif
</td>
</tr> </tr>
@endforeach @endforeach
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment