Files
spa-api/app/Http/Controllers/ProjectController.php

64 lines
2.1 KiB
PHP
Raw Normal View History

<?php
namespace App\Http\Controllers;
use App\BaseApp\BaseController;
use App\Service\ProjectService;
2025-05-08 13:28:56 +08:00
use Exception;
use Illuminate\Http\JsonResponse;
class ProjectController extends BaseController
{
//
public function __construct()
{
parent::__construct();
$this->service = ProjectService::getInstance();
2025-05-28 16:51:40 +08:00
// $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'];
2025-05-08 13:28:56 +08:00
}
/**
* 修改项目内容
* @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),
'修改成功'
);
}
2025-05-08 14:10:45 +08:00
/**
* 修改项目内容
* @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),
'修改成功'
);
}
}