作者 李宇航

合并分支 'master-server' 到 'master'

修复查询module问题



查看合并请求 !642
@@ -28,9 +28,18 @@ class BTemplateModuleLogic extends BaseLogic @@ -28,9 +28,18 @@ class BTemplateModuleLogic extends BaseLogic
28 $map['status'] = 0; 28 $map['status'] = 0;
29 $list = $this->model->list($map,$order,$filed); 29 $list = $this->model->list($map,$order,$filed);
30 $templateLabel = new TemplateLabel(); 30 $templateLabel = new TemplateLabel();
31 - foreach ($list as $k => $v){  
32 - $v['label'] = $templateLabel->list(['template_id'=>$v['id'],'type'=>2],'id',['id','name'],'desc');  
33 - $list[$k] = $v; 31 + $label = [];
  32 + foreach ($list as $v){
  33 + $label[] = $v['id'];
  34 + }
  35 + $label_arr = $templateLabel->list(['template_id'=>['in',$label],'type'=>2],'id',['id','template_id','name'],'desc');
  36 + foreach ($list as $k1 => $v1){
  37 + foreach ($label_arr as $v2){
  38 + if($v2['template_id'] == $v1['id']){
  39 + $v1['label'] = $v2;
  40 + $list[$k1] = $v1;
  41 + }
  42 + }
34 } 43 }
35 return $this->success($list); 44 return $this->success($list);
36 } 45 }