|
@@ -27,36 +27,36 @@ class ProductLogic extends BaseLogic |
|
@@ -27,36 +27,36 @@ class ProductLogic extends BaseLogic |
|
27
|
$this->model = new Product();
|
27
|
$this->model = new Product();
|
|
28
|
}
|
28
|
}
|
|
29
|
|
29
|
|
|
30
|
- public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $row = 20)
|
|
|
|
31
|
- {
|
|
|
|
32
|
- $data = parent::getList($map, $sort, $columns, $row);
|
|
|
|
33
|
- foreach ($data['list'] as &$v){
|
|
|
|
34
|
- $v = $this->formatData($v);
|
|
|
|
35
|
- }
|
|
|
|
36
|
- return $this->success($data);
|
|
|
|
37
|
- }
|
|
|
|
38
|
-
|
|
|
|
39
|
- public function getInfo($id)
|
|
|
|
40
|
- {
|
|
|
|
41
|
- $info = $this->model->read(['id'=>$id]);
|
|
|
|
42
|
- $info = $this->formatData($info);
|
|
|
|
43
|
- return $this->success($info);
|
|
|
|
44
|
- }
|
30
|
+// public function getList(array $map = [], array $sort = ['id' => 'desc'], array $columns = ['*'], int $row = 20)
|
|
|
|
31
|
+// {
|
|
|
|
32
|
+// $data = parent::getList($map, $sort, $columns, $row);
|
|
|
|
33
|
+// foreach ($data['list'] as &$v){
|
|
|
|
34
|
+// $v = $this->formatData($v);
|
|
|
|
35
|
+// }
|
|
|
|
36
|
+// return $this->success($data);
|
|
|
|
37
|
+// }
|
|
|
|
38
|
+//
|
|
|
|
39
|
+// public function getInfo($id)
|
|
|
|
40
|
+// {
|
|
|
|
41
|
+// $info = $this->model->read(['id'=>$id]);
|
|
|
|
42
|
+// $info = $this->formatData($info);
|
|
|
|
43
|
+// return $this->success($info);
|
|
|
|
44
|
+// }
|
|
45
|
|
45
|
|
|
46
|
- public function formatData($info){
|
|
|
|
47
|
- foreach ($info['category_id'] as $category_id) {
|
|
|
|
48
|
- $info['category_id_text'][] = (new CategoryLogic())->getCacheInfo($category_id)['title'] ?? '';
|
|
|
|
49
|
- }
|
|
|
|
50
|
- foreach ($info['keyword_id'] as $keyword_id){
|
|
|
|
51
|
- $info['keyword_id_text'][] =(new KeywordLogic())->getCacheInfo($keyword_id)['title']??'';
|
|
|
|
52
|
- }
|
|
|
|
53
|
- $info['category_id_text'] = Arr::arrToSet($info['category_id_text'], 'trim');
|
|
|
|
54
|
- $info['keyword_id_text'] = Arr::arrToSet($info['keyword_id_text'], 'trim');
|
|
|
|
55
|
- $info['status_text'] = Product::statusMap()[$info['status']] ?? '';
|
|
|
|
56
|
- $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? '';
|
|
|
|
57
|
- $info['url'] = $this->user['domain'] . $info['route'] ;
|
|
|
|
58
|
- return $info;
|
|
|
|
59
|
- }
|
46
|
+// public function formatData($info){
|
|
|
|
47
|
+// foreach ($info['category_id'] as $category_id) {
|
|
|
|
48
|
+// $info['category_id_text'][] = (new CategoryLogic())->getCacheInfo($category_id)['title'] ?? '';
|
|
|
|
49
|
+// }
|
|
|
|
50
|
+// foreach ($info['keyword_id'] as $keyword_id){
|
|
|
|
51
|
+// $info['keyword_id_text'][] =(new KeywordLogic())->getCacheInfo($keyword_id)['title']??'';
|
|
|
|
52
|
+// }
|
|
|
|
53
|
+// $info['category_id_text'] = Arr::arrToSet($info['category_id_text'], 'trim');
|
|
|
|
54
|
+// $info['keyword_id_text'] = Arr::arrToSet($info['keyword_id_text'], 'trim');
|
|
|
|
55
|
+// $info['status_text'] = Product::statusMap()[$info['status']] ?? '';
|
|
|
|
56
|
+// $info['created_uid_text'] = (new UserLogic())->getCacheInfo($info['created_uid'])['name'] ?? '';
|
|
|
|
57
|
+// $info['url'] = $this->user['domain'] . $info['route'] ;
|
|
|
|
58
|
+// return $info;
|
|
|
|
59
|
+// }
|
|
60
|
|
60
|
|
|
61
|
public function save($param){
|
61
|
public function save($param){
|
|
62
|
//封面取第一个图片
|
62
|
//封面取第一个图片
|