下游个人结算单生成代码上传

master
zhengyongxing 5 years ago
parent 77463c7e1d
commit 5ab9f2cc1c

@ -360,11 +360,21 @@ class AjaxController extends ThinkController{
if (!in_array($v['game_name'],$gameStr)) {
array_push($gameStr,$v['game_name']);
} else {
$game_ratio[$v['game_name']] = $v;
unset($data['game_ratio'][$key]);
// var_dump($key);
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]);
}
}
if (!$value) {
unset($data['game_ratio'][$key]);
}
}
// dump($data['game_ratio']);die();

@ -346,4 +346,103 @@ class StatementMangementController extends ThinkController
return $this->success($data, '', true);
}
public function PersonOrderList() {
$map = [];
$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();
$gameStr = [];
$game_ratio = [];
foreach($data as $dkey => &$dval) {
$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), '('));
if (!in_array($v['game_name'],$gameStr)) {
array_push($gameStr,$v['game_name']);
} else {
// var_dump($key);
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]);
}
//
}
if (!$value) {
unset($dval['game_ratio'][$key]);
}
}
foreach ($dval['game_ratio'] as $key => $val) {
$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();
foreach ($rewardData as $rk => $rv) {
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']]) {
$v['sum_amount'] = number_format($v['sum_amount'] + $game_ratio[$v['game_name']]['sum_amount'],2,'.','');
}
}
unset($dval['game_ratio'][$key]);
array_push($dval['game_ratio'],$val[0]);
}
}
}
dump($data);
$this->display();
}
}

Loading…
Cancel
Save