Merge pull request 'feature/st_mange_20201202' (#6) from feature/st_mange_20201202 into release

优化公式
master
陈志 4 years ago
commit 9d30d48fac

@ -127,7 +127,7 @@ class CompanyStatementLackController extends ThinkController
//下游公司
A("CompanyStatementPool")->viewPcPool($dbres,$is_export,$withdraw_type);
}else{
A("CompanyStatementPool")->viewPuPool($dbres,$is_export,$withdraw_type);
A("CompanyStatementPool")->viewPuPool($dbres,$is_export,["withdraw_type"=>3]);
}
}
@ -284,7 +284,7 @@ class CompanyStatementLackController extends ThinkController
A("CompanyStatementPool")->viewPcPool($dbres,$is_export);
}else{
$this->assign("title","下游个人未汇总");
A("CompanyStatementPool")->viewPuPool($dbres,$is_export);
A("CompanyStatementPool")->viewPuPool($dbres,$is_export,["withdraw_type"=>3]);
}
}

@ -218,7 +218,7 @@ class CompanyStatementPoolController extends ThinkController
//获取基本信息
$infolist = M("company_statement_info","tab_")->field("*,'1' as st")->where("pool_id = '{$id}'")->select();
//获取母单
$pool_info = M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type')->where("id={$id}")->find();
$pool_info = M("company_statement_pool","tab_")->field('statement_num,create_lack_ids,verify_status,is_payment,withdraw_type,statement_begin_time,statement_end_time')->where("id={$id}")->find();
if(!empty($pool_info['create_lack_ids'])){
$l_ids = $pool_info['create_lack_ids'];
$lack_info = M("company_lack_statement_info","tab_")->field("*,'0' as st")->where("id in ({$l_ids})")->select();
@ -236,7 +236,7 @@ class CompanyStatementPoolController extends ThinkController
//下游公司
$this->viewPcPool($infolist,$is_export);
}else{
$this->viewPuPool($infolist,$is_export);
$this->viewPuPool($infolist,$is_export,$pool_info);
}
}
@ -466,11 +466,19 @@ class CompanyStatementPoolController extends ThinkController
}
//个人汇总结算查看
public function viewPuPool(&$infolist,$is_export){
public function viewPuPool(&$infolist,$is_export,$pool_info){
$line = 1;
$count = [];
$count = [
"pool_week_count"=>0,//上周数据合计
"pool_lack_count"=>0,//本周未结算流水合计
"sum_money"=>0,//打款合计
"pool_lack_count"=>0,//本周未结算流水合计
"st_lack_count"=>0,//本周暂不结算合计
"st_count"=>0//本次应支付
];
$week_line = 2;
$pool_statement_begin_time = date('Y.m.d', $pool_info['statement_begin_time']);
$pool_statement_end_time = date('Y.m.d', $pool_info['statement_end_time']);
//获取对接人
foreach($infolist as $k=>&$v){
$v['statement_info'] = json_decode($v['statement_info'],true);
@ -484,6 +492,7 @@ class CompanyStatementPoolController extends ThinkController
$v['is_payment'] = 1;
}
}
$is_statement = $v['st'] == 1 ? true :false;
$cline = $line+1;
if($is_export){
$v['statement_money'] = "=ROUND(";
@ -495,17 +504,9 @@ class CompanyStatementPoolController extends ThinkController
foreach($v['statement_info'] as $ke=>&$va){
$va['row'] = count($va['game_list']);
$row += count($va['game_list']);
foreach($va['game_list'] as $key=>&$val){
$line ++;
if($v['withdraw_type'] != 3) {
// if(!$val['ratio']&&!$val['increment_ratio']) {
// if(isset($val['ratio'])){
// $val['increment_ratio'] = 0;
// }else{
// $val['ratio'] = 0;
// }
// }
if (!$val['increment_ratio']) {
$val['increment_ratio'] = 0;
}
@ -513,8 +514,25 @@ class CompanyStatementPoolController extends ThinkController
if (!$val['ratio']) {
$val['ratio'] = 0;
}
//上周数据合计
if($val['statement_begin_time'] == $pool_statement_begin_time && $val['statement_end_time'] == $pool_statement_end_time){
$count['pool_week_count'] += $val['pay_amount'];
if($is_export){
$this->setWeekCount($line);
}
}
//本周未结算流水合计
if(!$is_statement){
$count['pool_lack_count'] += $val['pay_amount'];
$count['st_lack_count'] += $val['sum_money'];
if($is_export){
$this->setlackCount($line);
}
}else{
$count['st_count'] += $val['sum_money'];
}
}
if($is_export){
if($v['withdraw_type'] != 3) {
@ -525,15 +543,11 @@ class CompanyStatementPoolController extends ThinkController
$v['statement_money'] .= "S{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
// $count['sum_money'] += $val['sum_money'];
}
}
$count['week_money'] += $va['week_amount'];
$count['sum_money'] += $va['week_amount'];
}
// dump($count);
$v['row'] = $row;
@ -543,7 +557,6 @@ class CompanyStatementPoolController extends ThinkController
if($is_export){
if($v['withdraw_type'] != 3) {
// $v['statement_money'] .="P{$cline}-Q{$cline},2)";
$v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1) . ",2)";
} else {
$v['statement_money'] = substr($v['statement_money'],0,strlen($v['statement_money'])-1).",2)";
@ -551,18 +564,78 @@ class CompanyStatementPoolController extends ThinkController
}
}
if($is_export){
if($pool_info["withdraw_type"] != 3){
//上周数据合计
$count["pool_week_count"] = $this->setWeekCount($line,true);
$count["pool_lack_count"] = $this->setlackCount($line,true);
//本周暂不结算合计
$count["st_lack_count"] = '=ROUND(SUMIFS(T2:T'.$line.',Y2:Y'.$line.',"否"),2)';
//本次应支付
$count["st_count"] = '=ROUND(SUMIFS(T2:T'.$line.',Y2:Y'.$line.',"是"),2)';
}
$count["platform_amount"] = "=ROUND(SUM(K2:K".$line."),2)";
$count["week_money"] = "=ROUND(SUM(S2:S".$line."),2)";
$count["sum_money"] = "=ROUND(SUM(T2:T".$line."),2)";
}
// die();
// die();
$this->assign("data",$infolist);
$this->assign("count",$count);
$this->assign("is_export",$is_export);
$this->assign("withdraw_type",$pool_info["withdraw_type"]);
$this->display("CompanyStatementPool/viewPuPool");
}
//导出中上周结算数据计算
protected function setWeekCount($line,$return = false)
{
global $pool_week_str,$pool_week_line;
if(empty($pool_week_str)){
$pool_week_str = "=";
$pool_week_line = 0;
}
if($pool_week_str == "="){
$pool_week_str .= "SUM(K{$line}:";
}else{
if($line - $pool_week_line > 1){
//不连续
$pool_week_str .= "K{$pool_week_line})+SUM(K{$line}:";
}
}
$pool_week_line = $line;
if($return){
$data = $pool_week_str."K{$line})";
unset($pool_week_str,$pool_week_line);
return $data;
}
}
//本周不结算
protected function setlackCount($line,$return = false)
{
global $pool_lack_str,$pool_lack_line;
if(empty($pool_lack_str)){
$pool_lack_str = "=";
$pool_lack_line = 0;
}
if($pool_lack_str == "="){
$pool_lack_str .= "SUM(K{$line}:";
}else{
if($line - $pool_lack_line > 1){
//不连续
$pool_lack_str .= "K{$pool_lack_line})+SUM(K{$line}:";
}
}
$pool_lack_line = $line;
if($return){
$data = $pool_lack_str."K{$line})";
unset($pool_lack_str,$pool_lack_line);
return $data;
}
}
//改变结构
public function changeDataStruct($statement_info = [],$is_export = 0,&$week_line = 1) {

@ -153,7 +153,12 @@ class SpendController extends ThinkController
($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
$value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
$value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']];
//拆分游戏名称和设备类型
$game_arr = explode("(",rtrim($value['game_name'],")"));
$value['game_name'] = $game_arr[0];
$value['sdk_version_name'] = $game_arr[1];
}
$this->assign('showMarketAdmin', session('user_auth')['show_market_admin']);
$this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('isMarketAdmin', $isMarketAdmin);

@ -327,6 +327,7 @@ class StatementMangementController extends ThinkController
->field('r.id')
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')
->where($map)
->order("r.id desc")
->group('r.id')
->select();
@ -345,10 +346,11 @@ class StatementMangementController extends ThinkController
$list = M('reward_record', 'tab_')->alias('r')
->field('
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,r.create_time,
rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount
')
->where($map)
->order("rid desc")
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')->select();
if ($list) {
$record = [];
@ -397,7 +399,7 @@ class StatementMangementController extends ThinkController
if ($page) {
$this->assign('_page', $page);
}
ksort($record);
krsort($record);
$this->assign('list', $record);
$this->assign('promoters', array_column(M('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id'));

@ -308,28 +308,61 @@
</notempty>
</foreach>
<tr>
<td colspan=10 >合计:</td>
<td>{$count.platform_amount}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{$count.week_money}</td>
<td>{$count.sum_money}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<if condition="!$is_export">
<if condition="$withdraw_type LT 2">
<tr>
<td colspan="9" rowspan="3"></td>
<td>上周数据合计:</td>
<td>{$count.pool_week_count}</td>
<td colspan="5" rowspan="3"></td>
<td colspan="3">打款合计:</td>
<td>{$count.sum_money}</td>
<td colspan="6" rowspan="3"></td>
<if condition="!$is_export">
<td rowspan="3"></td>
</if>
</tr>
<tr>
<td>本周未结算流水合计:</td>
<td>{$count.pool_lack_count}</td>
<td colspan="3">本周暂不结算合计:</td>
<td>{$count.st_lack_count}</td>
</tr>
<tr>
<td></td>
</if>
</tr>
<td></td>
<td colspan="3">本次应支付:</td>
<td>{$count.st_count}</td>
</tr>
<else />
<tr>
<td colspan=10 >合计:</td>
<td>{$count.platform_amount}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{$count.week_money}</td>
<td>{$count.sum_money}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<if condition="!$is_export">
<td></td>
</if>
</tr>
</if>
</tbody>
</table>
</div>

@ -68,13 +68,34 @@
.layui-layer{
overflow: scroll;
}
.main-place .question_content:before{
right: 20px;
left: auto;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$_REQUEST['count_date']}游戏统计</h3>
<p class="description_text">说明:仅统计通知成功,结算给上游的是支付成功通知成功,就算给公会的是支付成功</p>
<p class="description_text">说明:游戏相关支付统计,结算给上游的是支付成功通知成功的订单,结算给公会的是支付成功的订单</p>
<div class="question" style="float: right;margin-right: 20px;">
<i class="question_mark">?</i>
<ul class="question_content" style="right: -20px;left: auto;">
<li class="question_title">数据相关说明</li>
<li class="question_list">
<span class="">上游结算:</span>
<span class="">游戏内充值合计 + 聚合万盟数据 + 聚合其他渠道数据</span>
</li>
<li class="question_list">
<span class="">下游结算:</span>
<span class="">游戏内充值合计 + 联运通知失败合计 + 聚合万盟数据 + 聚合万盟通知失败 - 下游不结算订单</span>
</li>
<li class="question_list">
<span class="">下游不结算订单:</span>
<span class="">未在此处体现,指:推广公司不推广某款游戏后,产生的该游戏的流水</span>
</li>
</ul>
</div>
</div>
<div class="cf top_nav_list">
@ -178,7 +199,7 @@
<th ><div class="tooltip"><span style="color: red">联运通知失败合计</span><span class="tooltiptext"><span style="margin-left: -10px">联运所有通知失败的合计金额</span></span></div></th>
<th ><div class="tooltip">聚合万盟数据<span class="tooltiptext"><span style="margin-left: -10px">聚合平台万盟渠道支付成功且通知成功的金额</span></span></div></th>
<th ><div class="tooltip"><span style="color: red">聚合万盟通知失败</span><span class="tooltiptext"><span style="margin-left: -10px">聚合平台万盟渠道通知失败的订单合计金额</span></span></div></th>
<th ><div class="tooltip">聚合平台测试订单<span class="tooltiptext"><span style="margin-left: -10px">聚合平台测试订单</span></span></div></th>
<th ><div class="tooltip"><span style="color: red">聚合平台测试订单</span><span class="tooltiptext"><span style="margin-left: -10px">聚合平台测试订单</span></span></div></th>
<th ><div class="tooltip">聚合其他渠道数据<span class="tooltiptext"><span style="margin-left: -10px">聚合平台其他渠道(不含万盟)支付成功通知成功订单合计</span></span></div></th>
<th ><div class="tooltip"><span style="color: red">聚合其他渠道通知失败订单</span><span class="tooltiptext"><span style="margin-left: -10px">聚合平台其他渠道(不含万盟)<br>通知失败的订单合计金额</span></span></div></th>
<th >操作</th>
@ -243,7 +264,7 @@
'sdk_type'=>$_GET['sdk_type'],
'game_id'=>$data['game_id'],
'platform_type'=>2,
])}">{$data.test_amount}</a></span>
])}" style="color:red;">{$data.test_amount}</a></span>
</td>
<td ><a href="{:U('Finance/aggDetail', [
'timestart'=>$_GET['timestart'],

