Files
spa-api/app/Http/Controllers/ProjectController.php
lq edefaa4379
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
功能视频测试
2025-05-28 16:51:40 +08:00

64 lines
2.1 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\BaseApp\BaseController;
use App\Service\ProjectService;
use Exception;
use Illuminate\Http\JsonResponse;
class ProjectController extends BaseController
{
//
public function __construct()
{
parent::__construct();
$this->service = ProjectService::getInstance();
// $this->insertField = [ 'title', 'features', 'cover', 'labels', 'description', 'category_id', 'video_url', 'price', 'front', 'service', 'deploy', 'status', 'module_image', 'flowchart'];
// $this->updateField = [ 'id', 'title', 'features', 'cover', 'labels', 'description', 'category_id', 'video_url', 'price', 'front', 'service', 'deploy', 'status', 'module_image', 'flowchart'];
$this->insertField = [ 'title', 'features', 'cover', 'labels', 'description', 'category_id', 'price', 'front', 'service', 'deploy', 'status', 'module_image', 'flowchart'];
$this->updateField = [ 'id', 'title', 'features', 'cover', 'labels', 'description', 'category_id', 'price', 'front', 'service', 'deploy', 'status', 'module_image', 'flowchart'];
$this->notRequest = ['screenshots', 'preferential_price', 'content', 'video_url'];
}
/**
* 修改项目内容
* @Method POST
* @return JsonResponse
* @throws Exception
*/
public function changeContent(): JsonResponse
{
$id = request()->post('id');
$content = request()->post('content');
if (empty($id) || empty($content)) {
return jerr('参数错误');
}
return jok(
$this->service->changeContent($id, $content),
'修改成功'
);
}
/**
* 修改项目内容
* @Method POST
* @return JsonResponse
* @throws Exception
*/
public function changeType(): JsonResponse
{
$id = request()->post('id');
$type = request()->post('type');
if (empty($id) || empty($type)) {
return jerr('参数错误');
}
return jok(
$this->service->changeType($id, $type),
'修改成功'
);
}
}