diff --git a/Application/Admin/Controller/ExportController.class.php b/Application/Admin/Controller/ExportController.class.php index 7ec2a4a0b..9b96f1855 100644 --- a/Application/Admin/Controller/ExportController.class.php +++ b/Application/Admin/Controller/ExportController.class.php @@ -2466,7 +2466,230 @@ class ExportController extends Controller 'order_amount'=>$sum_order_amount['sum_order_amount'], 'pay_amount'=>$sum_pay_amount['sum_order_amount']]]; $xlsData = array_merge($xlsData,$sumData); - break; + break; + case 28: + $xlsCell = array( + "账号ID","玩家账号", "账户平台币", "累计使用平台币", "累计充值平台币", "后台发放平台币" + ); + + $params = I('get.'); + $map = []; + $mapBanlance = []; + $mapSpend['pay_status'] = 1; + $mapSpend['pay_way'] = 0; + $mapDeposit['pay_status'] = 1; + $mapPromoteCoin['type'] = 2; + $mapPromoteCoin['sub_type'] = 4; + $nowTime = date('Y-m-d'); + $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); + $initEndTime = date('Y-m-d', time()); + if(!empty($params['user_account'])){ + $userInfo = M('user', 'tab_')->where(['account'=>I('user_account')])->getField('id'); + $map['user_account'] = $params['user_account']; + $mapBanlance['user_account'] = $params['user_account']; + $mapSpend['user_account'] = $params['user_account']; + $mapDeposit['user_account'] = $params['user_account']; + $mapPromoteCoin['target_id'] = $userInfo; + } + if (!empty($params['timestart']) && !empty($params['timeend'])) { + $map['create_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]); + $mapPromoteCoin['create_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]); + $mapDeposit['create_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]); + $mapSpend['pay_time'] = array('between', [strtotime($params['timestart']), strtotime($params['timeend']) + 86399]); + } elseif (!empty($params['timestart']) && empty($params['timeend'])) { + $map['create_time'] = array('between', [strtotime($params['timestart']), time()]); + $mapPromoteCoin['create_time'] = array('between', [strtotime($params['timestart']), time()]); + $mapDeposit['create_time'] = array('between', [strtotime($params['timestart']), time()]); + $mapSpend['pay_time'] = array('between', [strtotime($params['timestart']), time()]); + } elseif (empty($params['timestart']) && !empty($params['timeend'])) { + $map['create_time'] = array('elt', (strtotime($params['timeend']) + 86399)); + $mapPromoteCoin['create_time'] = array('elt', (strtotime($params['timeend']) + 86399)); + $mapDeposit['create_time'] = array('elt', (strtotime($params['timeend']) + 86399)); + $mapSpend['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + } + elseif (empty($_REQUEST['timestart']) && empty($_REQUEST['timeend']) && empty($params['user_account'])) { + $map['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapPromoteCoin['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapDeposit['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapSpend['pay_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + } + $total = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount'); + $totalSpend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount'); + $total_bind_balance = M('user_play', 'tab_')->where($mapBanlance)->sum('bind_balance'); + $totalPromoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin'); + $total = empty($total) ? '0.00' : $total; + $totalSpend = empty($totalSpend) ? '0.00' : $totalSpend; + $total_bind_balance = empty($total_bind_balance) ? '0.00' : $total_bind_balance; + $totalPromoteCoin = empty($totalPromoteCoin) ? '0.00' : $totalPromoteCoin; + + $csvFileName = '平台币统计'.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + + // $datas = M('user_play','tab_') + // ->group('user_id') + // ->field("id,user_id,user_account,bind_balance") + // ->where($map) + // ->page($page,$row) + // ->select(); + $count = M('user_play','tab_') + ->field("id,user_id,user_account,bind_balance") + ->where($map) + ->count('DISTINCT user_id'); + + $perSize = 10000;//每次查询的条数 + $pages = ceil($count / $perSize); + for($i = 1; $i <= $pages; $i++) { + + $datas = M('user_play','tab_') + ->group('user_id') + ->field("user_id,user_account,bind_balance") + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) + ->select(); + + foreach($datas as $data) { + $user_id = $data['user_id']; + $mapSpend['user_id'] = $user_id; + $mapDeposit['user_id'] = $user_id; + $mapPromoteCoin['target_id'] = $user_id; + $bind_balance = M('user_play', 'tab_')->where(['user_id' => $user_id])->sum('bind_balance'); + $spend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount'); + if (empty($spend)) { + $spend = '0.00'; + } + $deposit = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount'); + if (empty($deposit)) { + $deposit = '0.00'; + } + $promoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin'); + if (empty($promoteCoin)) { + $promoteCoin = '0.00'; + } + $data['user_id'] = $data['user_id']; + $data['user_account'] = $data['user_account']; + $data['bind_balance'] = $bind_balance; + $data['spend_amount'] = $spend; + $data['deposit_amount'] = $deposit; + $data['coin_amount'] = $promoteCoin; + mb_convert_variables('GBK', 'UTF-8', $data); + fputcsv($fp, $data); + } + unset($datas);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + $alldatas['user_id'] = "汇总(检索时间内所有数据的统计)"; + $alldatas['user_account'] = ""; + $alldatas['bind_balance'] = $total_bind_balance; + $alldatas['spend_amount'] = $totalSpend; + $alldatas['deposit_amount'] = $total; + $alldatas['coin_amount'] = $totalPromoteCoin; + mb_convert_variables('GBK', 'UTF-8', $alldatas); + fputcsv($fp, $alldatas); + fclose($fp); + //操作日志 + + + exit(); + + + break; + + case 29: + $xlsCell = array( + "订单号","时间", "类型", "变化值", "变化后的平台币" + ); + + $params = I('get.'); + $map = []; + if($orderNumber) { + $map['order_number'] = $params['order_number']; + } + $map['user_id'] = $params['user_id']; + if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + } + $total = 0; + // $valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, user_id, before_value, value, after_value, create_time, type, remark, pay_type') + // ->where($map) + // ->page($page,$row) + // ->select(); + + $csvFileName = '平台币明细'.'.csv'; + //设置好告诉浏览器要下载excel文件的headers + header('Content-Description: File Transfer'); + header('Content-Type: application/vnd.ms-excel'); + header('Content-Disposition: attachment; filename="'. $csvFileName .'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate'); + header('Pragma: public'); + $fp = fopen('php://output', 'a');//打开output流 + mb_convert_variables('GBK', 'UTF-8', $xlsCell); + fputcsv($fp, $xlsCell);//将数据格式化为CSV格式并写入到output流中 + $counts = M('value_detail_log', 'tab_')->field('id') + ->where($map) + ->count(); + $perSize = 10000;//每次查询的条数 + $pages = ceil($counts / $perSize); + + for($i = 1; $i <= $pages; $i++) { + + $valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, create_time, type, value, after_value, pay_type') + ->where($map) + ->limit(($i-1)*$perSize ,$perSize) + ->select(); + + foreach ($valueDetailDatas as $key => $valueDetailData) { + $vlaueDetailData['order_number'] = $valueDetailData['order_number']; + $vlaueDetailData['create_time'] = date('Y-m-d H:i:s', $valueDetailData['create_time']); + if($valueDetailData['pay_type'] == 1) { + $vlaueDetailData['type'] = "消费"; + $total -= $valueDetailData['value']; + } + if($valueDetailData['pay_type'] == 2) { + $vlaueDetailData['type'] = "充值"; + $total += $valueDetailData['value']; + } + if ($valueDetailData['pay_type'] == 3) { + $vlaueDetailData['type'] = "平台发放"; + $total += $valueDetailData['value']; + } + $vlaueDetailData['value'] = $valueDetailData['value']; + $vlaueDetailData['after_value'] = $valueDetailData['after_value']; + + mb_convert_variables('GBK', 'UTF-8', $vlaueDetailData); + fputcsv($fp, $vlaueDetailData); + } + unset($vlaueDetailDatas);//释放变量的内存 + //刷新输出缓冲到浏览器 + ob_flush(); + flush();//必须同时使用 ob_flush() 和flush() 函数来刷新输出缓冲。 + } + $alldatas['order_number'] = "汇总(检索时间内所有数据的统计)"; + $alldatas['create_time'] = ""; + $alldatas['type'] = ""; + $alldatas['value'] = $total; + $alldatas['after_value'] = ""; + + mb_convert_variables('GBK', 'UTF-8', $alldatas); + fputcsv($fp, $alldatas); + fclose($fp); + exit; + break; default: $xlsName = $xlsCell = $xlsData = []; diff --git a/Application/Admin/Controller/FinanceController.class.php b/Application/Admin/Controller/FinanceController.class.php index d66eded35..ffb826198 100644 --- a/Application/Admin/Controller/FinanceController.class.php +++ b/Application/Admin/Controller/FinanceController.class.php @@ -1173,4 +1173,171 @@ class FinanceController extends ThinkController $this->display(); } + public function valueDetail($p = 1) { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row=10; + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + $map = []; + $mapBanlance = []; + $mapSpend['pay_status'] = 1; + $mapSpend['pay_way'] = 0; + $mapDeposit['pay_status'] = 1; + $mapPromoteCoin['type'] = 2; + $mapPromoteCoin['sub_type'] = 4; + $nowTime = date('Y-m-d'); + $initBegTime = date('Y-m-d', strtotime('-6 day', strtotime($nowTime))); + $initEndTime = date('Y-m-d', time()); + if(!empty(I('user_account'))){ + $userInfo = M('user', 'tab_')->where(['account'=>I('user_account')])->getField('id'); + $map['user_account']=I('user_account'); + $mapBanlance['user_account'] = I('user_account'); + $mapSpend['user_account'] = I('user_account'); + $mapDeposit['user_account'] = I('user_account'); + $mapPromoteCoin['target_id'] = $userInfo; + $mapValue['user_id'] = $userInfo; + } + $mapValue['pay_type'] = ['gt', 0]; + if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + $mapPromoteCoin['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + $mapDeposit['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + $mapSpend['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + $mapValue['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + $mapPromoteCoin['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + $mapDeposit['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + $mapSpend['pay_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + $mapValue['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + $mapPromoteCoin['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + $mapDeposit['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + $mapSpend['pay_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + $mapValue['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + }elseif (empty($_REQUEST['timestart']) && empty($_REQUEST['timeend']) && empty(I('user_account'))) { + $map['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapPromoteCoin['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapDeposit['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapSpend['pay_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + $mapValue['create_time'] = array('between', [strtotime($initBegTime), strtotime($initEndTime) + 86399]); + } + + $datas = M('user_play','tab_') + ->group('user_id') + ->field("id,user_id,user_account,bind_balance") + ->where($map) + ->page($page,$row) + ->select(); + $count = M('user_play','tab_') + ->field("id,user_id,user_account,bind_balance") + ->where($map) + ->count('DISTINCT user_id'); + $total = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount'); + $totalSpend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount'); + + // $total_bind_balance = M('user_play', 'tab_')->where($mapBanlance)->sum('bind_balance'); + $totalValueInit = M('value_detail_log', 'tab_')->where(['pay_type'=>0])->sum('after_value'); + $totalValueDetail = M('value_detail_log', 'tab_')->where($mapValue)->group('user_id')->order('desc create_time')->sum('after_value'); + $total_bind_balance = $totalValueInit + $totalValueDetail; + $totalPromoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin'); + $total = empty($total) ? '0.00' : $total; + $totalSpend = empty($totalSpend) ? '0.00' : $totalSpend; + $total_bind_balance = empty($total_bind_balance) ? '0.00' : $total_bind_balance; + $totalPromoteCoin = empty($totalPromoteCoin) ? '0.00' : $totalPromoteCoin; + foreach ($datas as $key => $data) { + $user_id = $data['user_id']; + $mapSpend['user_id'] = $user_id; + $mapDeposit['user_id'] = $user_id; + $mapPromoteCoin['target_id'] = $user_id; + $bind_balance = M('user_play', 'tab_')->where(['user_id' => $user_id])->sum('bind_balance'); + $spend = M('spend', 'tab_')->where($mapSpend)->sum('pay_amount'); + if (empty($spend)) { + $spend = '0.00'; + } + $deposit = M('deposit', 'tab_')->where($mapDeposit)->sum('pay_amount'); + if (empty($deposit)) { + $deposit = '0.00'; + } + $promoteCoin = M('promote_coin_record', 'tab_')->where($mapPromoteCoin)->sum('coin'); + if (empty($promoteCoin)) { + $promoteCoin = '0.00'; + } + $datas[$key]['bind_balance'] = $bind_balance; + $datas[$key]['spend_amount'] = $spend; + $datas[$key]['deposit_amount'] = $deposit; + $datas[$key]['coin_amount'] = $promoteCoin; + } + $page = set_pagination($count,$row); +// var_dump($page);die(); + if($page) {$this->assign('_page', $page);} + if(empty($_REQUEST['timestart']) && empty($_REQUEST['timeend']) && empty(I('user_account'))) { + $this->assign('starttime', $initBegTime); + $this->assign('endtime', $initEndTime); + }else { + $this->assign('starttime', $_REQUEST['timestart']); + $this->assign('endtime', $_REQUEST['endtime']); + } + $this->assign('totalPromoteCoin', $totalPromoteCoin); + $this->assign('total_bind_balance', $total_bind_balance); + $this->assign('totalSpend', $totalSpend); + $this->assign('total', $total); + $this->assign('data', $datas); + $this->display(); + } + + public function definiteDetaile() { + $page = intval($p); + $page = $page ? $page : 1; //默认显示第一页数据 + $row=10; + if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;} + $user_id = I('user_id'); + $orderNumber = I('order_number'); + $map = []; + if($orderNumber) { + $map['order_number'] = $orderNumber; + } + $map['user_id'] = $user_id; + if (!empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), strtotime($_REQUEST['timeend']) + 86399]); + } elseif (!empty($_REQUEST['timestart']) && empty($_REQUEST['timeend'])) { + $map['create_time'] = array('between', [strtotime($_REQUEST['timestart']), time()]); + } elseif (empty($_REQUEST['timestart']) && !empty($_REQUEST['timeend'])) { + $map['create_time'] = array('elt', (strtotime($_REQUEST['timeend']) + 86399)); + } + $total = 0; + $valueDetailDatas = M('value_detail_log', 'tab_')->field('order_number, user_id, before_value, value, after_value, create_time, type, remark, pay_type') + ->where($map) + ->page($page,$row) + ->select(); + $counts = M('value_detail_log', 'tab_')->field('id') + ->where($map) + ->count(); + foreach ($valueDetailDatas as $key => $valueDetailData) { + $vlaueDetailDatas[$key]['create_time'] = date('Y-m-d H:i:s', $valueDetailData['create_time']); + $vlaueDetailDatas[$key]['value'] = $valueDetailData['value']; + $vlaueDetailDatas[$key]['after_value'] = $valueDetailData['after_value']; + $vlaueDetailDatas[$key]['order_number'] = $valueDetailData['order_number']; + $vlaueDetailDatas[$key]['pay_type'] = $valueDetailData['pay_type']; + if($valueDetailData['pay_type'] == 1) { + $vlaueDetailDatas[$key]['type'] = "消费"; + $total -= $valueDetailData['value']; + } + if($valueDetailData['pay_type'] == 2) { + $vlaueDetailDatas[$key]['type'] = "充值"; + $total += $valueDetailData['value']; + } + if ($valueDetailData['pay_type'] == 3) { + $vlaueDetailDatas[$key]['type'] = "平台发放"; + $total += $valueDetailData['value']; + } + } + $page = set_pagination($counts,$row); + if($page) {$this->assign('_page', $page);} + $this->assign('total', $total); + $this->assign('listdata', $vlaueDetailDatas); + $this->display(); + } + } \ No newline at end of file diff --git a/Application/Admin/View/Finance/definiteDetaile.html b/Application/Admin/View/Finance/definiteDetaile.html new file mode 100644 index 000000000..5356b6f0b --- /dev/null +++ b/Application/Admin/View/Finance/definiteDetaile.html @@ -0,0 +1,357 @@ + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+ +
+ + - +
+ + +
+
+ + +
+ 搜索 +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
订单号时间类型变化值变化后的平台币
aOh! 暂时还没有内容!
{$data.order_number}{$data.create_time}{$data.type}{$data.value}{$data.value}{$data.after_value}
汇总(检索时间内所有数据的统计) + {$total}{$total} +
+
+
+
+ 导出 + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Admin/View/Finance/valueDetail.html b/Application/Admin/View/Finance/valueDetail.html new file mode 100644 index 000000000..4b33a9fb3 --- /dev/null +++ b/Application/Admin/View/Finance/valueDetail.html @@ -0,0 +1,380 @@ + + + + + + + + + + + +
+ +
+
+ +
+
+ +
+ +
+ + - +
+ + +
+
+ + + + + + + + + + + + + + + + + + + + +
+ 搜索 +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
账号ID玩家账号账户平台币累计使用平台币累计充值平台币后台发放平台币操作
aOh! 暂时还没有内容!
{$data.user_id}{$data.user_account}{$data.bind_balance}{$data.spend_amount}{$data.deposit_amount}{$data.coin_amount} + 查看详情 +
汇总(检索时间内所有数据的统计){$total_bind_balance}{$totalSpend}{$total}{$totalPromoteCoin}
+
+
+
+ 导出 + {$_page|default=''} +
+ + + +
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + diff --git a/Application/Base/Service/PromoteCoinRecordService.class.php b/Application/Base/Service/PromoteCoinRecordService.class.php index c8b896354..ae1776fea 100644 --- a/Application/Base/Service/PromoteCoinRecordService.class.php +++ b/Application/Base/Service/PromoteCoinRecordService.class.php @@ -67,8 +67,12 @@ class PromoteCoinRecordService { return $items; } - public function addRecord($params) { + public function addRecord($params,$valueDetailData = []) { $data = $this->createRecord($params); + if(!empty($valueDetailData)) { + $valueDetailData['order_number'] = $data['sn']; + addValueDetail($valueDetailData); + } return M('PromoteCoinRecord', 'tab_')->add($data); } diff --git a/Application/Base/Service/PromoteService.class.php b/Application/Base/Service/PromoteService.class.php index 6595b95ab..b3aeba218 100644 --- a/Application/Base/Service/PromoteService.class.php +++ b/Application/Base/Service/PromoteService.class.php @@ -443,6 +443,7 @@ class PromoteService { $promote = M('promote', 'tab_')->where(['id' => $promoteId])->find(); $user = M('user', 'tab_')->where(['id' => $userId])->find(); $userPlay = M('user_play', 'tab_')->where(['user_id' => $userId])->find(); + $before_value = M('user_play', 'tab_')->where(['user_id' => $userId])->sum('bind_balance'); $game = M('game', 'tab_')->where(['id' => $gameId])->find(); $fromBalanceCoin = 0; if ($isUseBind) { @@ -513,8 +514,19 @@ class PromoteService { 'description' => $isUseBind ? '绑定币转账' : '通用币转账', 'remark' => $remark, ]; - $promoteCoinRecordService->addRecord($fromRecord); - + + $valueDetailData = [ + 'user_id' => $userId, + 'before_value' => $before_value, + 'value' => $num, + 'after_value' => $num + $before_value, + 'create_time' => time(), + 'type' => 1, + 'remark' => $remark, + 'pay_type' => 3, + ]; + $promoteCoinRecordService->addRecord($fromRecord, $valueDetailData); + $incStatus = M('user_play', 'tab_')->where(['game_id' => $gameId, 'user_id' => $userId])->setInc('bind_balance', $num); $decStatus = $this->decCoin($promoteId, $num, $isUseBind ? $gameId : 0); if (!$incStatus || !$decStatus) { diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index baefa8756..7e21fa50b 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -1483,4 +1483,13 @@ function getGameGroup($uid) { return $groupId['group_id']?$groupId['group_id']:0; +} + +function addValueDetail($data) { + $user_id = $data['user_id']; + $detailInfo = M('value_detail_log', 'tab_')->field('id')->where(['user_id'=>$user_id, 'pay_type'=>0])->find(); + if(!empty($detailInfo)) { + M('value_detail_log', 'tab_')->where(['id'=>$detailInfo['id']])->delete(); + } + return M('value_detail_log', 'tab_')->add($data); } \ No newline at end of file diff --git a/Application/Home/View/default/TestResource/add.html b/Application/Home/View/default/TestResource/add.html index c750980d3..211525ba6 100644 --- a/Application/Home/View/default/TestResource/add.html +++ b/Application/Home/View/default/TestResource/add.html @@ -350,11 +350,11 @@ success: function (data) { console.log(); str = ""; - var support_quota = "单角色可申请上限:0"; + // var support_quota = "单角色可申请上限:0"; for (var i in data) { str += "" - var support_quota = "单角色可申请上限:" + data[i].support_quota + "" + // var support_quota = "单角色可申请上限:" + data[i].support_quota + "" } $('#support_quota').html(support_quota);