From e884214546ffa236eaa63ae9640d577d27fc5ad2 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 31 Dec 2019 14:07:24 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BC=9A=E9=95=BF=E6=8F=90=E7=8E=B0|?= =?UTF-8?q?=E5=85=AC=E4=BC=9A=E5=88=86=E6=88=90=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/AutoController.class.php | 90 +++ .../PromoteGameRatioController.class.php | 27 +- .../Controller/QueryController.class.php | 476 +++++++---- .../Admin/Model/WithdrawModel.class.php | 27 +- Application/Admin/View/Query/settlement.html | 751 +++++++----------- Application/Admin/View/Query/withdraw.html | 46 +- Application/Common/Common/function.php | 20 + .../Controller/FinanceController.class.php | 27 +- .../Home/View/default/Finance/index.html | 2 +- .../View/default/Finance/withdrawRecord.html | 14 +- Data/update.sql | 14 +- 11 files changed, 871 insertions(+), 623 deletions(-) diff --git a/Application/Admin/Controller/AutoController.class.php b/Application/Admin/Controller/AutoController.class.php index c704aec94..ff30dda40 100644 --- a/Application/Admin/Controller/AutoController.class.php +++ b/Application/Admin/Controller/AutoController.class.php @@ -1034,4 +1034,94 @@ public function auto_rrdae(){ ]; return $ret; } + + //会长提现 + public function promoteWithdraw() + { + $map['level'] = 1; + $map['ver_status'] = 1; + $promotes = M('promote', 'tab_')->field('id, account, chain')->where($map)->select(); + $success = 0; + $error_withdraw = 0; + $error_spend = 0; + $error_balance = 0; + + if (!empty($promotes)) { + foreach ($promotes as $promote) { + $result = $this->promoteWithdrawByPromote($promote); + switch ($result) { + case -2: + $error_balance++; + break; + case -1: + $error_spend++; + break; + case 0: + $error_withdraw++; + break; + case 1: + $success++; + break; + } + } + } + + echo "success:{$success} error_withdraw:{$error_withdraw} error_spend:{$error_spend} error_balance:{$error_balance}"; + } + + private function promoteWithdrawByPromote($promote) + { + $promoteMap['chain'] = ['like', "{$promote['chain']}{$promote['id']}/%"]; + $promoteIds = M('promote', 'tab_')->where($promoteMap)->getField('id', true); + $promoteIds[] = $promote['id']; + $settlementEndTime = strtotime(date('Y-m-d')) - 1; + + $spendMap['pay_status'] = 1; + $spendMap['selle_status'] = 0; + $spendMap['promote_id'] = ['in', $promoteIds]; + $spendMap['pay_time'] = ['elt', $settlementEndTime]; + $spendModel = M('spend', 'tab_'); + $balance = $spendModel->field("sum(if(selle_ratio > 0, pay_amount * selle_ratio, 0)) as balance") + ->where($spendMap) + ->find()['balance']; + $balance = bcdiv($balance, 100, 2); + if ($balance < 100) { + return -2;//余额不足 + } + + $thisTime = time(); + $add['sum_money'] = $balance; + $add['promote_id'] = $promote['id']; + $add['promote_account'] = $promote['account']; + $add['create_time'] = $thisTime; + $add['status'] = 0; + $add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber(); + $add['settlement_begin_time'] = 0; + $add['settlement_end_time'] = $settlementEndTime; + $add['spend_ids'] = ''; + $add['op_id'] = 0; + $add['op_type'] = 3; + $add['last_op_id'] = $add['op_id']; + $add['last_op_type'] = 3; + + M()->startTrans();//开启事物 + $withdrawId = D('withdraw')->add($add); + if (!$withdrawId) { + M()->rollback();//事物回滚 + return 0;//提现失败 + } + + $save['selle_status'] = 1; + $save['selle_time'] = $thisTime; + $save['withdraw_id'] = $withdrawId; + $res = $spendModel->where($spendMap)->save($save); + if ($res === false) { + D('withdraw')->delete($withdrawId); + M()->rollback();//事物回滚 + return -1; + } + + M()->commit();//事物提交 + return 1; + } } diff --git a/Application/Admin/Controller/PromoteGameRatioController.class.php b/Application/Admin/Controller/PromoteGameRatioController.class.php index 7952b4fa2..e362834c7 100644 --- a/Application/Admin/Controller/PromoteGameRatioController.class.php +++ b/Application/Admin/Controller/PromoteGameRatioController.class.php @@ -62,7 +62,7 @@ class PromoteGameRatioController extends ThinkController $thisPromoteAccount = '未知'; $thisPromoteMobilePhone = '未知'; $thisPromoteCreateTime = '未知'; - $thisPromoteStatus = '未知'; + $thisPromoteStatus = '待审核'; $thisPromoteVerStatus = '未知'; $thisGameName = '未知'; $thisGameRatio = '0.00'; @@ -79,9 +79,9 @@ class PromoteGameRatioController extends ThinkController $thisPromoteAccount = $promotes[$thisPromoteId]['account']; $thisPromoteMobilePhone = $promotes[$thisPromoteId]['mobile_phone']; $thisPromoteCreateTime = date('Y-m-d H:i:s', $promotes[$thisPromoteId]['create_time']); - $thisPromoteStatus = get_status_title($promotes[$thisPromoteId]['status']); - $thisPromoteStatus = $thisPromoteStatus ?? '未知'; - $thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['status'], 2); + $thisPromoteStatus = get_info_status($promotes[$thisPromoteId]['status'], 3); + $thisPromoteStatus = $thisPromoteStatus ?? '待审核'; + $thisPromoteVerStatus = getPromoteVerStatus($promotes[$thisPromoteId]['ver_status'], 2); } if ($issetGame) { $thisGameName = $games[$thisGameId]['game_name']; @@ -146,16 +146,19 @@ class PromoteGameRatioController extends ThinkController if (empty($promoteGameRatio)) { $this->error('参数异常'); } + 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']);//是否存在开始时间后已提现数据 - $promoteId = $promoteGameRatio['promote_id']; - $this->isWithdraw($promoteId, $save['begin_time']);//是否存在开始时间后已提现数据 - - if ($promoteGameRatio['status'] == 1) { - $save['last_ratio'] = $promoteGameRatio['ratio']; - $save['last_ratio_status'] = 1; + if ($promoteGameRatio['status'] == 1) { + $save['last_ratio'] = $promoteGameRatio['ratio']; + $save['last_ratio_status'] = 1; + } + $save['id'] = intval($params['id']); + $result = D(self::MODEL_NAME)->save($save); + } else { + $result = true; } - $save['id'] = intval($params['id']); - $result = D(self::MODEL_NAME)->save($save); } else {//新增 if (empty($params['promote_id'])) { $this->error('请选择会长账号'); diff --git a/Application/Admin/Controller/QueryController.class.php b/Application/Admin/Controller/QueryController.class.php index 99a3a3e77..fde9a8bc0 100644 --- a/Application/Admin/Controller/QueryController.class.php +++ b/Application/Admin/Controller/QueryController.class.php @@ -2,7 +2,9 @@ namespace Admin\Controller; +use Home\Controller\FileController; use User\Api\UserApi as UserApi; +use Admin\Model\WithdrawModel; /** * 推广查询控制器 @@ -10,164 +12,369 @@ use User\Api\UserApi as UserApi; */ class QueryController extends ThinkController { - public function settlement($p = 0) + //生成提现单号 + public function produceWithdrawNumber() { + $prefix = 'WD_'; + $number = ''; + while (true) { + $randomNum = rand(10, 99); + $number = $prefix . time() . $randomNum; + $map['widthdraw_number'] = $number; + $res = M('withdraw', 'tab_')->where($map)->getField('id'); + if (!$res) { + break; + } + } + return $number; + } + public function settlement($p = 0) + { + $page = intval(I('p', 1)); //默认显示第一页数据 + $row = intval(I('row', 10)); $group = I('group', 1); $this->assign('group', $group); - if (isset($_REQUEST['total_status'])) { - unset($_REQUEST['total_status']); - } - - $this->m_title = '推广结算'; - $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Query/settlement', 'status' => 1])->find()); + $promoteId = I('promote_id', 0); if ($group == 1) { - if ($_REQUEST['unum'] == 2) { - $order = 'unum'; - $order_type = SORT_ASC; - } else if ($_REQUEST['unum'] == 1) { - $order = 'unum'; - $order_type = SORT_DESC; - } - if ($_REQUEST['spay_amount'] == 2) { - $order = 'spay_amount'; - $order_type = SORT_ASC; - } else if ($_REQUEST['spay_amount'] == 1) { - $order = 'spay_amount'; - $order_type = SORT_DESC; - } - $model = array( - 'title' => '渠道结算', - 'template_list' => 'settlement', - 'order' => $order, - 'order_type' => $order_type//0倒序 1 正序 - ); - $start = $_REQUEST['timestart']; - $end = $_REQUEST['timeend']; - if (I('group') != '') { - if ($start == '' || $end == '' && $_REQUEST['promote_account'] == '') { - $this->error('结算周期、所属渠道不能为空!', '', 1); + if (empty($promoteId)) { + $this->display(); + } else { + $promoteIds = M('promote', 'tab_')->where(['chain' => ['like', "/{$promoteId}/%"]])->getField('id', true); + $promoteIds[] = $promoteId; + $beginTime = I('timestart', get_lastweek_name(7)); + $endTime = I('timeend', get_lastweek_name(1)); + $sortBy = I('sort_by', ''); + $sortColumn = I('sort_column', ''); + $order = 'tab_spend.pay_time'; + $orderType = 'desc'; + + if (in_array($sortColumn, ['user_num', 'sum_amount'])) { + $order = $sortColumn; } - if ($start == '' || $end == '') { - $this->error('请选择结算周期!', '', 1); + if ($sortBy == 1) { + $orderType = 'desc'; + } elseif ($sortBy == 2) { + $orderType = 'asc'; } - if ($_REQUEST['promote_account'] == '') { - $this->error('请选择渠道!', '', 1); + $beginTime = strtotime($beginTime); + $endTime = strtotime($endTime) + 3600 * 24 - 1; + + $spendMap['tab_spend.pay_status'] = 1; + $spendMap['tab_spend.selle_status'] = 0; + $spendMap['tab_spend.pay_time'] = ['between', [$beginTime, $endTime]]; + $spendMap['tab_spend.promote_id'] = ['in', $promoteIds]; + $spendField = 'tab_spend.promote_account, tab_spend.game_name, sum(tab_spend.pay_amount) as sum_amount, tab_spend.selle_ratio, sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount'; + $userMap['tab_user.promote_id'] = ['in', $promoteIds]; + $userMap['_string'] = 'tab_user.promote_id = tab_spend.promote_id'; + $userField = M('user', 'tab_')->field('count(tab_user.id) as user_num') + ->where($userMap) + ->buildSql(); + $field = "{$spendField}, {$userField} as user_num"; + + $query = M('spend', 'tab_')->field($field) + ->where($spendMap) + ->group('tab_spend.selle_ratio, tab_spend.game_id, tab_spend.promote_id') + ->order("{$order} {$orderType}") + ->page($page, $row) + ->buildSql(); + $records = M()->table($query) + ->alias('record') + ->select(); + $countQuery = M('spend', 'tab_')->field('tab_spend.id') + ->where($spendMap) + ->group('tab_spend.selle_ratio, tab_spend.game_id, tab_spend.promote_id') + ->buildSql(); + $count = M()->table($countQuery) + ->alias('tab_spend') + ->count(); + $page = set_pagination($count, $row); + + if (!empty($records)) { + $promote = M('promote', 'tab_')->find($promoteId); + foreach ($records as &$record) { + $record['promote_account'] = $promote['account'] ?? '未知'; + $record['settlement_amount'] = bcdiv($record['settlement_amount'], 100, 2); + } } - } - $smap['tab_spend.pay_status'] = 1; - //判断是否结算绑币 - if ($_REQUEST['bind_coin'] == 0) { - $smap['tab_spend.pay_way'] = array('neq', -1); - } - $this->meta_title = '渠道结算列表'; - $this->assign('setdate', date("Y-m-d", strtotime("-1 day"))); - $this->assign('is_admin', is_administrator()); - if ($start && $end) { - if ((strtotime($end) + 24 * 60 * 60 - 1) < strtotime($start)) { - $this->error('时间选择不正确!', U('Query/settlement'), ''); - } - $umap['register_time'] = array('BETWEEN', array(strtotime($start), strtotime($end) + 24 * 60 * 60 - 1)); - if (isset($_REQUEST['game_name']) && $_REQUEST['game_name'] != '') { - $umap['fgame_id'] = get_game_id($_REQUEST['game_name']); - $smap['tab_spend.game_id'] = get_game_id($_REQUEST['game_name']); + $totalField = 'sum(if(tab_spend.selle_ratio > 0, tab_spend.pay_amount * tab_spend.selle_ratio, 0)) as settlement_amount'; + $total = array_sum(array_column($records, 'settlement_amount'));//当页 + $zTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//累计 + $zTotal = bcdiv($zTotal, 100 ,2); + unset($spendMap['tab_spend.pay_time']); + $spendMap['_string'] = 'tab_spend.pay_time' . total(1); + $tTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//今日 + $tTotal = bcdiv($tTotal, 100 ,2); + $spendMap['_string'] = 'tab_spend.pay_time' . total(5); + $yTotal = null_to_0(M('spend', 'tab_')->field($totalField)->where($spendMap)->find()['settlement_amount']);//昨日 + $yTotal = bcdiv($yTotal, 100 ,2); + + if($page) { + $this->assign('_page', $page); } - if (isset($_REQUEST['promote_account']) && $_REQUEST['promote_account'] != '') { - $allid = get_subordinate_promote_($_REQUEST['promote_account']); - $allid[] = $_REQUEST['promote_account']; - $umap['tab_user.promote_account'] = array('in', $allid); - $smap['tab_spend.promote_account'] = array('in', $allid); - } else { - $this->error('未选择渠道!', '', 1); - } - $umap['is_check'] = 1; - $umap['settle_check'] = 0; - $smap['pay_time'] = array('BETWEEN', array(strtotime($start), strtotime($end) + 24 * 60 * 60 - 1)); - $smap['is_check'] = 1; - $smap['settle_check'] = 0; - //为数据权限添加 - setPowerPromoteIds($umap, 'tab_user.promote_id'); - setPowerPromoteIds($smap, 'tab_spend.promote_id'); - $map['umap'] = $umap; - $map['smap'] = $smap; - - $user = A('Settlement', 'Event'); - - - $user->settlement($model, $p, $map); - } else { + $this->assign('records', $records); + $this->assign('total', $total); + $this->assign('tTotal', $tTotal); + $this->assign('yTotal', $yTotal); + $this->assign('zTotal', $zTotal); + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Query/settlement', 'status' => 1])->find()); + $this->m_title = '推广结算'; $this->display(); } - } - if ($group == 2) { - if (isset($_REQUEST['stimestart']) && isset($_REQUEST['stimeend'])) { - $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['stimestart']), strtotime($_REQUEST['stimeend']) + 24 * 60 * 60 - 1)); - } elseif (isset($_REQUEST['stimestart'])) { - $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['stimestart']), time())); - } elseif (isset($_REQUEST['stimeend'])) { - $map['create_time'] = array('LT', (strtotime($_REQUEST['stimeend']) + 24 * 60 * 60 - 1)); + } elseif ($group == 2) { + $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]]; } - if (isset($_REQUEST['timestart']) && isset($_REQUEST['timeend'])) { - $map['starttime'] = ['GT', strtotime($_REQUEST['timestart'])]; - $map['endtime'] = ['LT', strtotime($_REQUEST['timeend']) + 24 * 60 * 60]; - } elseif (isset($_REQUEST['timestart'])) { - $map['starttime'] = ['GT', strtotime($_REQUEST['timestart'])]; - } elseif (isset($_REQUEST['timeend'])) { - $map['endtime'] = ['LT', strtotime($_REQUEST['timeend']) + 24 * 60 * 60]; + if ($promoteId) { + $map['promote_id'] = $promoteId; } - if (isset($_REQUEST['game_name'])) { - if ($_REQUEST['game_name'] == '全部') { - unset($_REQUEST['game_name']); - } else { - $map['game_name'] = $_REQUEST['game_name']; - } + if ($withdrawNumber) { + $map['widthdraw_number'] = ['like', "{$withdrawNumber}%"]; } - if (isset($_REQUEST['promote_account'])) { - if ($_REQUEST['promote_account'] == '全部') { - unset($_REQUEST['promote_account']); - } else { - $map['promote_account'] = $_REQUEST['promote_account']; + if (isset($_REQUEST['status'])) { + $map['status'] = $status; + } + if ($opType) { + $map['op_type'] = $opType; + } + + $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('create_time desc') + ->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'] = $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']); + if ($record['status'] == -2) { + $record['status_text'] = '' . $record['status_text'] . ''; + } } } - if (!empty($_REQUEST['settlement_number'])) { - $map['settlement_number'] = $_REQUEST['settlement_number']; + + $page = set_pagination($count, $row); + if($page) { + $this->assign('_page', $page); } + $this->assign('records', $records); + $this->display(); + } + } - $map['developers'] = 0; + public function settlementWithdraw() + { + $beginTime = strtotime(I('begin_time', '')); + $endTime = strtotime(I('end_time', '')); + $promoteId = intval(I('promote_id', 0)); + if ($beginTime == 0 || $endTime == 0) { + $data['status'] = 0; + $data['msg'] = '时间参数错误'; + $this->ajaxReturn($data); + } + if ($beginTime > $endTime) { + $data['status'] = 0; + $data['msg'] = '开始时间必须小于等于结束时间'; + $this->ajaxReturn($data); + } + if ($promoteId == 0) { + $data['status'] = 0; + $data['msg'] = '请选择会长账号'; + $this->ajaxReturn($data); + } - $model = array( - 'm_name' => 'settlement', - 'fields' => array( - 'settlement_number', - 'starttime', 'endtime', - 'promote_id', 'promote_account', - 'sum(total_money) as total_money', - 'sum(total_number) as total_number', - 'sum(sum_money) as sum_money', - 'bind_coin_status', - 'create_time'), - 'group' => 'promote_id,starttime,endtime,create_time,bind_coin_status', - 'order' => 'create_time desc ', - 'title' => '结算账单', - 'template_list' => 'settlement', - ); - //为数据权限添加 - setPowerPromoteIds($map); - $map1 = $map; + $promote = M('promote', 'tab_')->find($promoteId); + if (empty($promote)) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + if ($promote['level'] != 1) { + $data['status'] = 0; + $data['msg'] = '非会长账号,无法执行此操作'; + $this->ajaxReturn($data); + } + if ($promote['ver_status'] != 1) { + $data['status'] = 0; + $data['msg'] = '该会长未通过资质认证审核,暂时无法提现'; + $this->ajaxReturn($data); + } + + $endTime += 3600 * 24 - 1; + $spendModel = M('spend', 'tab_'); + $map['chain'] = ['like', $promote['chain'] . $promote['id'] . '/%']; + $promoteIds = M('promote', 'tab_')->where($map)->getField('id', true); + $promoteIds[] = $promote['id']; + $promoteIds = implode(',', $promoteIds); + + $map = []; + $map['pay_status'] = 1; + $map['selle_status'] = 0; + $map['promote_id'] = ['in', $promoteIds]; + $map['pay_time'] = ['between', [$beginTime, $endTime]]; + $balance = $spendModel->field("sum(pay_amount * selle_ratio) as balance") + ->where($map) + ->find()['balance']; + $balance = bcdiv($balance, 100, 2); + if ($balance < 100) { + $data['status'] = 0; + $data['msg'] = '累计结算低于100元,无法提现!'; + $this->ajaxReturn($data); + } + $spendIds = $spendModel->where($map)->getField('id', true); + if (empty($spendIds)) { + $data['status'] = 0; + $data['msg'] = '数据异常'; + $this->ajaxReturn($data); + } + + $thisTime = time(); + $add['sum_money'] = $balance; + $add['promote_id'] = $promote['id']; + $add['promote_account'] = $promote['account']; + $add['create_time'] = $thisTime; + $add['status'] = 0; + $add['widthdraw_number'] = D('withdraw')->produceWithdrawNumber(); + $add['settlement_begin_time'] = $beginTime; + $add['settlement_end_time'] = $endTime; + $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); + if (!$withdrawId) { + M()->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '提现失败'; + $this->ajaxReturn($data); + } + + $map = []; + $map['id'] = ['in', $spendIds]; + $save['selle_status'] = 1; + $save['selle_time'] = $thisTime; + $save['withdraw_id'] = $withdrawId; + $res = $spendModel->where($map)->save($save); + if ($res === false) { + M('withdraw', 'tab_')->delete($withdrawId); + M()->rollback();//事物回滚 + $data['status'] = 0; + $data['msg'] = '提现失败'; + $this->ajaxReturn($data); + } + + M()->commit();//事物提交 + $data['status'] = 1; + $data['msg'] = '提现成功'; + $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); + } - $ztotal = null_to_0(D('settlement')->where($map1)->sum('sum_money*10000') / 10000); - $this->assign('ztotal', $ztotal); - $ttotal = null_to_0(D('settlement')->where('create_time' . total(1))->sum('sum_money*10000') / 10000); - $this->assign('ttotal', $ttotal); - $ytotal = null_to_0(D('settlement')->where('create_time' . total(5))->sum('sum_money*10000') / 10000); - $this->assign('ytotal', $ytotal); - $user = A('Bill', 'Event'); + $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); + } - $user->money_list($model, $p, $map); + 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) @@ -664,6 +871,9 @@ class QueryController extends ThinkController if (isset($_REQUEST['ti_status'])) { $map['status'] = $_REQUEST['ti_status']; } + if (isset($_REQUEST['op_type'])) { + $map['op_type'] = $_REQUEST['op_type']; + } if (isset($_REQUEST['promote_account'])) { if ($_REQUEST['promote_account'] == '全部') { unset($_REQUEST['promote_account']); diff --git a/Application/Admin/Model/WithdrawModel.class.php b/Application/Admin/Model/WithdrawModel.class.php index 324bd151c..87d60eb32 100644 --- a/Application/Admin/Model/WithdrawModel.class.php +++ b/Application/Admin/Model/WithdrawModel.class.php @@ -15,6 +15,10 @@ use Think\Model; */ class WithdrawModel extends Model{ + const OP_TYPE_PROMOTE = 1; + const OP_TYPE_ADMIN = 2; + const OP_TYPE_AUTO = 3; + /** * 构造函数 * @param string $name 模型名称 @@ -28,8 +32,11 @@ class WithdrawModel extends Model{ parent::__construct($name, $tablePrefix, $connection); } - - + public static $opTypeList = [ + self::OP_TYPE_PROMOTE => '推广员', + self::OP_TYPE_ADMIN => '管理员', + self::OP_TYPE_AUTO => '自动', + ]; /* * 开发者提现未处理列表 @@ -102,4 +109,20 @@ class WithdrawModel extends Model{ } + //生成提现单号 + public function produceWithdrawNumber() + { + $prefix = 'WD_'; + $number = ''; + while (true) { + $randomNum = rand(10, 99); + $number = $prefix . time() . $randomNum; + $map['widthdraw_number'] = $number; + $res = $this->where($map)->getField('id'); + if (!$res) { + break; + } + } + return $number; + } } diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html index 12512b82d..e704735ff 100644 --- a/Application/Admin/View/Query/settlement.html +++ b/Application/Admin/View/Query/settlement.html @@ -30,98 +30,89 @@ -
- -
-
- 参与结算设置: - -      - -
-
-

