diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 9b749034f..3664cde6a 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -775,14 +775,4 @@ function camelize($str, $separator = '_', $littleHump = false) function unCamelize($str, $separator = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $str)); -} - -//获取管理员账号 -function getAdminNickname($adminId) -{ - $adminId = intval($adminId); - if ($adminId) { - return M('member')->where(array('id' => $adminId))->getField('nickname'); - } - return '未知'; } \ No newline at end of file diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php index c704aec94..0045ae56b 100644 --- a/Application/Admin/Controller/AutoController.class.php +++ b/Application/Admin/Controller/AutoController.class.php @@ -1034,4 +1034,11 @@ public function auto_rrdae(){ ]; return $ret; } + + //会长提现 + public function promoteWithdraw() + { + $promoteMap['level'] = 1; + $promotes = M('promote', 'tab_')->where(); + } } diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index a31929b24..e362834c7 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -146,7 +146,7 @@ class PromoteGameRatioController extends ThinkController if (empty($promoteGameRatio)) { $this->error('参数异常'); } - if ($save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) { + if ($promoteGameRatio['status'] == -1 || $save['begin_time'] != $promoteGameRatio['begin_time'] || $save['end_time'] != $promoteGameRatio['end_time'] || $save['ratio'] != $promoteGameRatio['ratio'] || $save['remark'] != $promoteGameRatio['remark']) { $promoteId = $promoteGameRatio['promote_id']; $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据 diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index 22631c5e9..ecc99b178 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -2,6 +2,7 @@ namespace Admin\Controller; +use Home\Controller\FileController; use User\Api\UserApi as UserApi; use Admin\Model\WithdrawModel; @@ -123,8 +124,11 @@ class QueryController extends ThinkController $this->display(); } } elseif ($group == 2) { - $map = '1 = 1'; + $map['_string'] = '1 = 1'; $createTime = strtotime(I('create_time', '')); + $withdrawNumber = I('widthdraw_number', ''); + $status = intval(I('status', '')); + $opType = intval(I('op_type', 0)); if ($createTime) { $createTimeEnd = $createTime + 3600 * 24 - 1; $map['create_time'] = ['between', [$createTime, $createTimeEnd]]; @@ -132,11 +136,27 @@ class QueryController extends ThinkController if ($promoteId) { $map['promote_id'] = $promoteId; } + if ($withdrawNumber) { + $map['widthdraw_number'] = ['like', "{$withdrawNumber}%"]; + } + if (isset($_REQUEST['status'])) { + $map['status'] = $status; + } + if ($opType) { + $map['op_type'] = $opType; + } - $records = M('withdraw', 'tab_')->where($map)->select(); + $records = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond') + ->where($map) + ->order('') + ->page($page, $row) + ->select(); + $count = M('withdraw', 'tab_')->field('id, promote_account, widthdraw_number, sum_money, op_id, op_type, last_op_id, last_op_type, settlement_begin_time, settlement_end_time, create_time, status, respond') + ->where($map) + ->count(); if (!empty($records)) { foreach ($records as &$record) { - $record['settlement_begin_time'] = date('Y-m-d H:i:s', $record['settlement_begin_time']); + $record['settlement_begin_time'] = $record['settlement_begin_time'] ? date('Y-m-d H:i:s', $record['settlement_begin_time']) : '--'; $record['settlement_end_time'] = date('Y-m-d H:i:s', $record['settlement_end_time']); $record['create_time'] = date('Y-m-d H:i:s', $record['create_time']); $record['status_text'] = promoteWithdrawStatus($record['status']); @@ -146,6 +166,10 @@ class QueryController extends ThinkController } } + $page = set_pagination($count, $row); + if($page) { + $this->assign('_page', $page); + } $this->assign('records', $records); $this->display(); } @@ -229,6 +253,8 @@ class QueryController extends ThinkController $add['spend_ids'] = ''; $add['op_id'] = is_login(); $add['op_type'] = 2; + $add['last_op_id'] = $add['op_id']; + $add['last_op_type'] = 2; M()->startTrans();//开启事物 $withdrawId = M('withdraw', 'tab_')->add($add); @@ -259,6 +285,98 @@ class QueryController extends ThinkController $this->ajaxReturn($data); } + public function renewReview() + { + $id = intval(I('id', 0)); + $data = M('withdraw', 'tab_')->find($id); + if (empty($data) || $data['status'] != -1) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + + $save['id'] = $id; + $save['status'] = 0; + $save['last_up_update_time'] = time(); + $save['last_op_id'] = is_login(); + $save['last_op_type'] = 2; + $res = M('withdraw', 'tab_')->save($save); + if ($res === false) { + $data['status'] = 0; + $data['msg'] = '提交失败'; + } else { + $data['status'] = 1; + $data['msg'] = '提交成功'; + } + $this->ajaxReturn($data); + } + + public function cancelWithdraw() + { + $id = intval(I('id', 0)); + $data = M('withdraw', 'tab_')->find($id); + if (empty($data) || !in_array($data['status'], [-1, 0])) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + + $spendMap['withdraw_id'] = $id; + $spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true); + if (empty($spendIds)) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + $spendIds = implode(',', $spendIds); + $time = time(); + $withdrawSave['id'] = $id; + $withdrawSave['status'] = -2; + $withdrawSave['spend_ids'] = $spendIds; + $withdrawSave['last_up_update_time'] = $time; + $withdrawSave['last_op_id'] = is_login(); + $withdrawSave['last_op_type'] = 2; + + M('withdraw', 'tab_')->startTrans();//开启事物 + $withdrawRes = M('withdraw', 'tab_')->save($withdrawSave); + if ($withdrawRes === false) { + M('withdraw', 'tab_')->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '撤销失败'; + $this->ajaxReturn($data); + } + + $spendSave['selle_status'] = 0; + $spendSave['withdraw_id'] = 0; + $spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave); + if ($spendRes === false) { + M('withdraw', 'tab_')->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '撤销失败'; + } else { + M('withdraw', 'tab_')->commit();//事物提交 + $data['status'] = 1; + $data['msg'] = '撤销成功'; + } + $this->ajaxReturn($data); + } + + public function downloadProve() + { + $id = intval(I('id', 0)); + if ($id) { + $withdraw = M('withdraw', 'tab_')->find($id); + if (empty($withdraw) || $withdraw['status'] != 2 || !$withdraw['transfer_proof']) { + $this->error('网络异常'); + } + + $file = new FileController(); + $file->download($withdraw['transfer_proof']); + } else { + $this->error('参数异常'); + } + } + public function cpsettlement($p = 0) { $page = intval($p); diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html index 3bc44d840..f059ca622 100644 --- a/Application/Admin/View/Query/settlement.html +++ b/Application/Admin/View/Query/settlement.html @@ -45,7 +45,9 @@