作者 郭盛
1 个管道 的构建 失败 耗费 9 秒

修改订单

@@ -65,14 +65,18 @@ class Iphone extends Backend @@ -65,14 +65,18 @@ class Iphone extends Backend
65 ->select(); 65 ->select();
66 66
67 foreach ($list as $row) { 67 foreach ($list as $row) {
68 -  
69 $row->getRelation('pic')->visible(['title']); 68 $row->getRelation('pic')->visible(['title']);
70 - $row->getRelation('video')->visible(['title']);  
71 } 69 }
72 $list = collection($list)->toArray(); 70 $list = collection($list)->toArray();
73 - foreach ($list as $k=>$v){  
74 - $list[$k]['user_id'] = Db::name('user')->where('id',$v['user_id'])->value('nickname');  
75 - $list[$k]['user_phone'] = Db::name('user')->where('id',$v['user_id'])->value('mobile'); 71 + foreach ($list as &$v){
  72 + if(!empty($v['video_id'])){
  73 + $video_id = unserialize($v['video_id']);
  74 + //获取视频标题
  75 + $v['video.title'] = Db::name('video')->where('id',$video_id['id'])->value('title');
  76 + }
  77 +
  78 + $v['user_id'] = Db::name('user')->where('id',$v['user_id'])->value('nickname');
  79 + $v['user_phone'] = Db::name('user')->where('id',$v['user_id'])->value('mobile');
76 } 80 }
77 $result = array("total" => $total, "rows" => $list); 81 $result = array("total" => $total, "rows" => $list);
78 82
@@ -257,10 +257,6 @@ class Order extends Backend @@ -257,10 +257,6 @@ class Order extends Backend
257 ->limit($offset, $limit) 257 ->limit($offset, $limit)
258 ->select(); 258 ->select();
259 259
260 - foreach ($list as $row) {  
261 -  
262 -  
263 - }  
264 $list = collection($list)->toArray(); 260 $list = collection($list)->toArray();
265 $type = new \app\admin\model\Pic(); 261 $type = new \app\admin\model\Pic();
266 $video = new \app\admin\model\Video(); 262 $video = new \app\admin\model\Video();