...
|
...
|
@@ -50,48 +50,131 @@ class OrderDetail extends Backend |
|
|
return $this->selectpage();
|
|
|
}
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
$total = $this->model
|
|
|
->with(['user'])
|
|
|
->where('user_id',$ids)
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->count();
|
|
|
|
|
|
$list = $this->model
|
|
|
->with(['user'])
|
|
|
->where('user_id',$ids)
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->limit($offset, $limit)
|
|
|
->select();
|
|
|
|
|
|
$list = collection($list)->toArray();
|
|
|
$type = new \app\admin\model\Pic();
|
|
|
$video = new \app\admin\model\Video();
|
|
|
foreach ($list as &$v){
|
|
|
$type_ids = $type->whereIn('id',$v['pic_id'])->column('title');
|
|
|
if(!empty($v['video_id'])){
|
|
|
$a = [];
|
|
|
$v['video_id'] = unserialize($v['video_id']);
|
|
|
foreach ($v['video_id'] as &$v1){
|
|
|
|
|
|
$user = Db::name('user')->where('id',$ids)->find();
|
|
|
if($user['type'] == 1){
|
|
|
$type = new \app\admin\model\Pic();
|
|
|
$video = new \app\admin\model\Video();
|
|
|
|
|
|
//以往购买的订单
|
|
|
$one = Db::name('order')
|
|
|
->where('status',2)
|
|
|
->where('user_id',$ids)
|
|
|
->count();
|
|
|
$one_info = Db::name('order')
|
|
|
->where('status',2)
|
|
|
->where('user_id',$ids)
|
|
|
->field('createtime,paytime,shou_status,invoice_status',true)
|
|
|
->select();
|
|
|
foreach ($one_info as &$v){
|
|
|
$type_ids = $type->whereIn('id',$v['pic_id'])->column('title');
|
|
|
if(!empty($v['video_id'])){
|
|
|
$a = [];
|
|
|
$v['video_id'] = unserialize($v['video_id']);
|
|
|
foreach ($v['video_id'] as &$v1){
|
|
|
//获取视频标题
|
|
|
$v1['id'] = $video->where('id',$v1['id'])->column('title');
|
|
|
//判断视频属性
|
|
|
if($v1['attr'] == 1){
|
|
|
$v1['attr'] = '2k';
|
|
|
}elseif ($v1['attr'] == 2){
|
|
|
$v1['attr'] = '4k';
|
|
|
}else{
|
|
|
$v1['attr'] = '8k';
|
|
|
}
|
|
|
array_push($a,$v1['id']);
|
|
|
}
|
|
|
$v['video_id'] = $a;
|
|
|
}
|
|
|
$v['pic_id'] = trim(implode(',',$type_ids),',');
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//苹果登录后的订单
|
|
|
$two = Db::name('iphone')
|
|
|
->where('status',2)
|
|
|
->where('user_id',$ids)
|
|
|
->count();
|
|
|
$two_info = Db::name('iphone')
|
|
|
->where('status',2)
|
|
|
->where('user_id',$ids)
|
|
|
->field('createtime,updatetime',true)
|
|
|
->select();
|
|
|
foreach ($two_info as &$v){
|
|
|
$type_ids = $type->whereIn('id',$v['pic_id'])->column('title');
|
|
|
if(!empty($v['video_id'])){
|
|
|
$a = [];
|
|
|
$v['video_id'] = unserialize($v['video_id']);
|
|
|
|
|
|
//获取视频标题
|
|
|
$v1['id'] = $video->where('id',$v1['id'])->column('title');
|
|
|
$v['video_id']['id'] = $video->where('id',$v['video_id']['id'])->column('title');
|
|
|
//判断视频属性
|
|
|
if($v1['attr'] == 1){
|
|
|
$v1['attr'] = '2k';
|
|
|
}elseif ($v1['attr'] == 2){
|
|
|
$v1['attr'] = '4k';
|
|
|
if($v['video_id']['attr'] == 1){
|
|
|
$v['video_id']['attr'] = '2k';
|
|
|
}elseif ($v['video_id']['attr'] == 2){
|
|
|
$v['video_id']['attr'] = '4k';
|
|
|
}else{
|
|
|
$v1['attr'] = '8k';
|
|
|
$v['video_id']['attr'] = '8k';
|
|
|
}
|
|
|
array_push($a,$v1['id']);
|
|
|
array_push($a,$v['video_id']['id']);
|
|
|
$v['video_id'] = $a;
|
|
|
}
|
|
|
$v['video_id'] = $a;
|
|
|
$v['pic_id'] = trim(implode(',',$type_ids),',');
|
|
|
}
|
|
|
$v['pic_id'] = trim(implode(',',$type_ids),',');
|
|
|
|
|
|
|
|
|
$total = $one + $two; //总条数
|
|
|
$list = array_merge($one_info,$two_info);
|
|
|
|
|
|
$result = array("total" => $total, "rows" => $list);
|
|
|
return json($result);
|
|
|
}else{
|
|
|
$total = $this->model
|
|
|
->with(['user'])
|
|
|
->where('user_id',$ids)
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->count();
|
|
|
|
|
|
$list = $this->model
|
|
|
->with(['user'])
|
|
|
->where('user_id',$ids)
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->limit($offset, $limit)
|
|
|
->select();
|
|
|
|
|
|
$list = collection($list)->toArray();
|
|
|
$type = new \app\admin\model\Pic();
|
|
|
$video = new \app\admin\model\Video();
|
|
|
foreach ($list as &$v){
|
|
|
$type_ids = $type->whereIn('id',$v['pic_id'])->column('title');
|
|
|
if(!empty($v['video_id'])){
|
|
|
$a = [];
|
|
|
$v['video_id'] = unserialize($v['video_id']);
|
|
|
foreach ($v['video_id'] as &$v1){
|
|
|
//获取视频标题
|
|
|
$v1['id'] = $video->where('id',$v1['id'])->column('title');
|
|
|
//判断视频属性
|
|
|
if($v1['attr'] == 1){
|
|
|
$v1['attr'] = '2k';
|
|
|
}elseif ($v1['attr'] == 2){
|
|
|
$v1['attr'] = '4k';
|
|
|
}else{
|
|
|
$v1['attr'] = '8k';
|
|
|
}
|
|
|
array_push($a,$v1['id']);
|
|
|
}
|
|
|
$v['video_id'] = $a;
|
|
|
}
|
|
|
$v['pic_id'] = trim(implode(',',$type_ids),',');
|
|
|
}
|
|
|
$result = array("total" => $total, "rows" => $list);
|
|
|
return json($result);
|
|
|
}
|
|
|
$result = array("total" => $total, "rows" => $list);
|
|
|
return json($result);
|
|
|
|
|
|
|
|
|
}
|
|
|
$this->assignconfig('ids',$ids);
|
|
|
return $this->view->fetch();
|
...
|
...
|
|