|
...
|
...
|
@@ -25,7 +25,6 @@ class ProductController extends BaseController |
|
|
|
public function getImages(Request $request)
|
|
|
|
{
|
|
|
|
$project_id = $request->input('project_id');
|
|
|
|
|
|
|
|
$project = ProjectServer::useProject($project_id);
|
|
|
|
if (!$project) {
|
|
|
|
$this->response('项目不存在', Code::SYSTEM_ERROR);
|
|
...
|
...
|
@@ -43,4 +42,39 @@ class ProductController extends BaseController |
|
|
|
}
|
|
|
|
$this->response('success', Code::SUCCESS, $info);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :保存产品
|
|
|
|
* @name :saveProduct
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2024/3/20 11:09
|
|
|
|
*/
|
|
|
|
public function saveProduct(){
|
|
|
|
$this->request->validate([
|
|
|
|
'project_id'=>'required',
|
|
|
|
'title'=>'required',
|
|
|
|
],[
|
|
|
|
'project_id.required' => 'project_id不能为空',
|
|
|
|
'title.required' => 'keyword不能为空',
|
|
|
|
]);
|
|
|
|
$project = ProjectServer::useProject($this->param['project_id']);
|
|
|
|
if (!$project) {
|
|
|
|
$this->response('项目不存在', Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
$param = [
|
|
|
|
'project_id'=>$this->param['project_id'],
|
|
|
|
'title'=>$this->param['title'],
|
|
|
|
'intro'=>$this->param['intro'] ?? '',
|
|
|
|
'content'=>$this->param['content'] ?? ''
|
|
|
|
];
|
|
|
|
$productModel = new Product();
|
|
|
|
$productModel->add($param);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
LogUtils::error('Project Id: ' . $this->param['project_id'] . ' saveProduct error:' . $e->getMessage());
|
|
|
|
$this->response('保存失败,请联系管理员',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$this->response('success');
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|