|
@@ -25,7 +25,6 @@ class ProductController extends BaseController |
|
@@ -25,7 +25,6 @@ class ProductController extends BaseController |
|
25
|
public function getImages(Request $request)
|
25
|
public function getImages(Request $request)
|
|
26
|
{
|
26
|
{
|
|
27
|
$project_id = $request->input('project_id');
|
27
|
$project_id = $request->input('project_id');
|
|
28
|
-
|
|
|
|
29
|
$project = ProjectServer::useProject($project_id);
|
28
|
$project = ProjectServer::useProject($project_id);
|
|
30
|
if (!$project) {
|
29
|
if (!$project) {
|
|
31
|
$this->response('项目不存在', Code::SYSTEM_ERROR);
|
30
|
$this->response('项目不存在', Code::SYSTEM_ERROR);
|
|
@@ -43,4 +42,39 @@ class ProductController extends BaseController |
|
@@ -43,4 +42,39 @@ class ProductController extends BaseController |
|
43
|
}
|
42
|
}
|
|
44
|
$this->response('success', Code::SUCCESS, $info);
|
43
|
$this->response('success', Code::SUCCESS, $info);
|
|
45
|
}
|
44
|
}
|
|
|
|
45
|
+
|
|
|
|
46
|
+ /**
|
|
|
|
47
|
+ * @remark :保存产品
|
|
|
|
48
|
+ * @name :saveProduct
|
|
|
|
49
|
+ * @author :lyh
|
|
|
|
50
|
+ * @method :post
|
|
|
|
51
|
+ * @time :2024/3/20 11:09
|
|
|
|
52
|
+ */
|
|
|
|
53
|
+ public function saveProduct(){
|
|
|
|
54
|
+ $this->request->validate([
|
|
|
|
55
|
+ 'project_id'=>'required',
|
|
|
|
56
|
+ 'title'=>'required',
|
|
|
|
57
|
+ ],[
|
|
|
|
58
|
+ 'project_id.required' => 'project_id不能为空',
|
|
|
|
59
|
+ 'title.required' => 'keyword不能为空',
|
|
|
|
60
|
+ ]);
|
|
|
|
61
|
+ $project = ProjectServer::useProject($this->param['project_id']);
|
|
|
|
62
|
+ if (!$project) {
|
|
|
|
63
|
+ $this->response('项目不存在', Code::SYSTEM_ERROR);
|
|
|
|
64
|
+ }
|
|
|
|
65
|
+ try {
|
|
|
|
66
|
+ $param = [
|
|
|
|
67
|
+ 'project_id'=>$this->param['project_id'],
|
|
|
|
68
|
+ 'title'=>$this->param['title'],
|
|
|
|
69
|
+ 'intro'=>$this->param['intro'] ?? '',
|
|
|
|
70
|
+ 'content'=>$this->param['content'] ?? ''
|
|
|
|
71
|
+ ];
|
|
|
|
72
|
+ $productModel = new Product();
|
|
|
|
73
|
+ $productModel->add($param);
|
|
|
|
74
|
+ } catch (\Exception $e) {
|
|
|
|
75
|
+ LogUtils::error('Project Id: ' . $this->param['project_id'] . ' saveProduct error:' . $e->getMessage());
|
|
|
|
76
|
+ $this->response('保存失败,请联系管理员',Code::SYSTEM_ERROR);
|
|
|
|
77
|
+ }
|
|
|
|
78
|
+ $this->response('success');
|
|
|
|
79
|
+ }
|
|
46
|
} |
80
|
} |