正在显示
1 个修改的文件
包含
20 行增加
和
7 行删除
| @@ -25,17 +25,14 @@ class ATemplateController extends BaseController | @@ -25,17 +25,14 @@ class ATemplateController extends BaseController | ||
| 25 | * @method :post | 25 | * @method :post |
| 26 | * @time :2023/6/28 16:34 | 26 | * @time :2023/6/28 16:34 |
| 27 | */ | 27 | */ |
| 28 | - public function lists(ATemplateLogic $aTemplateLogic,TemplateLabel $templateLabel){ | ||
| 29 | - if(isset($this->map['label_name']) && !empty($this->map['label_name'])){ | ||
| 30 | - $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%']])->pluck('template_id')->toArray(); | ||
| 31 | - $this->map['id'] = ['in',$id_arr]; | ||
| 32 | - unset($this->map['label_name']); | ||
| 33 | - } | 28 | + public function lists(ATemplateLogic $aTemplateLogic){ |
| 29 | + $templateLabel = new TemplateLabel(); | ||
| 30 | + $this->searchLabelName($templateLabel); | ||
| 34 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; | 31 | $filed = ['id','name','image','url','status','sort','deleted_status','test_model','created_at','project_id']; |
| 35 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); | 32 | $lists = $aTemplateLogic->aTemplateList($this->map,$this->page,$this->row,$this->order,$filed); |
| 36 | if(!empty($lists) && !empty($lists['list'])){ | 33 | if(!empty($lists) && !empty($lists['list'])){ |
| 37 | foreach ($lists['list'] as $k => $v){ | 34 | foreach ($lists['list'] as $k => $v){ |
| 38 | - $v['label'] = $templateLabel->list(['template_id'=>$v['id']],'id',['id','name'],'desc',5); | 35 | + $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>1],'id',['id','name'],'desc',5); |
| 39 | $v['image_link'] = getImageUrl($v['image']); | 36 | $v['image_link'] = getImageUrl($v['image']); |
| 40 | $lists['list'][$k] = $v; | 37 | $lists['list'][$k] = $v; |
| 41 | } | 38 | } |
| @@ -44,6 +41,22 @@ class ATemplateController extends BaseController | @@ -44,6 +41,22 @@ class ATemplateController extends BaseController | ||
| 44 | } | 41 | } |
| 45 | 42 | ||
| 46 | /** | 43 | /** |
| 44 | + * @remark :搜索label | ||
| 45 | + * @name :searchLabelName | ||
| 46 | + * @author :lyh | ||
| 47 | + * @method :post | ||
| 48 | + * @time :2024/6/3 11:11 | ||
| 49 | + */ | ||
| 50 | + public function searchLabelName($templateLabel){ | ||
| 51 | + if(isset($this->map['label_name']) && !empty($this->map['label_name'])){ | ||
| 52 | + $id_arr = $templateLabel->formatQuery(['name'=>['like','%'.$this->map['label_name'].'%']])->pluck('template_id')->toArray(); | ||
| 53 | + $this->map['id'] = ['in',$id_arr]; | ||
| 54 | + unset($this->map['label_name']); | ||
| 55 | + } | ||
| 56 | + return true; | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + /** | ||
| 47 | * @remark :获取选择的模版 | 60 | * @remark :获取选择的模版 |
| 48 | * @name :getTemplateInfo | 61 | * @name :getTemplateInfo |
| 49 | * @author :lyh | 62 | * @author :lyh |
-
请 注册 或 登录 后发表评论