项目相关接口、图片视频上传
This commit is contained in:
22
app/Http/Controllers/CategoryController.php
Normal file
22
app/Http/Controllers/CategoryController.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\CategoryService;
|
||||
use App\Service\LabelService;
|
||||
use App\Service\ProjectService;
|
||||
use App\Service\RoleService;
|
||||
|
||||
class CategoryController extends BaseController
|
||||
{
|
||||
//
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = CategoryService::getInstance();
|
||||
$this->insertField = ['name', 'pid', 'value'];
|
||||
$this->updateField = ['id', 'name', 'pid', 'value'];
|
||||
}
|
||||
}
|
||||
21
app/Http/Controllers/LabelController.php
Normal file
21
app/Http/Controllers/LabelController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\LabelService;
|
||||
use App\Service\ProjectService;
|
||||
use App\Service\RoleService;
|
||||
|
||||
class LabelController extends BaseController
|
||||
{
|
||||
//
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = LabelService::getInstance();
|
||||
$this->insertField = ['name', 'pid', 'value'];
|
||||
$this->updateField = ['id', 'name', 'pid', 'value'];
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,8 @@ class ProjectController extends BaseController
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = ProjectService::getInstance();
|
||||
$this->insertField = [ 'user_id', 'title', 'cover', 'description', 'video_url', 'author_id', 'price', 'preferential_price', 'front', 'service', 'deploy', 'status'];
|
||||
$this->updateField = [ 'id', 'user_id', 'title', 'cover', 'description', 'video_url', 'author_id', 'price', 'preferential_price', 'front', 'service', 'deploy', 'status'];
|
||||
$this->insertField = [ 'title', 'cover', 'description', 'category_id', 'video_url', 'price', 'front', 'service', 'deploy', 'status'];
|
||||
$this->updateField = [ 'id', 'title', 'cover', 'description', 'category_id', 'video_url', 'price', 'front', 'service', 'deploy', 'status'];
|
||||
$this->notRequest = ['features', 'screenshots', 'tags'];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ class RoleController extends BaseController
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = RoleService::getInstance();
|
||||
$this->insertField = [ 'user_id', 'title', 'cover', 'description', 'video_url', 'author_id', 'price', 'preferential_price', 'front', 'service', 'deploy', 'status'];
|
||||
$this->updateField = [ 'id', 'user_id', 'title', 'cover', 'description', 'video_url', 'author_id', 'price', 'preferential_price', 'front', 'service', 'deploy', 'status'];
|
||||
$this->insertField = ['name', 'pid', 'value'];
|
||||
$this->updateField = ['id', 'name', 'pid', 'value'];
|
||||
}
|
||||
}
|
||||
|
||||
48
app/Http/Controllers/UploadController.php
Normal file
48
app/Http/Controllers/UploadController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\BaseApp\BaseController;
|
||||
use App\Service\common\UploadService;
|
||||
use App\Service\ProjectService;
|
||||
use App\Service\RoleService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class UploadController extends BaseController
|
||||
{
|
||||
//
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->service = UploadService::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* 图片上传
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function image()
|
||||
{
|
||||
$file = request()->file('file');
|
||||
return jok(
|
||||
$this->service->uploadImage($file),
|
||||
'上传成功'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频上传
|
||||
* @Method POST
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function video()
|
||||
{
|
||||
$file = request()->file('file');
|
||||
return jok(
|
||||
$this->service->uploadVideo($file),
|
||||
'上传成功'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user