"审核拒绝", "0"=>"未申请开票", "1"=>"申请开票", "2"=>"审核同意", "3"=>"已开票", "4"=>"上传收款凭证", "5"=>"已到账" ]; public function lists() { $is_export= false; if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ $is_export = true; } $page = intval(I('get.p', 0)); $page = $page ? $page : 1; //默认显示第一页数据 $row = intval(I('row', 0)); $row = empty($row) ? 10 : $row;//每页条数 $map = []; if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $map["_string"] = "(begintime BETWEEN {$_REQUEST['time_start']} AND {$_REQUEST['time_end']}) OR (endtime BETWEEN {$_REQUEST['time_start']} AND {$_REQUEST['time_end']})"; } elseif (isset($_REQUEST['time_start'])) { $map["_string"] = "(begintime >= {$_REQUEST['time_start']} ) OR (endtime >= {$_REQUEST['time_end']})"; } elseif (isset($_REQUEST['time_end'])) { $map["_string"] = "(begintime <= {$_REQUEST['time_start']} ) OR (endtime <= {$_REQUEST['time_end']})"; } if ($_REQUEST['verify_status']) { $map['verify_status'] = $_REQUEST['verify_status']; } if ($_REQUEST['channel_id']) { $map['channel_id'] = $_REQUEST['channel_id']; } if ($_REQUEST['withdraw_type']) { $map['withdraw_type'] = $_REQUEST['withdraw_type']; } $data = M("aggregate_statement","tab_") ->where($map) ->order("create_time Desc"); if($is_export){ $data = $data->select(); }else{ $data = $data->page($page,$row)->select(); } foreach($data as $key => $value) { $data[$key]['verify_status_str'] = $this->verify_status[$value['verify_status']]; $data[$key]['create_time'] = date('Y-m-d H:i:s',$value['create_time']); $data[$key]['begintime'] = date('Y-m-d H:i:s',$value['begintime']); $data[$key]['endtime'] = date('Y-m-d H:i:s',$value['endtime']); } $count = M("aggregate_statement","tab_")->field("count(id) count,SUM(ratio_money) ratio_money")->where($map)->find(); // // var_dump($data);die(); // foreach ($data as $key => $value) { // $data[$key]['order'] = json_decode($value['second_party_info'],true)['order_type']; // } // $sumData = M("statement","tab_") // ->field('sum(`statement_money`) as sum_money,statement_type') // ->where($map) // ->group('statement_type') // ->select(); // $handleSumData = []; // foreach ($sumData as $key => $value) { // $handleSumData[$value['statement_type']] = $value['sum_money']; // } // if (!$handleSumData[1]) { // $handleSumData[1] = 0; // } // if (!$handleSumData[0]) { // $handleSumData[0] = 0; // } // $this->assign('sum',$handleSumData); // // dump($sumData);die(); //分页 $parameter['p'] = $page; $parameter['row'] = $row; $page = set_pagination($count, $row, $parameter); if ($page) { $this->assign('_page', $page); } // $this->meta_title = '结算单管理'; $this->assign('data',$data); $this->assign('channel',$this->getAggChannel()); $this->assign('verify_status',$this->verify_status); $this->display(); } //获取所有下游渠道 public function getAggChannel() { return M("aggregate_statement","tab_")->field("channel_id,channel_name")->group("channel_id")->select(); # code... } }