@ -231,6 +231,7 @@
<th>支付时间</th>
<th>玩家账号</th>
<th>游戏名称</th>
<th>设备类型</th>
<?php if($showPromote == 1):?>
<th>所属推广员</th>
<?php endif;?>
@ -293,6 +294,7 @@
</if>
<gt name="data.small_id" value="0"><neq name="data.small_id" value="$data.user_id">{$data.small_account}</neq></gt></td>
<td>{$data.game_name}</td>
<td>{$data.sdk_version_name}</td>
<?php if($showPromote == 1):?>
<td>
<eq name="data.promote_id" value="-1">C('OFFICIEL_CHANNEL')<else/>
@ -375,7 +377,7 @@
<if condition="$rule_count_check">
<tr class="data_summary">
<td colspan="2">汇总</td>
<td colspan="20">
<td colspan="21">
当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))}
<!-- 今日充值:{$ttotal}-->
<!-- 昨日充值:{$ytotal}-->

@ -448,23 +448,23 @@
var flag = false;
// 判断相反的是否已经存在该公司节点
$('.reward-data-info,.punish-data-info').each(function(){
var node_info = $(this).find('.info').val();
if (node_info) {
var otherData = JSON.parse(node_info);
// console.log(otherData)
// console.log((data['company_id'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) );
// console.log(data['company_type'] == otherData['company_type'] );
// 判断对立面是否有相同的公司或者部门
if ((data['company_type'] == otherData['company_type'])
&& (data['company_id'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) ) {
//console.log('已有相此公司的奖罚,请检查')
layer.closeAll();
layer.msg('已有此公司的奖罚,请检查');
flag = true;
}
}
});
// $('.reward-data-info,.punish-data-info').each(function(){
// var node_info = $(this).find('.info').val();
// if (node_info) {
// var otherData = JSON.parse(node_info);
// // console.log(otherData)
// // console.log((data['company_id'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) );
// // console.log(data['company_type'] == otherData['company_type'] );
// // 判断对立面是否有相同的公司或者部门
// if ((data['company_type'] == otherData['company_type'])
// && (data['company_id'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) ) {
// //console.log('已有相此公司的奖罚,请检查')
// layer.closeAll();
// layer.msg('已有此公司的奖罚,请检查');
// flag = true;
// }
// }
// });
if (flag) {
return false;

Loading…
Cancel
Save