From b664ba46ad92d8701e08a1db38e4dc1395e975d7 Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Mon, 22 Jun 2020 11:30:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B1=87=E6=80=BB=E5=8D=95=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PromoteController.class.php | 4 + Application/Admin/View/Promote/add.html | 2 +- Application/Admin/View/Promote/edit.html | 8 +- Application/Home/Common/function.php | 9 +- .../Controller/DownloadController.class.php | 23 ++++- .../Controller/WithdrawController.class.php | 99 +++++++++++++++++-- .../Home/View/default/Withdraw/index.html | 2 +- .../View/default/Withdraw/withdrawdetail.html | 63 ++++++------ .../default/Withdraw/withdraworderdetail.html | 4 +- Data/update.sql | 2 +- 10 files changed, 163 insertions(+), 53 deletions(-) diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index 974f997c6..7b3ecd2b8 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -391,6 +391,10 @@ class PromoteController extends ThinkController $use = new UserApi(); $data['password']=think_ucenter_md5($pwd, UC_AUTH_KEY); $data['second_pwd']=think_ucenter_md5($second_pwd, UC_AUTH_KEY); + + $data['withdraw_show'] = $_POST['withdraw_show']; + $data['withdraw_done'] = $_POST['withdraw_done']; + if (empty($pwd)) { unset($data['password']); } diff --git a/Application/Admin/View/Promote/add.html b/Application/Admin/View/Promote/add.html index 8de32875c..91b2935c5 100644 --- a/Application/Admin/View/Promote/add.html +++ b/Application/Admin/View/Promote/add.html @@ -150,7 +150,7 @@ 开启 diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html index ac71a0bdc..73dafb92a 100644 --- a/Application/Admin/View/Promote/edit.html +++ b/Application/Admin/View/Promote/edit.html @@ -294,10 +294,10 @@ @@ -308,10 +308,10 @@ diff --git a/Application/Home/Common/function.php b/Application/Home/Common/function.php index 9585971f8..c985dbcfa 100644 --- a/Application/Home/Common/function.php +++ b/Application/Home/Common/function.php @@ -1324,13 +1324,16 @@ function getAvailableBalance($promote_id=0,$game_id=0,$server_id='') { } /** - * 获取测试资源可用余额 - * promote_id=>推广员id, - * game_id=>游戏id, + * 获取同一个公司的会长 + * $promoteType=>推广员等级, */ function getPromoteLists($promoteType = 1) { $map['level'] = $promoteType; + $company = M('promote','tab_')->field("company_id")->where(['id'=>get_pid()])->find(); + + $map['company_id'] = $company['company_id']; + $data = M('promote','tab_') ->field('id,account,real_name') ->where($map) diff --git a/Application/Home/Controller/DownloadController.class.php b/Application/Home/Controller/DownloadController.class.php index 42dfc0fe9..08225978b 100644 --- a/Application/Home/Controller/DownloadController.class.php +++ b/Application/Home/Controller/DownloadController.class.php @@ -2224,7 +2224,7 @@ class DownloadController extends BaseController { case "汇总单信息": $this->WithdrawIndexExcelInfo($id,$map); break; - case "结算单详情": + case "结算单明细": $this->WithdrawOrderExcelInfo($id,$map); break; default: @@ -4816,14 +4816,31 @@ public function iosDetailExcelInfo($id,$map) { $game_id = M("game","tab_")->field("id")->where($game_map)->select(); + $promote_data = []; + $promote_id = M("promote","tab_")->field("id")->where(['company_id'=>$_REQUEST['company_id']])->select(); + foreach ($promote_id as $key => $value) { + $promote_data[] = $value['id']; + $data = M("promote","tab_")->field("id")->where(['chain'=>['like',"/{$value['id']}/"]])->select(); + foreach ($data as $k => $v) { + $promote_data[] = $v['id']; + } + + } + + if ($promote_data) { + $map['promote_id'] = ['in',$promote_data]; + } + $game_id = array_column($game_id,'id'); + $map['pay_status'] = 1; $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 ($_REQUEST['team_leader_id']) { + $promote_id = M("promote","tab_")->field("id")->where("id = {$_REQUEST['team_leader_id']} or chain like '%/{$_REQUEST['team_leader_id']}/%'")->select(); + $map['promote_id'] = ['in',array_column($promote_id,'id')]; } if(!empty($_REQUEST['start'])&&empty($_REQUEST['end'])){ diff --git a/Application/Home/Controller/WithdrawController.class.php b/Application/Home/Controller/WithdrawController.class.php index 574c398d4..f74c2a8f5 100644 --- a/Application/Home/Controller/WithdrawController.class.php +++ b/Application/Home/Controller/WithdrawController.class.php @@ -91,26 +91,25 @@ class WithdrawController extends BaseController { - $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(); +// $this->ajaxReturn(["msg"=>"打款成功","data"=>$dbres,"status"=>1]);die(); $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 +// $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; @@ -122,22 +121,84 @@ var_dump(1);die(); $payres["remark"] = $remark; $savedata["pay_info"] = json_encode($payres,JSON_UNESCAPED_UNICODE); - $savedata["pay_type"]=2; + $savedata["pay_type"]=1; $savedata["pay_time"]=time(); } else { - $this->ajaxReturn(["msg"=>"已经打款过","data"=>[],"status"=>0]); + $this->poolCount($dbres['pool_id']); + $this->ajaxReturn(["msg"=>"已经打款过","data"=>$dbres,"status"=>0]); } + $this->poolCount($dbres['pool_id']); M("company_statement_info","tab_")->save($savedata); - $this->ajaxReturn(["msg"=>"打款成功","data"=>[],"status"=>1]); + $this->ajaxReturn(["msg"=>"打款成功","data"=>$dbres,"status"=>1]); # code... } + /** + * 执行最后聚合表统计 + * 整合数据,全部成功则支付成功,否则为支付中 + */ + public function poolCount($poolid){ + $pool_id = $poolid; + $CompanyInfo = M("company_statement_info","tab_"); + if(count($pool_id) > 0){ + foreach($pool_id as $k=>$v){ + $f = $CompanyInfo->where("pool_id = {$v} AND pay_status <> 1")->find(); + if(empty($f)){ + //全部完成 + $this->setOneVerifyStatus(4,"payment",$v); + }else{ + //打款中 + $this->setOneVerifyStatus(3,"payment",$v); + } + } + } + $this->ajaxReturn(["success"=>"打款成功","data"=>[]]); + } + + protected function setOneVerifyStatus($change_status,$op_pre,$id) + { + $dbres = M("company_statement_pool","tab_")->field("id,verify_status,verify_log")->where("id = {$id}")->find(); + $dbres['verify_log'] = json_decode($dbres['verify_log'],true); + $dbres['verify_log'][$op_pre.'_user']=$this->admininfo["mobile"]; + $dbres['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s"); + $dbres['verify_log'] = json_encode($dbres['verify_log']); + $dbres['verify_status']=$change_status; + M("company_statement_pool","tab_")->save($dbres); + } + public function withdrawDetail() { $id = $_REQUEST["id"]; - $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->find(); + $dbres = M("company_statement_info","tab_") + ->field("*,tab_company_statement_info.id") + ->join("left join tab_promote_company company on tab_company_statement_info.company_id=company.id") + ->where("tab_company_statement_info.id='{$id}'")->find(); + +// dump($dbres);die(); + + $relation = M("company_relation","tab_")->where("second_company_id={$dbres['company_id']}")->find(); + + if (!$relation) { + $this->error("乙方关联信息不存在!"); + } + + if ($relation['invoice_type']==1) { + $relation['invoice_type'] = "专票"; + } else if ($relation['invoice_type'] == 2) { + $relation['invoice_type'] = "普票"; + } else { + $relation['invoice_type'] = "无"; + } + + $first_companmInfo = M("company_info","tab_")->where("id={$relation['first_company_id']}")->find(); + if (!$first_companmInfo) { + $this->error("甲方公司信息不存在!"); + } + + $this->assign("relation",$relation); + $this->assign("first_company_info",$first_companmInfo); $company_info = json_decode($dbres['company_info'],true); $statemnt_info = json_decode($dbres['statement_info'],true); @@ -175,14 +236,31 @@ var_dump(1);die(); $game_id = M("game","tab_")->field("id")->where($game_map)->select(); + $promote_data = []; + $promote_id = M("promote","tab_")->field("id")->where(['company_id'=>$_REQUEST['company_id']])->select(); + foreach ($promote_id as $key => $value) { + $promote_data[] = $value['id']; + $data = M("promote","tab_")->field("id")->where(['chain'=>['like',"/{$value['id']}/"]])->select(); + foreach ($data as $k => $v) { + $promote_data[] = $v['id']; + } + + } + + if ($promote_data) { + $map['promote_id'] = ['in',$promote_data]; + } + $game_id = array_column($game_id,'id'); $map['pay_time'] = ['between',[strtotime($start),strtotime($end)+86399]]; + $map['pay_status'] = 1; $map['game_id'] = ['in',$game_id]; - if ($_REQUEST['team_leader_id']||$_REQUEST['team_leader_id']=="0") { - $map['promote_id'] = $_REQUEST['team_leader_id']; + if ($_REQUEST['team_leader_id']) { + $promote_id = M("promote","tab_")->field("id")->where("id = {$_REQUEST['team_leader_id']} or chain like '%/{$_REQUEST['team_leader_id']}/%'")->select(); + $map['promote_id'] = ['in',array_column($promote_id,'id')]; } if(!empty($_REQUEST['start'])&&empty($_REQUEST['end'])){ @@ -209,6 +287,7 @@ var_dump(1);die(); ->where($map) ->page($page,$row) ->select(); +// var_dump($data);die(); foreach ($data as $key => $value) { $data[$key]['pay_time'] = date("Y-m-d H:i:s",$data[$key]['pay_time']); diff --git a/Application/Home/View/default/Withdraw/index.html b/Application/Home/View/default/Withdraw/index.html index 8e0ac3c35..45a695edc 100644 --- a/Application/Home/View/default/Withdraw/index.html +++ b/Application/Home/View/default/Withdraw/index.html @@ -214,7 +214,7 @@ 打款成功 - + 提现 结算单详情 diff --git a/Application/Home/View/default/Withdraw/withdrawdetail.html b/Application/Home/View/default/Withdraw/withdrawdetail.html index d2750c2f7..8de22288b 100644 --- a/Application/Home/View/default/Withdraw/withdrawdetail.html +++ b/Application/Home/View/default/Withdraw/withdrawdetail.html @@ -207,39 +207,43 @@ - {$s['statement_begin_time']}-{$s['statement_end_time']} - {$s['game_name']} - {$s['sum_money']} - 0{$s['ratio']} - 0{$s['increment_ratio']} - {$s['fax_ratio']} - {$s['pay_amount']} + {$s['statement_begin_time']|default="无"}-{$s['statement_end_time']|default="无"} + {$s['game_name']|default="无"} + + + {$s['pay_amount']|default="0"} + + + 0%{$s['ratio']|default="0"}% + 0%{$s['increment_ratio']|default="0"}% + {$s['fax_ratio']|default="0"}% + {$s['sum_money']|default="0"} - {$data['statement_begin_time']}-{$data['statement_end_time']} + {$data['statement_begin_time']|default="无"}-{$data['statement_end_time']|default="无"} 罚款 - {$data['fine']} + {$data['fine']|default="0"} - {$data['fine']} + {$data['fine']|default="0"} - {$data['statement_begin_time']}-{$data['statement_end_time']} + {$data['statement_begin_time']|default="无"}-{$data['statement_end_time']|default="无"} 奖励 - {$data['reward']} + {$data['reward']|default="0"} - {$data['reward']} + {$data['reward']|default="0"} 合计 - {$data['pay_amount']} + {$data['pay_amount']|default="0"} @@ -253,7 +257,7 @@ 支付金额(大写): - {$data['hletter_amount']} + {$data['hletter_amount']|default="0"} @@ -268,65 +272,65 @@ 甲方: - + {$first_company_info['partner']|default="无"} 乙方: - {$company_info['partner']} + {$company_info['partner']|default="无"} 联系人: - + {$first_company_info['link_man']|default="无"} 联系人: - {$company_info['link_man']} + {$company_info['link_man']|default="无"} 联系电话: - + {$first_company_info['link_phone']|default="无"} 联系电话: - {$company_info['link_phone']} + {$company_info['link_phone']|default="无"} 开票项目 - + {$relation['invoice_content']|default="无"} 邮寄地址 - + {$data['address']|default="无"} 发票类型 - + {$relation['invoice_type']|default="无"} 请汇入此账号 - {$company_info['ali_account']} + {$company_info['ali_account']|default="无"} 户名 - {$company_info['link_phone']} + {$company_info['link_phone']|default="无"} 账号 - {$company_info['bank_account']} + {$company_info['bank_account']|default="无"} 开户行 - {$company_info['opening_bank']} + {$company_info['opening_bank']|default="无"} @@ -477,8 +481,9 @@ var id = $(this).attr('data-id'); var start = $(this).attr('data-start'); var end = $(this).attr('data-end'); + var company = $(this).attr('data-company'); - var url = "{:U('withdrawOrderDetail','','')}" + '/relation_game_id/' + id + "/start/" + start + "/end/" + end; + var url = "{:U('withdrawOrderDetail','','')}" + '/relation_game_id/' + id + "/start/" + start + "/end/" + end + "/company_id/" + company; window.location.href = url; }); diff --git a/Application/Home/View/default/Withdraw/withdraworderdetail.html b/Application/Home/View/default/Withdraw/withdraworderdetail.html index 9e5c768ff..f811c3d51 100644 --- a/Application/Home/View/default/Withdraw/withdraworderdetail.html +++ b/Application/Home/View/default/Withdraw/withdraworderdetail.html @@ -154,7 +154,7 @@
+ +
diff --git a/Data/update.sql b/Data/update.sql index 4c1ce6ad4..a22b244a0 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1996,6 +1996,6 @@ ALTER TABLE `tab_forbit_ip` ADD UNIQUE INDEX `userid_type`(`user_id`, `type`) COMMENT '用户id与类型唯一索引'; -ALTER TABLE `platform`.`tab_promote` +ALTER TABLE `tab_promote` ADD COLUMN `withdraw_show` tinyint(2) NOT NULL DEFAULT 0 COMMENT '推广员提现查看权限 1 有 0 无' AFTER `group_remark`, ADD COLUMN `withdraw_done` tinyint(2) NOT NULL DEFAULT 0 COMMENT '推广员提现查看权限 1 有 0 无' AFTER `withdraw_show`; \ No newline at end of file