作者 王智

baoxiu22

... ... @@ -71,11 +71,11 @@ class Index extends Api
$arr = Db::name('baoxiudan')->where($map)->where($map2)->where($map3)->where($map4)->page($param['pages'], $param['rows'])->order('id desc')->select();
$count = Db::name('baoxiudan')->where($map)->where($map2)->where($map3)->where($map4)->order('id desc')->select();
if (empty($arr)) {
$list = [
$List = [
'count' => 0,
'list' => []
];
$this->success('成功', $list);
$this->success('成功', $List);
die;
}
foreach ($arr as $k => $v) {
... ... @@ -88,6 +88,7 @@ class Index extends Api
// $list[$k]['time'] = $v['createtime']; //报修时间
$list[$k]['BankRed'] = $this->SizeRed($user_id, $v['id']); //标红
}
$List = $this->test($list);
if ($param['ids'] == 1) {
array_multisort(array_column($list, 'id'), SORT_ASC, $list);
}
... ... @@ -113,7 +114,7 @@ class Index extends Api
$list = [
'month' => $bools,
'count' => count($count),
'list' => $list
'list' => $List
];
$this->success('成功', $list);
}
... ...
... ... @@ -454,6 +454,17 @@ class Api
return $result;
}
//降序
public function test($person)
{
$newArr = array();
foreach ($person as $key => $v) {
$newArr[$key]['BankRed'] = $v['BankRed'];
}
array_multisort($newArr, SORT_DESC, $person);//SORT_DESC为降序,SORT_ASC为升序
return $person;
}
//标红
public function SizeRed($UserId, $OrderId)
{
... ...