DetailController.php
2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* @remark :
* @name :DetailController.php
* @author :lyh
* @method :post
* @time :2024/11/12 14:55
*/
namespace App\Http\Controllers\Bside\Product;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Product\DetailLogic;
use App\Models\Product\Column;
use App\Models\Product\Detail;
class DetailController extends BaseController
{
/**
* @remark :获取产品描述页所有详情
* @name :getType
* @author :lyh
* @method :post
* @time :2024/11/12 14:57
*/
public function getType(Detail $detail){
$data = [
'text_type' => $detail->text_type(),
'line_two_type' => $detail->line_two_type(),
'image_two_type' => $detail->image_two_type(),
'three_type' => $detail->three_type(),
'image_three_type' => $detail->image_three_type(),
];
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :获取产品描述栏目
* @name :getColumn
* @author :lyh
* @method :post
* @time :2024/11/12 15:07
*/
public function getColumn(Column $column){
$data = $column->list($this->map,'id',['*'],'asc');
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存切换栏
* @name :saveColumn
* @author :lyh
* @method :post
* @time :2024/11/12 15:13
*/
public function saveColumn(DetailLogic $logic){
$this->request->validate([
'column_name'=>'required'
],[
'column_name.required' => '栏目名称不能为空'
]);
$data = $logic->saveColumn();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :saveDetail
* @author :lyh
* @method :post
* @time :2024/11/12 16:24
*/
public function saveDetail(){
$this->request->validate([
'product_id'=>'required',
'data'=>'required',
],[
'product_id.required' => '产品id不能为空',
'data.required' => 'data不能为空',
]);
}
}