diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php
index 8ebfc1ae6..33f054e5d 100644
--- a/Application/Admin/Common/extend.php
+++ b/Application/Admin/Common/extend.php
@@ -2080,4 +2080,11 @@ function getGameCpRadio($game_id,$amount,$type) {
}
+function check_str($str, $substr)
+{
+ $nums=substr_count($str,$substr);
+
+ return $nums;
+}
+
?>
diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php
index 5cadcf02b..29ea0a276 100644
--- a/Application/Admin/Controller/StatementMangementController.class.php
+++ b/Application/Admin/Controller/StatementMangementController.class.php
@@ -351,100 +351,153 @@ class StatementMangementController extends ThinkController
public function PersonOrderList() {
- $map = [];
+ if ($_REQUEST['time_start'] || $_REQUEST['time_end'] ) {
+ $withdrawMap = [];
+ if ($_REQUEST['time_start']&&!$_REQUEST['time_end']) {
+ $withdrawMap['settlement_begin_time'] = ['egt',strtotime($_REQUEST['time_start'])];
+ }
- $data = M('withdraw','tab_')
- ->field("tab_withdraw.id,pc.company_name,pc.id as cid,tab_withdraw.promote_id,tab_withdraw.promote_account,username,'个人' as type,game_ratio
- ,mobile_phone,real_name,tab_promote.bank_card,account_openin,tab_promote.address,bank_account")
- ->join('left join tab_promote_belong on tab_withdraw.promote_id=tab_promote_belong.promote_id')
- ->join("left join tab_statement as statement on tab_withdraw.widthdraw_number = statement.ext_field")
- ->join("left join tab_promote on tab_promote.id=tab_promote_belong.promote_id")
- ->join("left join tab_promote_company as pc on pc.id = tab_promote.company_id")
- ->join("left join sys_ucenter_member on sys_ucenter_member.id=tab_promote.admin_id")
- ->where("ext_field is null and tab_promote_belong.company_type=2")
- ->where($map)
- ->select();
+ if (!$_REQUEST['time_start']&&$_REQUEST['time_end']) {
+ $withdrawMap['settlement_end_time'] = ['elt',strtotime($_REQUEST['time_end'])];
+ }
+
+ if ($_REQUEST['time_start']&&$_REQUEST['time_end']) {
+ $withdrawMap['settlement_begin_time'] = ['egt',strtotime($_REQUEST['time_start'])];
+ $withdrawMap['settlement_end_time'] = ['elt',strtotime($_REQUEST['time_end'])];
+ }
- $gameStr = [];
- $game_ratio = [];
- foreach($data as $dkey => &$dval) {
+ $data = M('withdraw',"tab_")
+ ->field("widthdraw_number,settlement_begin_time,settlement_end_time,settlement_type,promote_account")
+ ->join('left join tab_promote_belong on tab_withdraw.promote_id=tab_promote_belong.promote_id')
+ ->join("left join tab_statement as statement on tab_withdraw.widthdraw_number = statement.ext_field")
+ ->where("ext_field is null and tab_promote_belong.company_type=2")
+ ->where($withdrawMap)
+ ->select();
- $dval['game_ratio'] = json_decode($dval['game_ratio'],true);
+ $this->assign('withdraw_data',$data);
+
+ }
- if (is_array($dval['game_ratio'])) {
- foreach ($dval['game_ratio'] as $key => &$value) {
+ if ($_REQUEST['withdraw']) {
- foreach ($value as $k => &$v) {
+ $map = [];
+
+ $map['widthdraw_number'] = ['in',$_REQUEST['withdraw']];
+
+ $data = M('withdraw','tab_')
+ ->field("tab_withdraw.id,pc.company_name,pc.id as cid,tab_withdraw.promote_id,tab_withdraw.promote_account,username,'个人' as type,game_ratio
+ ,mobile_phone,real_name,tab_promote.bank_card,account_openin,tab_promote.address,bank_account")
+ ->join('left join tab_promote_belong on tab_withdraw.promote_id=tab_promote_belong.promote_id')
+ ->join("left join tab_statement as statement on tab_withdraw.widthdraw_number = statement.ext_field")
+ ->join("left join tab_promote on tab_promote.id=tab_promote_belong.promote_id")
+ ->join("left join tab_promote_company as pc on pc.id = tab_promote.company_id")
+ ->join("left join sys_ucenter_member on sys_ucenter_member.id=tab_promote.admin_id")
+ ->where("ext_field is null and tab_promote_belong.company_type=2")
+ ->where($map)
+ ->select();
+
+
+ $game_ratio = [];
+ foreach($data as $dkey => &$dval) {
+ $gameStr = [];
+// $address = '';
+// if (is_array($data['address'])) {
+// foreach($data['address'] as $key => $value) {
+// $address = $address.' '.$value;
+// }
+// }
+// $dval['address'] = $address;
+ $rowspan = 0;
+ $dval['rowspan'] = 0;
+
+ $dval['game_ratio'] = json_decode($dval['game_ratio'],true);
+
+ if (is_array($dval['game_ratio'])) {
+ foreach ($dval['game_ratio'] as $key => &$value) {
+
+ foreach ($value as $k => &$v) {
// $v['game_id'] = $key;
- $v['game_name'] = substr(get_gamename($key),0,strpos(get_gamename($key), '('));
+ $v['game_name'] = substr(get_gamename($key),0,strpos(get_gamename($key), '('));
- if (!in_array($v['game_name'],$gameStr)) {
- array_push($gameStr,$v['game_name']);
+ if (!in_array($v['game_name'],$gameStr)) {
+ array_push($gameStr,$v['game_name']);
- } else {
+ } else {
// var_dump($key);
- if (!$game_ratio[$v['game_name']]) {
- $game_ratio[$v['game_name']] = $v;
+ if (!$game_ratio[$v['game_name']]) {
+ $game_ratio[$v['game_name']] = $v;
+ }
+ else {
+ $game_ratio[$v['game_name']]['sum_amount'] += $v['sum_amount'];
+ }
+ unset($value[$k]);
}
- else {
- $game_ratio[$v['game_name']]['sum_amount'] += $v['sum_amount'];
- }
- unset($value[$k]);
- }
//
- }
- if (!$value) {
- unset($dval['game_ratio'][$key]);
- }
+ }
+ if (!$value) {
+ unset($dval['game_ratio'][$key]);
+ }
- }
+ }
+ foreach ($dval['game_ratio'] as $key => $val) {
- foreach ($dval['game_ratio'] as $key => $val) {
+ $val[0]['reward'] = 0;
+ $val[0]['forfeit'] = 0;
+ $startTime = strtotime($val[0]['begin_time']);
+ $endTime = strtotime($val[0]['end_time']);
- $startTime = strtotime($val[0]['begin_time']);
- $endTime = strtotime($val[0]['end_time']);
+ $rewardData = M('reward_record','tab_')
+ ->field("sum(tab_reward_record.money) as money,reward_type,relation_game_name")
+ ->join("left join (select * from tab_game group by relation_game_id)tab_game on tab_reward_record.relation_game_id=tab_game.relation_game_id")
+ ->where(['company_type'=>2,'relation_game_name'=>['like',"%{$val[0]['game_name']}%"],'reward_time'=>['between',[$startTime,$endTime]]])
+ ->group('reward_type')
+ ->select();
- $rewardData = M('reward_record','tab_')
- ->field("sum(tab_reward_record.money) as money,reward_type,relation_game_name")
- ->join("left join (select * from tab_game group by relation_game_id)tab_game on tab_reward_record.relation_game_id=tab_game.relation_game_id")
- ->where(['company_type'=>2,'relation_game_name'=>['like',"%{$val[0]['game_name']}%"],'reward_time'=>['between',[$startTime,$endTime]]])
- ->group('reward_type')
- ->select();
+ foreach ($rewardData as $rk => $rv) {
- foreach ($rewardData as $rk => $rv) {
+ if ($rv['reward_type'] == 1) {
+ $val[0]['reward'] = $rv['money'];
+ } else {
+ $val[0]['forfeit'] = $rv['money'];
+ }
- if ($rv['reward_type'] == 1) {
- $val[0]['reward'] = $rv['money'];
- } else {
- $val[0]['forfeit'] = $rv['money'];
}
- }
+ foreach ($val as $k => &$v) {
+ if ($game_ratio[$v['game_name']]) {
- foreach ($val as $k => &$v) {
+ $v['sum_amount'] = number_format($v['sum_amount'] + $game_ratio[$v['game_name']]['sum_amount'],2,'.','');
- if ($game_ratio[$v['game_name']]) {
+ }
+ //计算结算金额
+ $val[0]['real_amount'] = number_format($val[0]['sum_amount'] * ($val[0]['selle_ratio']/100)+$val[0]['reward']-$val[0]['forfeit'],2,'.','');
+ }
- $v['sum_amount'] = number_format($v['sum_amount'] + $game_ratio[$v['game_name']]['sum_amount'],2,'.','');
+ $rowspan++;
+ unset($dval['game_ratio'][$key]);
+ array_push($dval['game_ratio'],$val[0]);
- }
}
- unset($dval['game_ratio'][$key]);
- array_push($dval['game_ratio'],$val[0]);
-
- }
+ $dval['rowspan'] = $rowspan;
+
+ }
}
+
+ $this->assign('data',$data);
+
}
+ $this->display();
+
+ }
+ public function savePersonOrder() {
- dump($data);
- $this->display();
}
diff --git a/Application/Admin/View/StatementMangement/PersonOrderList.html b/Application/Admin/View/StatementMangement/PersonOrderList.html
new file mode 100644
index 000000000..82b51871f
--- /dev/null
+++ b/Application/Admin/View/StatementMangement/PersonOrderList.html
@@ -0,0 +1,434 @@
+
+
+
+
+
+
+ 充值查询列表|----软件管理平台
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 序号 |
+ 下游名称 |
+ 会长账号 |
+ 市场员 |
+ 下游类型 |
+ 产品 |
+
+ 结算时间 |
+ 推广流水 |
+ 分成比例 |
+ 奖励 |
+ 罚款 |
+ 结算金额 |
+
+ 开户名 |
+ 银行卡号 |
+ 开户支行 |
+
+
+
+
+
+
+
+
+
+
+
+ {$data.id} |
+ {$data.company_name} |
+ {$data.promote_account} |
+ {$data.username} |
+ {$data.type} |
+
+ 空 |
+ 空 |
+ 空 |
+ 空 |
+ 空 |
+ 空 |
+ 空 |
+
+ {$data.bank_account} |
+ {$data.bank_card} |
+ {$data.account_openin} |
+
+
+
+
+
+ {$data.id} |
+ {$data.company_name} |
+ {$data.promote_account} |
+ {$data.username} |
+ {$data.type} |
+
+ {$game_ratio.game_name} |
+ {$game_ratio.begin_time|0} - {$game_ratio.end_time|0} |
+ {$game_ratio.sum_amount|0} |
+ {$game_ratio.selle_ratio|0} |
+ {$game_ratio.reward|0} |
+ {$game_ratio.forfeit|0} |
+ {$game_ratio.real_amount|0} |
+
+ {$data.bank_account} |
+ {$data.bank_card} |
+ {$data.account_openin} |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 导出
+
+ {$_page|default=''}
+
+
+
+
+
+
+ if(C('COLOR_STYLE')=='blue_color') echo '
+
+ ';
+
+
+
+
+
+
+
+
+
diff --git a/Application/Admin/View/StatementMangement/lists.html b/Application/Admin/View/StatementMangement/lists.html
index 59a5b90fd..59ddf2c8b 100644
--- a/Application/Admin/View/StatementMangement/lists.html
+++ b/Application/Admin/View/StatementMangement/lists.html
@@ -94,6 +94,7 @@
@@ -224,6 +225,17 @@
});
});
+ $("#persondownstream").click(function () {
+ layer.open({
+ type: 2,
+ title: "海南万盟天下科技有限公司",
+ shadeClose: true,
+ shade: 0.8,
+ area: ['70%', '80%'],
+ content: '/admin.php?s=/statementMangement/PersonOrderList/'
+ });
+ });
+
$(".statement_edit").click(function () {
var edit = $(this).data();