作者 郭盛
1 个管道 的构建 通过 耗费 4 秒

修改全部订单

@@ -50,6 +50,86 @@ class OrderDetail extends Backend @@ -50,6 +50,86 @@ class OrderDetail extends Backend
50 return $this->selectpage(); 50 return $this->selectpage();
51 } 51 }
52 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 52 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
  53 +
  54 + $user = Db::name('user')->where('id',$ids)->find();
  55 + if($user['type'] == 1){
  56 + $type = new \app\admin\model\Pic();
  57 + $video = new \app\admin\model\Video();
  58 +
  59 + //以往购买的订单
  60 + $one = Db::name('order')
  61 + ->where('status',2)
  62 + ->where('user_id',$ids)
  63 + ->count();
  64 + $one_info = Db::name('order')
  65 + ->where('status',2)
  66 + ->where('user_id',$ids)
  67 + ->field('createtime,paytime,shou_status,invoice_status',true)
  68 + ->select();
  69 + foreach ($one_info as &$v){
  70 + $type_ids = $type->whereIn('id',$v['pic_id'])->column('title');
  71 + if(!empty($v['video_id'])){
  72 + $a = [];
  73 + $v['video_id'] = unserialize($v['video_id']);
  74 + foreach ($v['video_id'] as &$v1){
  75 + //获取视频标题
  76 + $v1['id'] = $video->where('id',$v1['id'])->column('title');
  77 + //判断视频属性
  78 + if($v1['attr'] == 1){
  79 + $v1['attr'] = '2k';
  80 + }elseif ($v1['attr'] == 2){
  81 + $v1['attr'] = '4k';
  82 + }else{
  83 + $v1['attr'] = '8k';
  84 + }
  85 + array_push($a,$v1['id']);
  86 + }
  87 + $v['video_id'] = $a;
  88 + }
  89 + $v['pic_id'] = trim(implode(',',$type_ids),',');
  90 + }
  91 +
  92 +
  93 +
  94 + //苹果登录后的订单
  95 + $two = Db::name('iphone')
  96 + ->where('status',2)
  97 + ->where('user_id',$ids)
  98 + ->count();
  99 + $two_info = Db::name('iphone')
  100 + ->where('status',2)
  101 + ->where('user_id',$ids)
  102 + ->field('createtime,updatetime',true)
  103 + ->select();
  104 + foreach ($two_info as &$v){
  105 + $type_ids = $type->whereIn('id',$v['pic_id'])->column('title');
  106 + if(!empty($v['video_id'])){
  107 + $a = [];
  108 + $v['video_id'] = unserialize($v['video_id']);
  109 +
  110 + //获取视频标题
  111 + $v['video_id']['id'] = $video->where('id',$v['video_id']['id'])->column('title');
  112 + //判断视频属性
  113 + if($v['video_id']['attr'] == 1){
  114 + $v['video_id']['attr'] = '2k';
  115 + }elseif ($v['video_id']['attr'] == 2){
  116 + $v['video_id']['attr'] = '4k';
  117 + }else{
  118 + $v['video_id']['attr'] = '8k';
  119 + }
  120 + array_push($a,$v['video_id']['id']);
  121 + $v['video_id'] = $a;
  122 + }
  123 + $v['pic_id'] = trim(implode(',',$type_ids),',');
  124 + }
  125 +
  126 +
  127 + $total = $one + $two; //总条数
  128 + $list = array_merge($one_info,$two_info);
  129 +
  130 + $result = array("total" => $total, "rows" => $list);
  131 + return json($result);
  132 + }else{
53 $total = $this->model 133 $total = $this->model
54 ->with(['user']) 134 ->with(['user'])
55 ->where('user_id',$ids) 135 ->where('user_id',$ids)
@@ -93,6 +173,9 @@ class OrderDetail extends Backend @@ -93,6 +173,9 @@ class OrderDetail extends Backend
93 $result = array("total" => $total, "rows" => $list); 173 $result = array("total" => $total, "rows" => $list);
94 return json($result); 174 return json($result);
95 } 175 }
  176 +
  177 +
  178 + }
96 $this->assignconfig('ids',$ids); 179 $this->assignconfig('ids',$ids);
97 return $this->view->fetch(); 180 return $this->view->fetch();
98 } 181 }