作者 王智

baoxiu22

@@ -71,11 +71,11 @@ class Index extends Api @@ -71,11 +71,11 @@ class Index extends Api
71 $arr = Db::name('baoxiudan')->where($map)->where($map2)->where($map3)->where($map4)->page($param['pages'], $param['rows'])->order('id desc')->select(); 71 $arr = Db::name('baoxiudan')->where($map)->where($map2)->where($map3)->where($map4)->page($param['pages'], $param['rows'])->order('id desc')->select();
72 $count = Db::name('baoxiudan')->where($map)->where($map2)->where($map3)->where($map4)->order('id desc')->select(); 72 $count = Db::name('baoxiudan')->where($map)->where($map2)->where($map3)->where($map4)->order('id desc')->select();
73 if (empty($arr)) { 73 if (empty($arr)) {
74 - $list = [ 74 + $List = [
75 'count' => 0, 75 'count' => 0,
76 'list' => [] 76 'list' => []
77 ]; 77 ];
78 - $this->success('成功', $list); 78 + $this->success('成功', $List);
79 die; 79 die;
80 } 80 }
81 foreach ($arr as $k => $v) { 81 foreach ($arr as $k => $v) {
@@ -88,6 +88,7 @@ class Index extends Api @@ -88,6 +88,7 @@ class Index extends Api
88 // $list[$k]['time'] = $v['createtime']; //报修时间 88 // $list[$k]['time'] = $v['createtime']; //报修时间
89 $list[$k]['BankRed'] = $this->SizeRed($user_id, $v['id']); //标红 89 $list[$k]['BankRed'] = $this->SizeRed($user_id, $v['id']); //标红
90 } 90 }
  91 + $List = $this->test($list);
91 if ($param['ids'] == 1) { 92 if ($param['ids'] == 1) {
92 array_multisort(array_column($list, 'id'), SORT_ASC, $list); 93 array_multisort(array_column($list, 'id'), SORT_ASC, $list);
93 } 94 }
@@ -113,7 +114,7 @@ class Index extends Api @@ -113,7 +114,7 @@ class Index extends Api
113 $list = [ 114 $list = [
114 'month' => $bools, 115 'month' => $bools,
115 'count' => count($count), 116 'count' => count($count),
116 - 'list' => $list 117 + 'list' => $List
117 ]; 118 ];
118 $this->success('成功', $list); 119 $this->success('成功', $list);
119 } 120 }
@@ -454,6 +454,17 @@ class Api @@ -454,6 +454,17 @@ class Api
454 return $result; 454 return $result;
455 } 455 }
456 456
  457 + //降序
  458 + public function test($person)
  459 + {
  460 + $newArr = array();
  461 + foreach ($person as $key => $v) {
  462 + $newArr[$key]['BankRed'] = $v['BankRed'];
  463 + }
  464 + array_multisort($newArr, SORT_DESC, $person);//SORT_DESC为降序,SORT_ASC为升序
  465 + return $person;
  466 + }
  467 +
457 //标红 468 //标红
458 public function SizeRed($UserId, $OrderId) 469 public function SizeRed($UserId, $OrderId)
459 { 470 {