作者 lyh

'修改推荐供应商

@@ -33,13 +33,22 @@ class BTemplateModuleProjectLogic extends BaseLogic @@ -33,13 +33,22 @@ class BTemplateModuleProjectLogic extends BaseLogic
33 public function ModuleList($map,$order = 'created_at',$filed = ['id','name','status','image','html','project_id']){ 33 public function ModuleList($map,$order = 'created_at',$filed = ['id','name','status','image','html','project_id']){
34 $map['deleted_status'] = 0; 34 $map['deleted_status'] = 0;
35 $map['project_id'] = $this->user['project_id']; 35 $map['project_id'] = $this->user['project_id'];
36 - $lists = $this->model->list($map,$order,$filed); 36 + $list = $this->model->list($map,$order,$filed);
37 $templateLabel = new TemplateLabel(); 37 $templateLabel = new TemplateLabel();
38 - foreach ($lists as $k => $v){  
39 - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc');  
40 - $lists[$k] = $v; 38 + $label = [];
  39 + foreach ($list as $v){
  40 + $label[] = $v['id'];
41 } 41 }
42 - return $this->success($lists); 42 + $label_arr = $templateLabel->list(['template_id'=>['in',$label],'type'=>2],'id',['id','template_id','name'],'desc');
  43 + foreach ($list as $k1 => $v1){
  44 + foreach ($label_arr as $v2){
  45 + if($v2['template_id'] == $v1['id']){
  46 + $v1['label'] = $v2;
  47 + $list[$k1] = $v1;
  48 + }
  49 + }
  50 + }
  51 + return $this->success($list);
43 } 52 }
44 53
45 /** 54 /**