where(['id'=>get_pid()])->find(); $this->assign("promote_data",$promote_data); $data = M("company_statement_info","tab_") ->field("tab_company_statement_info.*") ->join("left join tab_promote_company company on tab_company_statement_info.company_id=company.id") ->join("left join tab_promote promote on company.id=promote.company_id") ->page($page,$row) ->where($map) ->select(); foreach ($data as $key => $value) { $data[$key]['time'] = date("Y-m-d H:i:s",$value["statement_begin_time"])."-".date("Y-m-d H:i:s",$value["statement_end_time"]); } $parameter =I('get.'); $parameter['p']=I('get.p',1); $parameter['row']=I('get.row'); $count = M("company_statement_info","tab_") ->field("tab_company_statement_info.*") ->join("left join tab_promote_company company on tab_company_statement_info.company_id=company.id") ->join("left join tab_promote promote on company.id=promote.company_id") ->where($map) ->count(); $page = set_pagination($count,$row,$parameter); if($page) {$this->assign('_page', $page);} $this->assign("data",$data); $this->display(); } //执行打款 public function doPayment() { $this->ajaxReturn(["msg"=>"打款成功","data"=>[],"status"=>1]);die(); $id = $_REQUEST['id']; $remark = $_REQUEST['remark']; var_dump(1);die(); Vendor("Alipay2020/Fund"); $fund = new \Fund(); // $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find(); $company_info = json_decode($dbres['company_info'],true); //TODO:未进行真实打款 if($dbres['pay_status'] != 1 && $dbres['verify_status'] == 1){ //执行打款 $title = "测试-".$dbres['company_name']."结算"; $amount = $dbres['statement_money']; $amount = 0.1;//测试金额为0 $payres = $fund->transfer($company_info['ali_account'],$company_info['ali_user'],$dbres['statement_num'],$amount, $title); $resultCode = $payres->code; $savedata = ["id"=>$dbres['id']]; if(!empty($resultCode)&&$resultCode == 10000){ $savedata["pay_status"]=1; } else { $savedata["pay_status"]=-1; } $payres = json_decode( json_encode($payres),true); $payres["remark"] = $remark; $savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE); $savedata["pay_type"]=2; $savedata["pay_time"]=time(); } else { $this->ajaxReturn(["msg"=>"已经打款过","data"=>[],"status"=>0]); } M("company_statement_info","tab_")->save($savedata); $this->ajaxReturn(["msg"=>"打款成功","data"=>[],"status"=>1]); # code... } public function withdrawDetail() { $id = $_REQUEST["id"]; $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find(); $company_info = json_decode($dbres['company_info'],true); $statemnt_info = json_decode($dbres['statement_info'],true); $dbres['pay_time'] = date("Y-m-d H:i:s",$dbres['pay_time']); $dbres['statement_begin_time'] = date("Y-m-d",$dbres['statement_begin_time']); $dbres['statement_end_time'] = date("Y-m-d",$dbres['statement_end_time']); $dbres['hletter_amount'] = convertAmountToCn($dbres['statement_money']); // dump($company_info); // dump($statemnt_info);die(); $rowspan = count($statemnt_info); $this->assign("data",$dbres); $this->assign("rowspan",$rowspan); $this->assign("company_info",$company_info); $this->assign("statemnt_info",$statemnt_info); $this->display("withdrawdetail"); } public function withdrawOrderDetail($p=0) { $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 $row=10; if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} $start = $_REQUEST['start']; $end = $_REQUEST['end']; $game_map['relation_game_id'] = $_REQUEST['relation_game_id']; $game_id = M("game","tab_")->field("id")->where($game_map)->select(); $game_id = array_column($game_id,'id'); $map['pay_time'] = ['between',[strtotime($start),strtotime($end)+86399]]; $map['game_id'] = ['in',$game_id]; if ($_REQUEST['team_leader_id']||$_REQUEST['team_leader_id']=="0") { $map['promote_id'] = $_REQUEST['team_leader_id']; } if(!empty($_REQUEST['start'])&&empty($_REQUEST['end'])){ $map['pay_time'] = array('GT',strtotime($_REQUEST['start'])); unset($_REQUEST['start']); } if(empty($_REQUEST['start'])&&!empty($_REQUEST['end'])){ $map['pay_time'] = array('LT',strtotime($_REQUEST['end'])+24*60*60-1); unset($_REQUEST['end']); } if(!empty($_REQUEST['start'])&&!empty($_REQUEST['end'])){ $map['pay_time'] = array('between',[strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1]); unset($_REQUEST['start']);unset($_REQUEST['end']); } if($_REQUEST['pay_order_number']) { $map['pay_order_number'] = ['like',"%{$_REQUEST['pay_order_number']}%"]; } if (!$game_id) { $this->error("游戏不存在"); } $data = M("spend","tab_") ->where($map) ->page($page,$row) ->select(); foreach ($data as $key => $value) { $data[$key]['pay_time'] = date("Y-m-d H:i:s",$data[$key]['pay_time']); if ($value['promote_account'] == "官方渠道") { $data[$key]['promote_account'] = "江息网络"; } } $parameter =I('get.'); $parameter['p']=I('get.p',1); $parameter['row']=I('get.row'); $count = M("spend","tab_") ->where($map) ->count(); $page = set_pagination($count,$row,$parameter); if($page) {$this->assign('_page', $page);} $this->assign('data',$data); $this->display("withdraworderdetail"); } }