"下游公司", "2"=>"下游个人", "3"=>"上游公司" ]; public $IsPayment = [ "1"=>"是", "2"=>"否" ]; public $PayStatus=[ "-1"=>"打款失败", "0"=>"未打款", "1"=>"打款成功" ]; public $VerifyStatus=[ "-1"=>"审批拒绝", "0"=>"未审批", "1"=>"审批通过", ]; public function lists() { $params = I('get.'); $page = $params['p'] ? intval($params['p']) : 1; $row = $params['row'] ? intval($params['row']) : 10; //权限分配 if(!IS_ROOT){ $this->OpAuthList= getModuleControllerAuth(); } $this->assign('menubtn',$this->menuAuth()); $map = [ "c.verify_status"=>2 ]; if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $time_start = strtotime($_REQUEST['time_start']); $time_end = strtotime($_REQUEST['time_end'])+ 86399; $map["_string"] = "(c.statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (c.statement_end_time BETWEEN {$time_start} AND {$time_end}) OR (c.statement_begin_time <= {$time_end} AND c.statement_end_time >= {$time_end})"; } elseif (isset($_REQUEST['time_start'])) { $time_start = strtotime($_REQUEST['time_start']); $map["_string"] = "(c.statement_begin_time >= {$time_start} ) OR (c.statement_end_time >= {$time_start})"; } elseif (isset($_REQUEST['time_end'])) { $time_end = strtotime($_REQUEST['time_end'])+ 86399; $map["_string"] = "(c.statement_begin_time <= {$time_end} ) OR (c.statement_end_time <= {$time_end})"; } //其他 if(isset($_REQUEST['company_type'])){ $map['c.company_type'] = $_REQUEST['company_type']; } if(isset($_REQUEST['company_name'])){ $map['c.company_name'] =["LIKE","%{$_REQUEST['company_name']}%"]; } // if(isset($_REQUEST['statement_pool_num'])){ // $map['statement_pool_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"]; // } // if(isset($_REQUEST['is_payment'])){ // $map['is_payment'] = $_REQUEST['is_payment']; // } // $this->checkListOrCountAuthRestMap($map);//导出权限 //条件end $data = M("company_statement_info","tab_") ->alias("c") ->field("c.*,p.statement_num,p.verify_status") ->where($map) ->join("left join tab_company_statement_pool as p ON c.pool_id = p.id") ->page($page,$row) ->order("id desc") ->select(); foreach($data as $k => &$v) { $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']); $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']); $v['company_type_str'] = $this->CompanyType[$v['company_type']]; $v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}"; $v["pay_status_str"] = $this->PayStatus[$v["pay_status"]]; if($v["verify_status"] < 0){ $v["verify_status"] = -1; } if($v["verify_status"] > 0){ $v["verify_status"] = 1; } $v["verify_status_str"] = $this->VerifyStatus[$v["verify_status"]]; $v['oplist'] = $this->OpAuth($v); } $count = M("company_statement_info","tab_")->alias("c")->field("count(id) count,sum(statement_money) statement_money")->where($map)->find(); // dd($count); $params['p'] = $page; $params['row'] = $row; $page = set_pagination($count['count'], $row, $params); if ($page) { $this->assign('_page', $page); } // dd($data); $this->assign('data',$data); $this->assign('count',$count); $this->assign('CompanyType',$this->CompanyType); $this->display(); } public function OpAuth($info) { $id = $info['id']; $type = $info['company_type']; //原始列表 $opBtn = [ "viewStatement"=>"查看", ]; //操作对应菜单 $optist = ["viewStatement"]; $resarr = []; foreach ($optist as $k => $v) { if(IS_ROOT){ $resarr[] = $opBtn[$v]; }else{ if(in_array($v,$this->OpAuthList)){ $resarr[] = $opBtn[$v]; } } } return $resarr; } public function menuAuth() { $mentBtn = [ "pool"=>"发起汇总", "export"=>"批量导出" ]; $resarr = []; foreach ($mentBtn as $k => $v) { if(IS_ROOT){ $resarr[] = $v; }else{ if(in_array($k,$this->OpAuthList)){ $resarr[] = $v; } } } return $resarr; } }