注意①:推广结算只结算消费到游戏的所有订单记录。(系统默认全部排除绑币,可视情况自行勾选)

-

注意②:包含绑币勾选请慎重,由于玩家账户部分绑币的来源属于后台发放或者会长代充等,涉及到成本盈亏,是否参与推广员结算请考虑清楚!

-

注意③:推广结算时间请按规律时间统一结算,否则时间不统一容易导致个别游戏在统一时间内无法结算。(结算时间只可选到前一天)

-
-
-
- - - -
- -
-
-
+
+
+ + 提 现 + +
+
+
+
- value="{:get_lastweek_name(7)}" value="{:I('timestart')}" placeholder="结算周期起始时间" /> - - -
- value="{:get_lastweek_name(1)}" value="{:I('timeend')}" placeholder="结算周期结束时间" /> - -
+ + - +
+ + +
-
- - + + +
+
- - - -
- 搜索 -
-
- -
- - - -
- - -
-
- -
- 搜索 -
-
+
+
+ +
+ + + + +
+ 搜索 +
+
+ +
+ +
+
+ +
+
+ +
+
+ 搜索 +
+
- -
@@ -130,21 +121,13 @@ - - - - 结算周期 - 推广员账号 - 游戏名称 - 总充值 - - 总注册 - 结算模式 - 分成比例 - 注册单价 - 结算金额 - 状态 - + 推广员账号 + 游戏名称 + 总充值 + 总注册 + 结算模式 + 分成比例 + 结算金额 @@ -154,211 +137,94 @@ .data-table tbody td{border-right:1px solid #DDDDDD;} .d_list .drop-down ul {z-index:999;} - + aOh! 暂时还没有内容! - - - - - - {:I('timestart')} 至 {:I('timeend')} - {:get_promote_name($data['pid'])} - {:get_game_name($data['game_id'])} - {$data['spay_amount']|default=0} - {$data['unum']|default=0} - -
-
- -
-
- - - {$data.ratio}0% - 修改 - - - {$data.money}0 - 修改 - - - {:round($data['spay_amount'] * $data['ratio']/100,2)} - - - 已结算 - - 可结算 - - + + + {$record.promote_account} + {$record.game_name} + {$record['sum_amount']|default=0} + {$record['user_num']|default=0} + CPS + {$record['selle_ratio']|default=0}% + + {$record['settlement_amount']} + + + + 汇总 + 当页结算:{$total}元 ; 今日结算:{$tTotal}元 ; 昨日结算:{$yTotal}元 ; 累计结算:{$zTotal}元 +
- - - - - - - - - - + + + + + + + + + + + + + - + - - - - - - - - - + + + + + + + + + + + + + - - - -
推广员账号结算周期结算单号总充值总注册结算金额结算范畴结算时间详情推广员账号结算单号结算金额操作人操作人类型最后操作人最后操作人类型结算开始时间结算截止时间提现时间提现状态说明操作
- - {:get_promote_name($data['promote_id'])} - - {:encryptStr(get_promote_name($data['promote_id']))} - - {$data.starttime|date='Y-m-d',###}至{$data.endtime|date='Y-m-d',###}{$data.settlement_number}{$data.total_money}{$data.total_number} - {$data.sum_money} - {:get_bind_coin_status($data['bind_coin_status'])} - {$data.create_time|date='Y-m-d',###} - - 查看 - {$record.promote_account}{$record.widthdraw_number}{$record.sum_money} + + {:get_promote_name($record['op_id'])} + + {:getAdminNickname($record['op_id'])} + + 自动 + + {:getPromoteWithdrawOpType($record['op_type'])} + + {:get_promote_name($record['last_op_id'])} + + {:getAdminNickname($record['last_op_id'])} + + 自动 + + {:getPromoteWithdrawOpType($record['last_op_type'])}{$record.settlement_begin_time}{$record.settlement_end_time}{$record.create_time}{$record.status_text}{$record.respond} + + 汇款证明 + + 重新审核 + + + 撤销提现 + +
汇总当页结算:{$total}元 ; 今日结算:{$ttotal}元 ; 昨日结算:{$ytotal}元 ; 累计结算:{$ztotal}元
@@ -369,7 +235,7 @@ - + diff --git a/Application/Admin/View/Query/withdraw.html b/Application/Admin/View/Query/withdraw.html index 4a3131a7e..c675cae0b 100644 --- a/Application/Admin/View/Query/withdraw.html +++ b/Application/Admin/View/Query/withdraw.html @@ -78,13 +78,21 @@
- $value) :?>
+
+ +
搜索 @@ -106,9 +114,15 @@ 提现单号 - 提现金额 + 提现金额 推广员账号 - 申请时间 + 操作人 + 操作人类型 + 最后操作人 + 最后操作人类型 + 结算开始时间 + 结算截止时间 + 申请时间 提现状态 说明 审核时间 @@ -142,8 +156,30 @@ {:encryptStr(get_promote_name($data['promote_id']))} + + + {:get_promote_name($data['op_id'])} + + {:getAdminNickname($data['op_id'])} + + 自动 + + + {:getPromoteWithdrawOpType($data['op_type'])} + + + {:get_promote_name($data['last_op_id'])} + + {:getAdminNickname($data['last_op_id'])} + + 自动 + + + {:getPromoteWithdrawOpType($data['last_op_type'])} + {$data.settlement_begin_time|date='Y-m-d H:i:s',###}--- + {$data.settlement_end_time|date='Y-m-d H:i:s',###}--- {$data.create_time|date='Y-m-d H:i:s',###}--- - {:promoteWithdrawStatus($data['status'])} + style="color: #999;">{:promoteWithdrawStatus($data['status'])} {$data.respond} {$data.audit_time|date='Y-m-d H:i:s',###}--- @@ -161,7 +197,7 @@ 汇总 - 当页提现:{:null_to_0(array_sum(array_column(arrayPromoteWithdrawStatus('status','',$list_data),'sum_money')))}元 ; 今日提现:{:null_to_0(floor($ttotal*100)/100)}元 ; 昨日提现:{:null_to_0(floor($ytotal*100)/100)}元 ; 累计提现:{:null_to_0(floor($total*100)/100)}元 + 当页提现:{:null_to_0(array_sum(array_column(arrayPromoteWithdrawStatus('status','',$list_data),'sum_money')))}元 ; 今日提现:{:null_to_0(floor($ttotal*100)/100)}元 ; 昨日提现:{:null_to_0(floor($ytotal*100)/100)}元 ; 累计提现:{:null_to_0(floor($total*100)/100)}元 diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index c7d4909d2..b45da22c6 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -1430,6 +1430,7 @@ if (!function_exists('dd')) { function promoteWithdrawStatus($status = null) { $statusData = [ + -2 => '已撤销', -1 => '审核未通过', 0 => '待审核', 1 => '汇款中', @@ -1443,3 +1444,22 @@ function promoteWithdrawStatus($status = null) return $statusData; } +//获取提现操作人类型 +function getPromoteWithdrawOpType($opType = null) +{ + if ($opType) { + return Admin\Model\WithdrawModel::$opTypeList[$opType] ?? '未知'; + } else { + return Admin\Model\WithdrawModel::$opTypeList; + } +} + +//获取管理员账号 +function getAdminNickname($adminId) +{ + $adminId = intval($adminId); + if ($adminId) { + return M('member')->where(array('id' => $adminId))->getField('nickname'); + } + return '未知'; +} diff --git a/Application/Home/Controller/FinanceController.class.php b/Application/Home/Controller/FinanceController.class.php index c0c245b2e..a61cc0b36 100644 --- a/Application/Home/Controller/FinanceController.class.php +++ b/Application/Home/Controller/FinanceController.class.php @@ -284,6 +284,7 @@ class FinanceController extends BaseController //提现 public function withdraw() { + $this->error('无法执行此操作'); //是否是会长 $this->purview(); //验证安全密码 @@ -414,7 +415,7 @@ class FinanceController extends BaseController } } - $data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof') + $data = $model->field('id, widthdraw_number, create_time, settlement_begin_time, settlement_end_time, sum_money, status, respond, transfer_proof, op_id, op_type, last_op_id, last_op_type') ->where($map) ->order('id desc') ->page($page, $row) @@ -426,8 +427,13 @@ class FinanceController extends BaseController if (!empty($data)) { foreach ($data as &$list) { $list['create_time'] = date('Y-m-d H:i:s', $list['create_time']); + $list['settlement_begin_time'] = $list['settlement_begin_time'] ? date('Y-m-d H:i:s', $list['settlement_begin_time']) : '--'; $list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']); $list['status_name'] = FinanceController::$withdrawStatus[$list['status']]; + $list['op_id'] = $this->getOpIdByType($list['op_id'], $list['op_type']); + $list['last_op_id'] = $this->getOpIdByType($list['last_op_id'], $list['last_op_type']); + $list['op_type'] = getPromoteWithdrawOpType($list['op_type']); + $list['last_op_type'] = getPromoteWithdrawOpType($list['last_op_type']); switch ($list['status']) { case -2: $list['status_name'] = '' . $list['status_name'] . ''; @@ -454,6 +460,23 @@ class FinanceController extends BaseController $this->display(); } + private function getOpIdByType($opId, $opType) + { + switch ($opType) { + case 1: + $opId = get_promote_name($opId); + break; + case 2: + $opId = getAdminNickname($opId); + break; + case 3: + $opId = '自动'; + break; + } + + return $opId; + } + //提现明细 public function withdrawDtl() { @@ -584,6 +607,7 @@ class FinanceController extends BaseController //审核拒绝 重新审核 public function renewReview() { + $this->error('无法执行此操作'); //是否是会长 $this->purview(); //验证安全密码 @@ -624,6 +648,7 @@ class FinanceController extends BaseController //撤销提现 public function cancelWithdraw() { + $this->error('无法执行此操作'); //是否是会长 $this->purview(); //验证安全密码 diff --git a/Application/Home/View/default/Finance/index.html b/Application/Home/View/default/Finance/index.html index c85e547f4..39dc54177 100644 --- a/Application/Home/View/default/Finance/index.html +++ b/Application/Home/View/default/Finance/index.html @@ -35,7 +35,7 @@
- +
{$meta_title}
diff --git a/Application/Home/View/default/Finance/withdrawRecord.html b/Application/Home/View/default/Finance/withdrawRecord.html index 6ab8a8c20..7bd43e1ef 100644 --- a/Application/Home/View/default/Finance/withdrawRecord.html +++ b/Application/Home/View/default/Finance/withdrawRecord.html @@ -149,7 +149,12 @@ 提现订单 提现日期 + 结算开始日期 结算截止日期 + 操作人 + 操作人类型 + 最后操作人 + 最后操作人类型 收益金额 实际提现金额 提现状态 @@ -168,7 +173,12 @@ {$vo.widthdraw_number} {$vo.create_time} + {$vo.settlement_begin_time} {$vo.settlement_end_time} + {$vo.op_id} + {$vo.op_type} + {$vo.last_op_id} + {$vo.last_op_type} {$vo.sum_money} {$vo.sum_money} {$vo.status_name} @@ -178,11 +188,11 @@ 汇款证明 - 重新审核 + 结算单 - 撤销提现 + diff --git a/Data/update.sql b/Data/update.sql index 391c988f2..12a8ead50 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -915,4 +915,16 @@ ADD COLUMN `beta_url` varchar(150) NOT NULL DEFAULT '' COMMENT 'Beta链接'; -- 游戏支付方式渠道配置 ALTER TABLE `tab_game` -ADD COLUMN `pay_config` varchar(255) NOT NULL COMMENT '支付渠道 wx 微信 zfb 支付宝 quick 快捷 (gf 官方 sq 双乾'; \ No newline at end of file +ADD COLUMN `pay_config` varchar(255) NOT NULL COMMENT '支付渠道 wx 微信 zfb 支付宝 quick 快捷 (gf 官方 sq 双乾'; + +-- 2019-12-30 +-- 会长管理后台提现 cxj +ALTER TABLE `tab_withdraw` +ADD COLUMN `settlement_begin_time` int(10) NOT NULL DEFAULT 0 COMMENT '结算开始时间' AFTER `old_promote_account`; +ALTER TABLE `tab_withdraw` +ADD COLUMN `op_id` int(11) NOT NULL DEFAULT 0 COMMENT '操作id'; +ALTER TABLE `tab_withdraw` +ADD COLUMN `op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '操作人:1-推广员 2-管理员 3-自动'; +ALTER TABLE `tab_withdraw` +ADD COLUMN `last_op_id` int(11) NOT NULL DEFAULT 0 COMMENT '最后操作人id', +ADD COLUMN `last_op_type` tinyint(3) NOT NULL DEFAULT 1 COMMENT '最后操作人:1-推广员 2-管理员 3-自动'; \ No newline at end of file From a12c3ecf9e6a4ce95ef6559269d1ae59f410edd0 Mon Sep 17 00:00:00 2001 From: chenxiaojun <956334972@qq.com> Date: Tue, 31 Dec 2019 15:05:12 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BC=9A=E9=95=BF=E6=8F=90=E7=8E=B0--?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/Query/settlement.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Application/Admin/View/Query/settlement.html b/Application/Admin/View/Query/settlement.html index e704735ff..13e7b913b 100644 --- a/Application/Admin/View/Query/settlement.html +++ b/Application/Admin/View/Query/settlement.html @@ -405,13 +405,14 @@ btn: ['提交', '取消'], }, function (index) { layer.close(index); - layer.load(0, {shade: [0.7, '#393D49']}, {shadeClose: true}); + layer.load(0, {shade: [0.7, '#393D49'], time: 10 * 1000}, {shadeClose: true}); $.ajax({ type: 'post', url: '{:U("settlementWithdraw")}', dataType: 'json', data: {'begin_time': beginTime, 'end_time': endTime, 'promote_id': promoteId}, success: function (data) { + layer.closeAll('loading'); if (data.status == 1) { layer.msg(data.msg, {icon: 1}); setTimeout(function(){ @@ -458,13 +459,16 @@ layer.confirm(msg, { title: '提示', btn: ['确定', '取消'], - }, function () { + }, function (index) { + layer.close(index); + layer.load(0, {shade: [0.7, '#393D49'], time: 10 * 1000}, {shadeClose: true}); $.ajax({ type: 'post', url: '{:U("cancelWithdraw")}', dataType: 'json', data: {id:id}, success: function (data) { + layer.closeAll('loading'); if (data.status == 1) { layer.msg(data.msg, {icon: 1}); setTimeout(function(){ From 346bbaa1174e8a2c4ecaabbf7bcb4043162f034b Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 31 Dec 2019 15:07:20 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=B8=81=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=B7=BB=E5=8A=A0=E6=8E=A8=E5=B9=BF=E5=91=98=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=90=9C=E7=B4=A2=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E5=88=97=E8=A1=A8=E6=97=B6=E9=97=B4=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/DepositController.class.php | 189 ++++++++++++++---- .../Controller/ExportController.class.php | 132 ++++++++---- .../Controller/MemberController.class.php | 6 +- Application/Admin/View/Deposit/lists.html | 52 ++--- 4 files changed, 274 insertions(+), 105 deletions(-) diff --git a/Application/Admin/Controller/DepositController.class.php b/Application/Admin/Controller/DepositController.class.php index 181ef0ba5..49dfcea2f 100644 --- a/Application/Admin/Controller/DepositController.class.php +++ b/Application/Admin/Controller/DepositController.class.php @@ -89,45 +89,45 @@ class DepositController extends ThinkController { $map1=$map; $map1['pay_status']=1; - if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { - $page = intval($p); - $page = $page ? $page : 1; //默认显示第一页数据 - if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} - $map1['order_status'] = 1; - unset($map1['pay_status']); - if ($map['pay_status']) { - $map['order_status']=$map['pay_status']; - } - - $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); - $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); - $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); - $this->assign('total',$total); - $this->assign('ttotal',$ttotal); - $this->assign('ytotal',$ytotal); - - $data = D('coin_pay_order') - /* 查询指定字段,不指定则查询所有字段 */ - ->field('*,order_status as pay_status') - // 查询条件 - ->where($map) - /* 默认通过id逆序排列 */ - ->order("id desc") - /* 数据分页 */ - ->page($page, $row) - /* 执行查询 */ - ->select(); - - /* 查询记录总数 */ - $count = D('coin_pay_order')->where($map)->count(); - - $page = set_pagination($count,$row); - if($page) {$this->assign('_page', $page);} - - $this->assign('list_data', $data); - $this->meta_title = '平台币充值列表'; - $this->display('lists');die(); - } +// if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { +// $page = intval($p); +// $page = $page ? $page : 1; //默认显示第一页数据 +// if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} +// $map1['order_status'] = 1; +// unset($map1['pay_status']); +// if ($map['pay_status']) { +// $map['order_status']=$map['pay_status']; +// } +// +// $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); +// $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); +// $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); +// $this->assign('total',$total); +// $this->assign('ttotal',$ttotal); +// $this->assign('ytotal',$ytotal); +// +// $data = D('coin_pay_order') +// /* 查询指定字段,不指定则查询所有字段 */ +// ->field('*,order_status as pay_status') +// // 查询条件 +// ->where($map) +// /* 默认通过id逆序排列 */ +// ->order("id desc") +// /* 数据分页 */ +// ->page($page, $row) +// /* 执行查询 */ +// ->select(); +// +// /* 查询记录总数 */ +// $count = D('coin_pay_order')->where($map)->count(); +// +// $page = set_pagination($count,$row); +// if($page) {$this->assign('_page', $page);} +// +// $this->assign('list_data', $data); +// $this->meta_title = '平台币充值列表'; +// $this->display('lists');die(); +// } $total=null_to_0(D(self::model_name)->where($map1)->sum('pay_amount')); $ttotal=null_to_0(D(self::model_name)->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); @@ -144,6 +144,117 @@ class DepositController extends ThinkController { parent::lists(self::model_name,$_GET["p"],$map); } + public function lists_secord() { + + if(isset($_REQUEST['user_account'])){ + $map['user_account']=array('like','%'.trim($_REQUEST['user_account']).'%'); + unset($_REQUEST['user_account']); + } + if(isset($_REQUEST['order_number'])){ + $map['order_number']=array('like','%'.trim($_REQUEST['order_number']).'%'); + unset($_REQUEST['order_number']); + } + if(isset($_REQUEST['pay_ip'])){ + $map['pay_ip']=array('like','%'.trim($_REQUEST['pay_ip']).'%'); + unset($_REQUEST['pay_ip']); + } + + setPowerPromoteIds($map,'promote_id'); + + if(!isset($_REQUEST['promote_id'])){ + + }else if(isset($_REQUEST['promote_id']) && $_REQUEST['promote_id']==0){ + $map['promote_id']=array('elt',0); + }elseif(isset($_REQUEST['promote_name'])&&$_REQUEST['promote_id']==-1){ + $map['promote_id']=get_promote_id($_REQUEST['promote_name']); + }else{ + $map['promote_id']=$_REQUEST['promote_id']; + } + if(isset($_REQUEST['time-start'])&&isset($_REQUEST['time-end'])){ + $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['time-start']),strtotime($_REQUEST['time-end'])+24*60*60-1)); + unset($_REQUEST['time-start']);unset($_REQUEST['time-end']); + }elseif(isset($_REQUEST['time-start'])){ + $map['create_time'] = ['GT',strtotime(I('time-start'))]; + unset($_REQUEST['time-start']); + }elseif(isset($_REQUEST['time-end'])){ + $map['create_time'] = ['LT',strtotime(I('time-end'))+86399]; + unset($_REQUEST['time-end']); + } + if(isset($_REQUEST['start'])&&isset($_REQUEST['end'])){ + $map['create_time'] =array('BETWEEN',array(strtotime($_REQUEST['start']),strtotime($_REQUEST['end'])+24*60*60-1)); + unset($_REQUEST['start']);unset($_REQUEST['end']); + }elseif(isset($_REQUEST['start'])){ + $map['create_time'] = ['GT',strtotime(I('start'))]; + unset($_REQUEST['start']); + }elseif(isset($_REQUEST['end'])){ + $map['create_time'] = ['LT',strtotime(I('end'))+86399]; + unset($_REQUEST['end']); + } + if(isset($_REQUEST['pay_way'])) { + if ($_REQUEST['pay_way'] == "2") { + $map['pay_way'] = ['in', '2,3,4']; + } else { + $map['pay_way'] = $_REQUEST['pay_way']; + } + unset($_REQUEST['pay_way']); + } + + + if(isset($_REQUEST['pay_status'])){ + $map['pay_status']=$_REQUEST['pay_status']; + unset($_REQUEST['pay_status']); + } + if($_REQUEST['data_order']!=''){ + $data_order=reset(explode(',',$_REQUEST['data_order'])); + $data_order_type=end(explode(',',$_REQUEST['data_order'])); + $this->assign('userarpu_order',$data_order); + $this->assign('userarpu_order_type',$data_order_type); + $sort = $data_order==3?'desc':'asc'; + $map['order'] = $data_order_type.' '.$sort; + } + + $map1=$map; + $map1['pay_status']=1; + + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + $map1['order_status'] = 1; + unset($map1['pay_status']); + if ($map['pay_status']) { + $map['order_status']=$map['pay_status']; + } + + $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); + $ttotal=null_to_0(D('coin_pay_order')->where('create_time'.total(1))->where(array('pay_status'=>1))->sum('pay_amount')); + $ytotal=null_to_0(D('coin_pay_order')->where('create_time'.total(5))->where(array('pay_status'=>1))->sum('pay_amount')); + $this->assign('total',$total); + $this->assign('ttotal',$ttotal); + $this->assign('ytotal',$ytotal); + + $data = D('coin_pay_order') + /* 查询指定字段,不指定则查询所有字段 */ + ->field('*,order_status as pay_status,order_number as pay_order_number') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order("id desc") + /* 数据分页 */ + ->page($page, $row) + /* 执行查询 */ + ->select(); + + /* 查询记录总数 */ + $count = D('coin_pay_order')->where($map)->count(); + + $page = set_pagination($count,$row); + if($page) {$this->assign('_page', $page);} + + $this->assign('list_data', $data); + $this->meta_title = '平台币充值列表'; + $this->display();die(); + } + public function send_lists(){ diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index cb51513f8..d7c753ab6 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -1261,44 +1261,6 @@ class ExportController extends Controller $map1 = $map; $map1['pay_status'] = 1; - if($_REQUEST['promote_id']||$_REQUEST['promote_id']=='0') { - - $map1['order_status'] = 1; - unset($map1['pay_status']); - if ($map['pay_status']) { - $map['order_status']=$map['pay_status']; - } - - $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); - - if (isset($map['pay_status']) && $map['pay_status'] == 0) { - $total = sprintf("%.2f", 0); - } else { - $total = sprintf("%.2f", $total); - } - $xlsCell = array( - array('pay_order_number', "订单号"), - array('promote_account', L('Subordinate_channel')), - array('pay_amount', "充值平台币"), - array('pay_way', "充值方式", 'get_pay_way', '*'), - array('create_time', "充值时间"), - array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), - array('', "共计充值{$total}"), - ); - $xlsData = D('coin_pay_order') - /* 查询指定字段,不指定则查询所有字段 */ - ->field('*,order_status as pay_status') - // 查询条件 - ->where($map) - /* 默认通过id逆序排列 */ - ->order("id desc") - /* 执行查询 */ - ->select(); -// var_dump($xlsData);die(); - foreach ($xlsData as $key => $value) { - $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); - } - } else { $total = D('Deposit')->where($map1)->sum('pay_amount'); if (isset($map['pay_status']) && $map['pay_status'] == 0) { $total = sprintf("%.2f", 0); @@ -1324,7 +1286,6 @@ class ExportController extends Controller foreach ($xlsData as $key => $value) { $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); } - } // dd($xlsData); break; case 9: @@ -2245,6 +2206,99 @@ class ExportController extends Controller $xlsData[] = $re_data; } break; + case 26: + $xlsName = $xlsName?$xlsName:L('Platform_currency_recharge'); + if (isset($_REQUEST['user_account'])) { + $map['user_account'] = array('like', '%' . trim($_REQUEST['user_account']) . '%'); + unset($_REQUEST['user_account']); + } + if (isset($_REQUEST['order_number'])) { + $map['order_number'] = array('like', '%' . trim($_REQUEST['order_number']) . '%'); + unset($_REQUEST['order_number']); + } + if (isset($_REQUEST['pay_ip'])) { + $map['pay_ip'] = array('like', '%' . trim($_REQUEST['pay_ip']) . '%'); + unset($_REQUEST['pay_ip']); + } + + // $promoteRoot = getPowerPromoteIds(); + // $data_empower_type = session('user_auth')['data_empower_type']; + // + // if ($promoteRoot) { + // $map['promote_id'] =array('in',$promoteRoot); + // } else if(!$promoteRoot&&$data_empower_type!=1){ + // $map['id'] = array('lt',1); + // } + setPowerPromoteIds($map,'promote_id'); + + if (!isset($_REQUEST['promote_id'])) { + + } else if (isset($_REQUEST['promote_id']) && $_REQUEST['promote_id'] == 0) { + $map['promote_id'] = array('elt', 0); + } elseif (isset($_REQUEST['promote_name']) && $_REQUEST['promote_id'] == -1) { + $map['promote_id'] = get_promote_id($_REQUEST['promote_name']); + } else { + $map['promote_id'] = $_REQUEST['promote_id']; + } + if (isset($_REQUEST['time-start']) && isset($_REQUEST['time-end'])) { + $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['time-start']), strtotime($_REQUEST['time-end']) + 24 * 60 * 60 - 1)); + unset($_REQUEST['time-start']); + unset($_REQUEST['time-end']); + } + if (isset($_REQUEST['start']) && isset($_REQUEST['end'])) { + $map['create_time'] = array('BETWEEN', array(strtotime($_REQUEST['start']), strtotime($_REQUEST['end']) + 24 * 60 * 60 - 1)); + unset($_REQUEST['start']); + unset($_REQUEST['end']); + } + if (isset($_REQUEST['pay_way'])) { + $map['pay_way'] = $_REQUEST['pay_way']; + unset($_REQUEST['pay_way']); + } + if (isset($_REQUEST['pay_status'])) { + $map['pay_status'] = $_REQUEST['pay_status']; + unset($_REQUEST['pay_status']); + } + $map1 = $map; + $map1['pay_status'] = 1; + + $map1['order_status'] = 1; + unset($map1['pay_status']); + if ($map['pay_status']) { + $map['order_status']=$map['pay_status']; + } + + $total=null_to_0(D('coin_pay_order')->where($map1)->sum('pay_amount')); + + if (isset($map['pay_status']) && $map['pay_status'] == 0) { + $total = sprintf("%.2f", 0); + } else { + $total = sprintf("%.2f", $total); + } + $xlsCell = array( + array('pay_order_number', "订单号"), + array('promote_account', L('Subordinate_channel')), + array('pay_amount', "充值平台币"), + array('pay_way', "充值方式", 'get_pay_way', '*'), + array('create_time', "充值时间"), + array('pay_status', L('Order_status'), 'get_info_status', '*', '9'), + array('', "共计充值{$total}"), + ); + $xlsData = D('coin_pay_order') + /* 查询指定字段,不指定则查询所有字段 */ + ->field('*,order_status as pay_status,order_number as pay_order_number') + // 查询条件 + ->where($map) + /* 默认通过id逆序排列 */ + ->order("id desc") + /* 执行查询 */ + ->select(); +// var_dump($xlsData);die(); + foreach ($xlsData as $key => $value) { + $xlsData[$key]['create_time'] = date('Y-m-d H:i:s', $value['create_time']); + } + +// dd($xlsData); + break; default: $xlsName = $xlsCell = $xlsData = []; diff --git a/Application/Admin/Controller/MemberController.class.php b/Application/Admin/Controller/MemberController.class.php index f4ab7e9c2..48ec8ed1a 100644 --- a/Application/Admin/Controller/MemberController.class.php +++ b/Application/Admin/Controller/MemberController.class.php @@ -14,9 +14,9 @@ class MemberController extends ThinkController */ public function user_info($p=0){ //设定默认时间 - if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){ - $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d'))); - } +// if(!array_key_exists("time_start",$_REQUEST) && I('type') != 2){ +// $this->redirect(ACTION_NAME, array('time_start' => date('Y-m-d',strtotime('-30 day')),"time_end"=>date('Y-m-d'))); +// } //基础信息 $page = intval($p); $page = $page ? $page : 1; //默认显示第一页数据 diff --git a/Application/Admin/View/Deposit/lists.html b/Application/Admin/View/Deposit/lists.html index fa8e433dd..dce79d5a2 100644 --- a/Application/Admin/View/Deposit/lists.html +++ b/Application/Admin/View/Deposit/lists.html @@ -28,6 +28,10 @@ @@ -78,21 +82,21 @@
-
- - - -
-
- -
+ + + + + + + + + + + + + + +
@@ -112,7 +116,7 @@ 订单号 - 玩家账号 + 玩家账号 所属推广员 @@ -120,14 +124,14 @@ 充值方式 - 充值ip + 充值ip 充值时间 订单状态 - 操作 + 操作 @@ -138,14 +142,14 @@ - {:$data['pay_order_number']} - + {:$data['pay_order_number']} + {$data.user_account} {$data.user_account|encryptStr} - + 官方渠道 @@ -160,7 +164,7 @@ {$data.pay_amount} {:get_pay_way($data['pay_way'])} - {$data.pay_ip} + {$data.pay_ip} {:set_show_time($data['create_time'],'','pay')} @@ -170,14 +174,14 @@ - +
通知到账 -
+
From f324567258824d88d32304d3fec7633c57f991ef Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Tue, 31 Dec 2019 15:07:51 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=B8=81=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=B7=BB=E5=8A=A0=E6=8E=A8=E5=B9=BF=E5=91=98=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=90=9C=E7=B4=A2=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E5=88=97=E8=A1=A8=E6=97=B6=E9=97=B4=E6=A3=80=E7=B4=A2?= =?UTF-8?q?=E9=9D=9E=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/View/Deposit/lists_secord.html | 430 ++++++++++++++++++ 1 file changed, 430 insertions(+) create mode 100644 Application/Admin/View/Deposit/lists_secord.html diff --git a/Application/Admin/View/Deposit/lists_secord.html b/Application/Admin/View/Deposit/lists_secord.html new file mode 100644 index 000000000..a57da2ead --- /dev/null +++ b/Application/Admin/View/Deposit/lists_secord.html @@ -0,0 +1,430 @@ + + + + + + + + + + + +
+ +
+
+ +
+ +
+ +
+
+ + - +
+ + +
+
+ +
+ +
+
+ +
+ +
+ + - +
+
+ +
+ + +
+ 搜索 +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
订单号所属推广员 + + 充值平台币 + + 充值方式 + + 充值时间 + + 订单状态
aOh! 暂时还没有内容!
{:$data['pay_order_number']} + + 官方渠道 + + + {$data.promote_account} + + {$data.promote_account|encryptStr} + + + + {$data.pay_amount}{:get_pay_way($data['pay_way'])}{:set_show_time($data['create_time'],'','pay')} + + {:get_info_status($data['pay_status'],9)} + + {:get_info_status($data['pay_status'],9)} + +
汇总 + 当页充值:{:array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount'))}; + 今日充值:{$ttotal} ; + 昨日充值:{$ytotal} ; + 累计充值:{$total}元(此处只汇总充值成功的订单) +
+
+
+
+ 导出 + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + +