From bfa0c5c5b85f91d5e809748c1e4b9d0a8fe5260f Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Mon, 19 Apr 2021 17:34:20 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/ConsoleController.class.php | 23 ++-- .../Controller/ShiftTaskController.class.php | 11 +- .../Base/Service/PromoteService.class.php | 109 +++++++++++------- 3 files changed, 75 insertions(+), 68 deletions(-) diff --git a/Application/Admin/Controller/ConsoleController.class.php b/Application/Admin/Controller/ConsoleController.class.php index c36acb21f..da1080c87 100644 --- a/Application/Admin/Controller/ConsoleController.class.php +++ b/Application/Admin/Controller/ConsoleController.class.php @@ -78,23 +78,18 @@ class ConsoleController extends Think { foreach ($tasks as $task) { if ($task['type'] == 1) { $message = '推广员迁移[' . $task['id'] . ']'; - $result = $promoteService->shiftPromote($task); - if ($result['status']) { - $message = 'SUCCESS ----- ' . $message . $result['msg']; - } else { - $message = 'ERROR ----- ' . $message . $result['msg']; - } - Printer::export($message); } elseif ($task['type'] == 2) { $message = '玩家迁移[' . $task['id'] . ']'; - $result = $promoteService->shiftPlayer($task); - if ($result['status']) { - $message = 'SUCCESS ----- ' . $message . $result['msg']; - } else { - $message = 'ERROR ----- ' . $message . $result['msg']; - } - Printer::export($message); + } else { + $message = '未知类型迁移[' . $task['id'] . ']'; + } + $result = $promoteService->shift($task); + if ($result['status']) { + $message = 'SUCCESS ----- ' . $message . $result['msg']; + } else { + $message = 'ERROR ----- ' . $message . $result['msg']; } + Printer::export($message); } } diff --git a/Application/Admin/Controller/ShiftTaskController.class.php b/Application/Admin/Controller/ShiftTaskController.class.php index d203aa3ad..c5fbd03d8 100644 --- a/Application/Admin/Controller/ShiftTaskController.class.php +++ b/Application/Admin/Controller/ShiftTaskController.class.php @@ -7,15 +7,6 @@ class ShiftTaskController extends Think { public function test() { - $list = M('ShiftTask')->where(['status' => 0])->select(); - $service = new PromoteService(); - - foreach ($list as $task) { - if ($task['type'] == 1) { - $result = $this->shiftPromote($task); - } elseif ($task['type'] == 2) { - $result = $this->shiftPlayer($task); - } - } + } } \ No newline at end of file diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index bb7413388..885fd2019 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -203,26 +203,25 @@ class PromoteService { $secondMap['parent_id'] = ['in', $shiftIds]; } - M('promote', 'tab_')->where($firstMap)->save([ - 'parent_id' => $toPromote['id'], - 'parent_name' => $toPromote['account'], - 'chain' => $toPromote['chain'] . $toPromote['id'] . '/', - 'level' . $toPromote['level'] => $toPromote['id'] - ]); + try { + M('promote', 'tab_')->where($firstMap)->save([ + 'parent_id' => $toPromote['id'], + 'parent_name' => $toPromote['account'], + 'chain' => $toPromote['chain'] . $toPromote['id'] . '/', + 'level' . $toPromote['level'] => $toPromote['id'] + ]); - M('promote', 'tab_')->where($secondMap)->save([ - 'chain' => ['exp', 'REPLACE(chain, "/' . $fromPromote['id'] . '/","/' . $toPromote['id'] . '/")'], - 'level' . $toPromote['level'] => $toPromote['id'] - ]); + M('promote', 'tab_')->where($secondMap)->save([ + 'chain' => ['exp', 'REPLACE(chain, "/' . $fromPromote['id'] . '/","/' . $toPromote['id'] . '/")'], + 'level' . $toPromote['level'] => $toPromote['id'] + ]); - $status = M('ShiftTask')->where('id=' . $task['id'])->save(['status' => 1, 'handle_time' => time()]); - if (!$status) { + $model->commit(); + return ['status' => true, 'msg' => '推广帐号迁移成功']; + } catch (\Exception $e) { $model->rollback(); - return ['status' => false, 'msg' => '系统异常,修改迁移任务状态失败']; + return ['status' => true, 'msg' => '推广帐号迁移失败: ' . $e->getMessage()]; } - - $model->commit(); - return ['status' => true, 'msg' => '推广帐号迁移成功']; } public function shiftRemoveCoin($promote, $task) @@ -234,7 +233,7 @@ class PromoteService { $topBalanceCoin = $this->getBalanceCoin($topPromote['id'], 0); $topBalancePlus = 0; - $map = ['chain' => $promote['chain'] . $chain['id'] . '/%']; + $map = ['chain' => $promote['chain'] . $promote['id'] . '/%']; if (count($shiftIds) > 0) { $map['id'] = ['in', $shiftIds]; } @@ -358,7 +357,6 @@ class PromoteService { $formConpany = M('promote_company', 'tab_')->field(['company_name', 'company_belong'])->where(['id' => $fromPromote['company_id']])->find(); $toConpany = M('promote_company', 'tab_')->field(['company_name', 'company_belong'])->where(['id' => $toPromote['company_id']])->find(); $belongs = PromoteCompanyService::$belongs; - $mends = []; foreach ($users as $item) { $amount = isset($payAmountRows[$item['id']]) ? round(floatval($payAmountRows[$item['id']]['pay_amount']), 2) : 0; @@ -404,7 +402,7 @@ class PromoteService { $model = new Model(); $model->startTrans(); - + $status = M('mend', 'tab_')->addAll($mends); if (!$status) { $model->rollback(); @@ -435,39 +433,62 @@ class PromoteService { return ['status' => false, 'msg' => '系统异常,修改用户推广员失败']; } - M('user_play', 'tab_')->where($otherMap)->save($updateData); - M('user_play_info', 'tab_')->where($otherMap)->save($updateData); - - unset($spendMap['pay_status']); + try { + M('user_play', 'tab_')->where($otherMap)->save($updateData); + M('user_play_info', 'tab_')->where($otherMap)->save($updateData); + + unset($spendMap['pay_status']); - $updateCheck = []; - if (count($hasGameIds) > 0) { - $spendMap['game_id'] = ['in', $hasGameIds]; - M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket, ['is_check' => 1])); - } + if (count($hasGameIds) > 0) { + $spendMap['game_id'] = ['in', $hasGameIds]; + M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket, ['is_check' => 1])); + } - if (count($hasNotGameIds) > 0) { - $spendMap['game_id'] = ['in', $hasNotGameIds]; - M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket, ['is_check' => 2])); - } + if (count($hasNotGameIds) > 0) { + $spendMap['game_id'] = ['in', $hasNotGameIds]; + M('spend', 'tab_')->where($spendMap)->save(array_merge($updateData, $updateMarket, ['is_check' => 2])); + } - $bindMap = $otherMap; - $bindMap['pay_time'] = ['egt', $orderTime]; - M('bind_spend', 'tab_')->where($bindMap)->save($updateData); + $bindMap = $otherMap; + $bindMap['pay_time'] = ['egt', $orderTime]; + M('bind_spend', 'tab_')->where($bindMap)->save($updateData); - $orderMap = $otherMap; - $orderMap['create_time'] = ['egt', $orderTime]; - M('deposit', 'tab_')->where($orderMap)->save(array_merge($updateData, $updateMarket)); - M('user_play_data_count', 'tab_')->where($orderMap)->save(['promote_id' => $toPromote['id']]); + $orderMap = $otherMap; + $orderMap['create_time'] = ['egt', $orderTime]; + M('deposit', 'tab_')->where($orderMap)->save(array_merge($updateData, $updateMarket)); + M('user_play_data_count', 'tab_')->where($orderMap)->save(['promote_id' => $toPromote['id']]); - $status = M('shift_task', 'sys_')->where('id=' . $task['id'])->save(['status' => 1, 'handle_time' => time()]); - if (!$status) { + $model->commit(); + return ['status' => true, 'msg' => '玩家迁移成功']; + } catch (\Exception $e) { $model->rollback(); - return ['status' => false, 'msg' => '系统异常,修改迁移任务失败']; + return ['status' => true, 'msg' => '系统异常: ' . $e->getMessage()]; } + } - $model->commit(); - return ['status' => true, 'msg' => '玩家迁移成功']; + public function afterShift($task, $result) + { + $data = []; + if ($result['status']) { + $data = ['status' => 1, 'result' => $result['msg'], 'handle_time' => time()]; + } else { + $data = ['status' => 2, 'result' => $result['msg'], 'handle_time' => time()]; + } + M('shift_task', 'sys_')->where('id=' . $task['id'])->save($data); + } + + public function shift($task) + { + $result = null; + if ($task['type'] == 1) { + $result = $this->shiftPromote($task); + } elseif ($task['type'] == 2) { + $result = $this->shiftPlayer($task); + } else { + $result = ['status' => false, 'msg' => '类型错误']; + } + $this->afterShift($task, $result); + return $result; } public function cancelShift($params) From d314e6164a955facbee0ebcb19b4367d73ff60be Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Thu, 22 Apr 2021 09:20:31 +0800 Subject: [PATCH 2/4] =?UTF-8?q?4.22=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RechargeSumOtherController.class.php | 99 ++++++ .../View/RechargeSumOther/summation.html | 307 ++++++++++++++++++ 2 files changed, 406 insertions(+) create mode 100644 Application/Admin/Controller/RechargeSumOtherController.class.php create mode 100644 Application/Admin/View/RechargeSumOther/summation.html diff --git a/Application/Admin/Controller/RechargeSumOtherController.class.php b/Application/Admin/Controller/RechargeSumOtherController.class.php new file mode 100644 index 000000000..e3041cbef --- /dev/null +++ b/Application/Admin/Controller/RechargeSumOtherController.class.php @@ -0,0 +1,99 @@ +redirect(ACTION_NAME, array('timeStart' => date('Y-m-d',strtotime('-7 day')),"timeEnd"=>date('Y-m-d'))); + } + + $total = ['current' => 0, 'sum' => 0]; + $map['date'] = array('BETWEEN', array($startDateTime, $endDateTime)); + + $_REQUEST['game_name'] ? ($map['game_name'] = $_REQUEST['game_name']) :''; + + $data = M("recharge_text","tab_")->where($map)->order("date desc")->select(); + + if (isset($_REQUEST['row'])) { + $row = $_REQUEST['row']; + } else { + $row = 10; + } + foreach ($data as $k => $v) { + $total['sum'] += $v['day_pay']; + } + $count = count($data); + $export_data = $data; + $page = set_pagination($count, $row); + if ($page) { + $this->assign('_page', $page); + } + //用array_slice(array,offset,length) 函数在数组中根据条件取出一段值;array(数组),offset(元素的开始位置),length(组的长度) + $data = array_slice($data, ($p - 1) * $row, $row); + + foreach ($data as $k => $v) { + $total['current'] += $v['day_pay']; + } + + + //判断是否执行导出 + if (I('export') == 1) { + //操作日志 + $GetData = $_GET; + unset($GetData['xlsname']); + unset($GetData['export']); + addOperationLog(['op_type'=>3,'key'=>getNowDate(),'url'=>U('RechargeSum/summation',$GetData),'menu'=>'充值-游戏订单-充值汇总-导出']); + + $this->exportSum($export_data); + } + + $this->assign('showPromote', session('user_auth')['show_promote']); + $this->assign('meta_title', "充值汇总"); + $this->assign('list_data', $data); + $this->assign('total', $total); + $this->assign('startDate', $startDateTime); + $this->assign('endDate', $endDateTime); + $this->assign("is_admin",is_administrator()); + $this->m_title = '充值汇总'; + $this->assign('commonset', M('Kuaijieicon')->where(['url' => 'RechargeSum/summation', 'status' => 1])->find()); + + + $this->display(); + } + + public function exportSum($data) + { + $export = A('Export'); + $exptitle = $_REQUEST['xlsname']; + $expCellName = array( + array('date', '日期'), + array('from_channel', '渠道来源'), + array('game_name', '游戏名称'), + array('new_person', '新增人数'), + array('active_person', '活跃人数'), + array('new_pay_person', "新增玩家付费"), + array('day_pay', '本日累计'), + ); + if (session('user_auth')['show_promote'] == 0) { + foreach ($expCellName as $key => $row) { + if ($row[0] == 'promote_id') { + unset($expCellName[$key]); + break; + } + } + $expCellName = array_values($expCellName); + } + $expTableData = $data; + $export->exportExcel($exptitle, $expCellName, $expTableData); + } +} diff --git a/Application/Admin/View/RechargeSumOther/summation.html b/Application/Admin/View/RechargeSumOther/summation.html new file mode 100644 index 000000000..d58aedb0d --- /dev/null +++ b/Application/Admin/View/RechargeSumOther/summation.html @@ -0,0 +1,307 @@ + + + + + + + + + + +
+ +
+
+ +
+
+ + - +
+ + +
+
+
+ +
+
+ 搜索 +
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
日期渠道来源游戏名称新增人数活跃人数新增玩家付费本日累计付费
aOh! 暂时还没有内容!
{$data.date}{$data.from_channel}{$data.game_name}{$data.new_person}{$data.active_person}{$data.new_pay_person}{$data.day_pay}
汇总当页付费¥{$total.current|default=0} , 累计付费¥{$total.sum}
+
+
+
+ + 导出 + + {$_page|default=''} +
+ + + + +
+ + + + + + + + + + + From 69566e18392d0ba4ab3d7b84fb4c70404c6128ae Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Thu, 22 Apr 2021 09:28:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?4.22=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/StatementMangement/rewardExport.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Application/Admin/View/StatementMangement/rewardExport.html b/Application/Admin/View/StatementMangement/rewardExport.html index cf1bce9bb..0a4bfe84c 100644 --- a/Application/Admin/View/StatementMangement/rewardExport.html +++ b/Application/Admin/View/StatementMangement/rewardExport.html @@ -55,6 +55,7 @@ 结算方式 添加人 + 审核状态 @@ -91,6 +92,13 @@ 无 {:get_admin_name($data['creater_id'])} + + {$data.verify} + + {$data.verify} + + -- + @@ -118,6 +126,15 @@ {:get_admin_name($data['creater_id'])} + + + {$data.verify} + + {$data.verify} + + -- + + From f2e56125feea4b7f3b1026547bc45643cf2ee1ab Mon Sep 17 00:00:00 2001 From: zhengyongxing Date: Thu, 22 Apr 2021 09:45:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?4.22=E5=8F=B7=E5=8A=9F=E8=83=BD=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/View/StatementMangement/rewardManageList.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Application/Admin/View/StatementMangement/rewardManageList.html b/Application/Admin/View/StatementMangement/rewardManageList.html index 8e1e7b1fe..d8505f19f 100644 --- a/Application/Admin/View/StatementMangement/rewardManageList.html +++ b/Application/Admin/View/StatementMangement/rewardManageList.html @@ -325,11 +325,11 @@ - 合计 + 合计 -{:array_sum(array_column($list, 'totalPunish'))} 合计 {:array_sum(array_column($list, 'totalReward'))} - +