作者 Your Name

Merge branch 'dev' of http://47.244.231.31:8099/zhl/globalso-v6 into dev

<?php
namespace App\Http\Controllers\Aside;
class ProjectMenuController extends BaseController
{
/**
* @name :用户菜单列表
* @return void
* @author :liyuhang
* @method
*/
public function lists(){
}
}
<?php
namespace App\Http\Controllers\Aside;
class ProjectRoleController extends BaseController
{
/**
* @name :列表
* @return void
* @author :liyuhang
* @method
*/
public function lists (){
}
}
<?php
namespace App\Http\Controllers\Aside;
class ProjectUserController extends BaseController
{
/**
* @name :用户列表
* @return void
* @author :liyuhang
* @method
*/
public function lists(){
}
}
... ... @@ -97,9 +97,7 @@ class BaseController extends Controller
$this->map['updated_at'] = ['between', $this->_btw];
break;
default:
if (!empty($v)) {
$this->map[$k] = $v;
}
$this->map[$k] = $v;
break;
}
}
... ...
... ... @@ -26,6 +26,8 @@ class CategoryController extends BaseController
}
$sort = ['id' => 'desc'];
$data = $logic->getList($map, $sort, ['id', 'pid', 'title', 'image', 'keywords', 'describe', 'status','created_at'],0);
var_dump($data);
die();
return $this->success(Arr::listToTree($data));
}
... ...
... ... @@ -7,7 +7,7 @@ use App\Models\Image as ImageModel;
use Illuminate\Http\Exceptions\HttpResponseException;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;
use Intervention\Image\Facades\Image;
class ImageController
... ... @@ -109,27 +109,26 @@ class ImageController
* @method
*/
public function single($files){
if (is_array($files)) {
$file = current($files);
}
$hash = hash_file('md5', $files->getPathname());
$url = './../uploads/images/';
$filename = date('ymdHis').rand(10000,99999);
$res = $files->move($url,$filename);
$res = $this->request->file('image')->move($url,$filename);
if ($res === false) {
return $this->fail($files->getError(), 400);
return $this->fail($files->getError(), Code::USER_ERROR);
}
$imageModel = new ImageModel();
$data = [
'path' => $url.$filename,
'created_at' => date('Y-m-d H:i:s',time()),
'size' => $res->getSize(),
'hash' => hash_file('md5', $res->getPathname()),
'hash' => $hash.$filename,
'type'=>$files->getClientOriginalExtension(),
// 'mime'=>$files->getMimeType()
];
$imageModel = new ImageModel();
$imageModel->add($data);
return $data['hash'];
$rs = $imageModel->add($data);
if ($rs === false) {
return $this->fail('添加失败', Code::USER_ERROR);
}
return $hash.$filename;
}
/**
* 生成缩略图缓存
... ... @@ -146,6 +145,38 @@ class ImageController
}
/**
* 多图片上传
* @param type $files file对象集合
* @return type
*/
private function multi($files) {
if (!is_array($files)) {
$files = [$files];
}
$save_data = [];
$data = [];
foreach ($files as $file) {
$hash = hash_file('md5', $file->getPathname());
$url = './../uploads/images/';
$filename = date('ymdHis').rand(10000,99999);
$res = $file->move($url,$filename);
if ($res === false) {
return $this->fail($file->getError(), 400);
}
$save_data[] = [
'path' => $url.$filename,
'created_at' => date('Y-m-d H:i:s',time()),
'size' => $res->getSize(),
'hash' => $hash.$filename,
'type'=>$files->getClientOriginalExtension(),
];
$data[] = $hash.$filename;
}
$imageModel = new ImageModel();
$imageModel->insertAll($data);
$this->response('上传成功!', 200, $data);
}
/**
* @name 统一返回参数
* @return JsonResponse
* @author :liyuhang
... ...
<?php
namespace App\Http\Logic\Aside;
use App\Models\Project;
class ProjectLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Project();
$this->param = $this->requestAll;
}
}
<?php
namespace App\Http\Logic\Aside;
use App\Models\ProjectRole;
class ProjectRoleLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new ProjectRole();
$this->param = $this->requestAll;
}
}
<?php
namespace App\Http\Logic\Aside;
use App\Models\User;
class UserLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new User();
$this->param = $this->requestAll;
}
}
... ... @@ -65,8 +65,8 @@ class UserLogic extends BaseLogic
if($info !== false && !empty($info['image'])){
//TODO::删除资源
$imageModel = new Image();
$image_info = $imageModel->read(['hash'=>$info['hash']],['id','path']);
shell_exec('rm -rf '.$image_info['path'] .'./../uploads/images/cache_'. $info['hash'] . '*');
$image_info = $imageModel->read(['hash'=>$info['image']],['id','path']);
shell_exec('rm -rf '.$image_info['path'] .'./../uploads/images/cache_'. $info['image'] . '*');
$imageModel->del(['hash'=>$info['image']]);
}
$this->param['image'] = $this->upload();
... ...