|
@@ -14,6 +14,7 @@ use App\Http\Controllers\Bside\BaseController; |
|
@@ -14,6 +14,7 @@ use App\Http\Controllers\Bside\BaseController; |
|
14
|
use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic;
|
14
|
use App\Http\Logic\Bside\CustomModule\CustomModuleContentLogic;
|
|
15
|
use App\Models\CustomModule\CustomModuleCategory;
|
15
|
use App\Models\CustomModule\CustomModuleCategory;
|
|
16
|
use App\Models\CustomModule\CustomModuleContent;
|
16
|
use App\Models\CustomModule\CustomModuleContent;
|
|
|
|
17
|
+use App\Models\User\User;
|
|
17
|
|
18
|
|
|
18
|
class CustomModuleContentController extends BaseController
|
19
|
class CustomModuleContentController extends BaseController
|
|
19
|
{
|
20
|
{
|
|
@@ -32,8 +33,14 @@ class CustomModuleContentController extends BaseController |
|
@@ -32,8 +33,14 @@ class CustomModuleContentController extends BaseController |
|
32
|
]);
|
33
|
]);
|
|
33
|
$this->map['project_id'] = $this->user['project_id'];
|
34
|
$this->map['project_id'] = $this->user['project_id'];
|
|
34
|
$lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order);
|
35
|
$lists = $customModuleContent->lists($this->map,$this->page,$this->row,$this->order);
|
|
35
|
- foreach ($lists as $v){
|
|
|
|
36
|
- //获取分类名称
|
36
|
+ if(!empty($lists)){
|
|
|
|
37
|
+ $data = $this->getAllCategoryName();
|
|
|
|
38
|
+ foreach ($lists as $k=>$v){
|
|
|
|
39
|
+ $v['category_name'] = $this->categoryName($v['category_id'],$data);
|
|
|
|
40
|
+ $v['image_link'] = getImageUrl($v['image']);
|
|
|
|
41
|
+ $v['operator_name'] = (new User())->getName($v['operator_id']);
|
|
|
|
42
|
+ $lists[$k] = $v;
|
|
|
|
43
|
+ }
|
|
37
|
}
|
44
|
}
|
|
38
|
$this->response('success',Code::SUCCESS,$lists);
|
45
|
$this->response('success',Code::SUCCESS,$lists);
|
|
39
|
}
|
46
|
}
|
|
@@ -56,6 +63,27 @@ class CustomModuleContentController extends BaseController |
|
@@ -56,6 +63,27 @@ class CustomModuleContentController extends BaseController |
|
56
|
}
|
63
|
}
|
|
57
|
|
64
|
|
|
58
|
/**
|
65
|
/**
|
|
|
|
66
|
+ * @remark :获取分类名称
|
|
|
|
67
|
+ * @name :categoryName
|
|
|
|
68
|
+ * @author :lyh
|
|
|
|
69
|
+ * @method :post
|
|
|
|
70
|
+ * @time :2023/9/14 13:58
|
|
|
|
71
|
+ */
|
|
|
|
72
|
+ public function categoryName($category_id,$data){
|
|
|
|
73
|
+ $category_name = '';
|
|
|
|
74
|
+ if(!empty($category_id) && !empty($data)){
|
|
|
|
75
|
+ $arr = explode(',',trim($category_id,','));
|
|
|
|
76
|
+ foreach ($arr as $v){
|
|
|
|
77
|
+ if(isset($data[$v])){
|
|
|
|
78
|
+ $category_name .= $data[$v].',';
|
|
|
|
79
|
+ }
|
|
|
|
80
|
+ }
|
|
|
|
81
|
+ $category_name = trim($category_name,',');
|
|
|
|
82
|
+ }
|
|
|
|
83
|
+ return $category_name;
|
|
|
|
84
|
+ }
|
|
|
|
85
|
+
|
|
|
|
86
|
+ /**
|
|
59
|
* @remark :添加/编辑内容时获取分类
|
87
|
* @remark :添加/编辑内容时获取分类
|
|
60
|
* @name :getCategoryList
|
88
|
* @name :getCategoryList
|
|
61
|
* @author :lyh
|
89
|
* @author :lyh
|