Merge branch 'release' of 47.111.118.107:wmtx/platform into release

master
yulingwei 5 years ago
commit 5468239cf3

@ -2173,4 +2173,29 @@ function a_array_unique($array){
return $out; return $out;
} }
/**
* 获取团体归属类型
* @author chenzhi 20200219
* $id 不传返回所有类型列表
* 传入ID 返回对应的团体类型
*/
function getCompanyBlong($id = -1)
{
$data = array(
["id"=>0,'name'=>"内团"],
["id"=>1,'name'=>"外团"],
["id"=>2,'name'=>"外团-分发"],
["id"=>3,'name'=>"无"]
);
if($id > -1){
foreach($data as $k=>$v){
if($v['id'] == $id){
return $v['name'];
break;
}
}
}else{
return $data;
}
}
?> ?>

@ -110,11 +110,7 @@ class FinancePromoteController extends AdminController
"inside_cash_count"=>0, "inside_cash_count"=>0,
); );
foreach($senddata as $k=>$v){ foreach($senddata as $k=>$v){
if ($v['company_belong']==1) { $v['company_belong'] = getCompanyBlong($v['company_belong']);
$v['company_belong']='外团';
} else {
$v['company_belong']='内团';
}
if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME; if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
if(empty($v['p_id'])) $v['p_id']= "0"; if(empty($v['p_id'])) $v['p_id']= "0";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
@ -209,7 +205,7 @@ class FinancePromoteController extends AdminController
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id, IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,promote.company_belong"; IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong";
return M() return M()
->table("tab_spend s") ->table("tab_spend s")
->field($field) ->field($field)
@ -226,7 +222,7 @@ class FinancePromoteController extends AdminController
$map['s.source_id']=0; $map['s.source_id']=0;
$field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='', $field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,IFNULL(if(substring_index(substring_index(`chain`,'/',2),'/',-1)='',
s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id, s.promote_id,substring_index(substring_index(`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_id,0) company_id,company_name,promote.company_belong"; IFNULL(company_id,0) company_id,company_name,IFNULL(promote.company_belong,0) company_belong";
return M("promote_coin s","tab_") return M("promote_coin s","tab_")
->field($field) ->field($field)
->where($map) ->where($map)
@ -308,7 +304,7 @@ class FinancePromoteController extends AdminController
); );
foreach($senddata as $k=>$v){ foreach($senddata as $k=>$v){
$v['company_belong']?$v['company_belong']='外团':$v['company_belong']='内团'; $v['company_belong'] = getCompanyBlong($v['company_belong']);
if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME; if(empty($v['company_name'])) $v['company_name']= $this->COMPANY_NAME;
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道"; if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0; if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
@ -363,7 +359,7 @@ class FinancePromoteController extends AdminController
$field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count, $field= "SUM(CASE WHEN pay_way > 0 THEN pay_amount ELSE 0 END) as cash_count,
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong"; IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong";
return M() return M()
->table("tab_spend s") ->table("tab_spend s")
->field($field) ->field($field)
@ -379,7 +375,7 @@ class FinancePromoteController extends AdminController
$map['s.status']=1; $map['s.status']=1;
$map['s.source_id']=0; $map['s.source_id']=0;
$field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount, $field= "SUM(CASE WHEN s.type = 1 THEN num ELSE 0 END) as pay_amount,SUM(CASE WHEN s.type = 2 THEN num ELSE 0 END) as back_amount,
IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,promote.company_belong"; IFNULL(company_id,0) company_id,company_name,promote_id,promote.account promote_account,IFNULL(promote.company_belong,0) company_belong";
return M("promote_coin s","tab_") return M("promote_coin s","tab_")
->field($field) ->field($field)
->where($map) ->where($map)
@ -414,7 +410,8 @@ class FinancePromoteController extends AdminController
//获取推广员 //获取推广员
$title = ''; $title = '';
self::setPromoteMap($map,"s.promote_id",$title); self::setPromoteMap($map,"s.promote_id",$title,false);
// dd($map);
$title .= "游戏统计"; $title .= "游戏统计";
$this->assign('title', $title); $this->assign('title', $title);
@ -430,14 +427,14 @@ class FinancePromoteController extends AdminController
$value['balance_coin_count']?:0; $value['balance_coin_count']?:0;
$value['inside_cash_count']?:0; $value['inside_cash_count']?:0;
$value['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count']; $value['all_cash_count'] = $value['cash_count'] + $value['balance_coin_count'] + $value['inside_cash_count'];
if(!$value['partner_name']) $value['partner_name'] = "无"; $value['company_belong'] =getCompanyBlong($value['company_belong']);
if(!$value['game_name']) $value['game_name'] = "无"; if(!$value['game_name']) $value['game_name'] = "无";
} }
if (isset($_REQUEST['export'])) { if (isset($_REQUEST['export'])) {
data2csv($data,$title, array( data2csv($data,$title, array(
"company_name"=>"推广公司", "company_name"=>"推广公司",
"account"=>"会长账号", "account"=>"会长账号",
"partner_name"=>"合作公司", "company_belong"=>"团体类型",
"game_name"=>"游戏", "game_name"=>"游戏",
"cash_count"=>"游戏现金金额", "cash_count"=>"游戏现金金额",
"balance_coin_count"=>"平台币直充支出", "balance_coin_count"=>"平台币直充支出",
@ -590,7 +587,7 @@ class FinancePromoteController extends AdminController
SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count, SUM(CASE WHEN pay_way = 0 THEN pay_amount ELSE 0 END) as balance_coin_count,
SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count, SUM(CASE WHEN pay_way = -1 THEN pay_amount ELSE 0 END) as inside_cash_count,
IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id, IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id,
IFNULL(company_name,'{$this->COMPANY_NAME}') company_name") IFNULL(company_name,'{$this->COMPANY_NAME}') company_name,IFNULL(promote.company_belong,0) company_belong")
->join('LEFT JOIN tab_game as g ON s.game_id=g.id') ->join('LEFT JOIN tab_game as g ON s.game_id=g.id')
->join("tab_promote promote ON s.promote_id = promote.id","left") ->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("tab_promote_company company ON promote.company_id = company.id","left") ->join("tab_promote_company company ON promote.company_id = company.id","left")
@ -877,7 +874,7 @@ class FinancePromoteController extends AdminController
$this->display(); $this->display();
} }
private function setPromoteMap(&$map,$field,&$title) private function setPromoteMap(&$map,$field,&$title,$ptype = true)
{ {
//公司判断 //公司判断
$pmap = false; //非特意推广员检索 $pmap = false; //非特意推广员检索
@ -895,23 +892,24 @@ class FinancePromoteController extends AdminController
} }
if (isset($_REQUEST['company_belong'])) { if (isset($_REQUEST['company_belong'])) {
$pmap['company_belong'] = $_REQUEST['company_belong']; $pmap['company_belong'] = $_REQUEST['company_belong'];
if($_REQUEST['company_belong'] == 0){ $title .= (getCompanyBlong($_REQUEST['company_belong'])."-");
$title .= "内团-";
}else{
$gfflg = false;
$title .= "外团-";
}
} }
if (isset($_REQUEST['promote_id'])) { if (isset($_REQUEST['promote_id'])) {
$pmap = false; //取消非特异推广员检索 if($ptype){
$pmap = false;//取消非特异推广员检索
}else{
$pmap['id'] = $_REQUEST['promote_id'];
}
$title .= (get_promote_name($_REQUEST['promote_id'])."-"); $title .= (get_promote_name($_REQUEST['promote_id'])."-");
if ($_REQUEST['promote_id'] != 0){ if ($_REQUEST['promote_id'] != 0){
$gfflg = false; $gfflg = false;
} }
} }
if($pmap){ if($pmap){
$promoter_ids = D("Promote")->where($pmap)->field('id')->select(); $promoter_ids = D("Promote")->where($pmap)->field('id')->select();
if ($promoter_ids) { if ($promoter_ids) {
if($gfflg){ if($gfflg){
$t_in = "0,".implode(',', array_column($promoter_ids, 'id')); $t_in = "0,".implode(',', array_column($promoter_ids, 'id'));
@ -923,22 +921,30 @@ class FinancePromoteController extends AdminController
$map[$field] = ['in',"-1"]; $map[$field] = ['in',"-1"];
} }
} }
//判断是否有推广员 // if($ptype){
$level = 1; //判断是否有推广员
if ($_REQUEST['promote_id'] != '') { $level = 1;
if ($_REQUEST['promote_id'] != 0){ if ($_REQUEST['promote_id'] != '') {
$level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level']; if ($_REQUEST['promote_id'] != 0){
} $level = M('promote', 'tab_')->field('level')->where(array('id' => $_REQUEST['promote_id']))->find()['level'];
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) { }
$map[$field] = $_REQUEST['promote_id']; if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
} else { $map[$field] = $_REQUEST['promote_id'];
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select(); } else {
if ($promoter_ids) { if ($ptype) {
$map[$field] = ['in', implode(',', array_column($promoter_ids, 'id'))]; $promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
}else{
unset($pmap['id']);
$promoter_ids = D("Promote")->where($pmap)->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
}
if ($promoter_ids) {
$map[$field] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}
} }
} }
} $_POST['promote_level'] = $level;
$_POST['promote_level'] = $level; // }
} }
} }

@ -1653,7 +1653,12 @@ class QueryController extends ThinkController
$data[$key]['highquality'] = number_format(($value['pay_amount'] - $initNum - $data[$key]['upstream']-$data[$key]['downstream']) * (1-0.0672),2,'.',''); $data[$key]['highquality'] = number_format(($value['pay_amount'] - $initNum - $data[$key]['upstream']-$data[$key]['downstream']) * (1-0.0672),2,'.','');
$data[$key]['company_belong'] = $data[$key]['company_belong']?'外团':'内团'; if (!$data[$key]['company_belong']) {
$data[$key]['company_belong'] = getCompanyBlong(0);
} else {
$data[$key]['company_belong'] = getCompanyBlong($data[$key]['company_belong']);
}
$data[$key]['company_relation'] = $data[$key]['company_relation']?'只维护':'自主开发及维护'; $data[$key]['company_relation'] = $data[$key]['company_relation']?'只维护':'自主开发及维护';
} }

@ -112,13 +112,21 @@
</select> </select>
</div> </div>
<div class="input-list input-list-server search_label_rehab"> <!-- <div class="input-list input-list-server search_label_rehab">
<select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;"> <select id="partner_id" name="partner_id" class="select_gallery" style="width:120px;">
<option value="">请选择合作公司</option> <option value="">请选择合作公司</option>
<volist name=":getPartner()" id="vo"> <volist name=":getPartner()" id="vo">
<option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option> <option partner-id="{$vo.id}" value="{$vo.id}" <if condition="$vo.id eq $_GET['partner_id']">selected=selected</if>>{$vo.partner}</option>
</volist> </volist>
</select> </select>
</div> -->
<div class="input-list input-list-server search_label_rehab">
<select id="company_belong" name="company_belong" class="select_gallery" style="width:120px;">
<option value="">请选择团体类型</option>
<volist name=":getCompanyBlong()" id="vo">
<option value="{$vo.id}" <php> if($_GET['company_belong'] !='' && $vo['id'] == $_GET['company_belong'])echo selected;</php>>{$vo.name}</option>
</volist>
</select>
</div> </div>
<div class="input-list input-list-game search_label_rehab"> <div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" > <select id="game_name" name="game_name" class="select_gallery" >
@ -147,7 +155,7 @@
<!-- <input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/> --> <!-- <input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/> -->
<input type="hidden" name="promote_type" value="{$_GET['promote_type']}"/> <input type="hidden" name="promote_type" value="{$_GET['promote_type']}"/>
<!-- <input type="hidden" name="company_id" value="{$_GET['company_id']}"/> --> <!-- <input type="hidden" name="company_id" value="{$_GET['company_id']}"/> -->
<input type="hidden" name="company_belong" value="{$_GET['company_belong']}"/> <!-- <input type="hidden" name="company_belong" value="{$_GET['company_belong']}"/> -->
<div class="input-list"> <div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('FinancePromote/gameStatistics','model='.$model['name'].'&row='.I('row'),false)}" <a class="sch-btn" href="javascript:;" id="search" url="{:U('FinancePromote/gameStatistics','model='.$model['name'].'&row='.I('row'),false)}"
@ -169,7 +177,7 @@
<tr> <tr>
<th>推广公司</th> <th>推广公司</th>
<th>会长账号</th> <th>会长账号</th>
<th>合作公司</th> <th>团体类型</th>
<th >游戏</th> <th >游戏</th>
@ -201,7 +209,7 @@
<tr> <tr>
<td >{$data.company_name}</td> <td >{$data.company_name}</td>
<td >{$data.account}</td> <td >{$data.account}</td>
<td >{$data.partner_name}</td> <td >{$data.company_belong}</td>
<td >{$data.game_name}</td> <td >{$data.game_name}</td>
<td >{$data.cash_count}</td> <td >{$data.cash_count}</td>
<td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_id'=>$data['p_id'],'game_id'=>$data['game_id'],p=>1,row=>10]))}">{$data.balance_coin_count}</td> <td class="coin-detail" data-pay_type="0" style="color: #0066cc;cursor: pointer" data-url="{:U('FinancePromote/gameCoinDetail',array_merge(I('get.'),['pay_way'=>0,'promote_id'=>$data['p_id'],'game_id'=>$data['game_id'],p=>1,row=>10]))}">{$data.balance_coin_count}</td>

@ -110,11 +110,12 @@
</select> </select>
</div> </div>
<div class="input-list input-list-game search_label_rehab"> <div class="input-list input-list-server search_label_rehab">
<select id="company_belong" name="company_belong" class="select_gallery"> <select id="company_belong" name="company_belong" class="select_gallery" style="width:120px;">
<option value="">请选择团体类型</option> <option value="">请选择团体类型</option>
<option value="0" <?php echo I('company_belong') === 0 ? "selected" : ''?>>内团</option> <volist name=":getCompanyBlong()" id="vo">
<option value="1" <?php echo I('company_belong') == 1 ? "selected" : ''?>>外团</option> <option value="{$vo.id}" <php> if($_GET['company_belong'] !='' && $vo['id'] == $_GET['company_belong'])echo selected;</php>>{$vo.name}</option>
</volist>
</select> </select>
</div> </div>

@ -125,16 +125,17 @@ class FinanceController extends BaseController
->where($map) ->where($map)
->find(); ->find();
foreach ($income as &$value) {
$value = bcdiv($value, 100, 2);
}
$withdrawMap['promote_id'] = $this->loginPromote['id']; $withdrawMap['promote_id'] = $this->loginPromote['id'];
$withdrawMap['status'] = ['neq', 2]; $withdrawMap['status'] = ['neq', 2];
//已提现总额 //已提现总额
$income['withdrawn_amount'] = M('withdraw', 'tab_')->field('sum(sum_money) as withdrawn_amount')->where($withdrawMap)->find()['withdrawn_amount']; $income['withdrawn_amount'] = M('withdraw', 'tab_')->field('sum(sum_money) as withdrawn_amount')->where($withdrawMap)->find()['withdrawn_amount'];
foreach ($income as &$value) {
$value = bcdiv($value, 100, 2);
}
$withdrawMap['status'] = ['not in', [-2, -1]];
$withdrawns = M('withdraw', 'tab_')->field('settlement_begin_time, settlement_end_time') $withdrawns = M('withdraw', 'tab_')->field('settlement_begin_time, settlement_end_time')
->where($withdrawMap) ->where($withdrawMap)
->select(); ->select();
@ -656,7 +657,7 @@ class FinanceController extends BaseController
//是否是会长 //是否是会长
$this->purview(); $this->purview();
//验证安全密码 //验证安全密码
$metaTitle = '结算单'; $metaTitle = '公会对账';
$modelList = ['财务管理', '提现记录', $metaTitle]; $modelList = ['财务管理', '提现记录', $metaTitle];
$this->verifyPasswordView($modelList); $this->verifyPasswordView($modelList);
@ -674,7 +675,7 @@ class FinanceController extends BaseController
$statementMap['statement_type'] = 1; $statementMap['statement_type'] = 1;
$statement = M('statement', 'tab_')->where($statementMap)->find(); $statement = M('statement', 'tab_')->where($statementMap)->find();
if (empty($statement)) { if (empty($statement)) {
$this->error('未生成下游结算单'); $this->error('未生成下游对账单');
} }
$statement['first_party_info'] = json_decode($statement['first_party_info'], 1);//甲方 $statement['first_party_info'] = json_decode($statement['first_party_info'], 1);//甲方

@ -2326,7 +2326,7 @@ class QueryController extends BaseController
$promoteRepository = new PromoteRepository(); $promoteRepository = new PromoteRepository();
$createRoleCountList = $promoteRepository->getCreateRoleCountByIds($ids, $params); $createRoleCountList = $promoteRepository->getCreateRoleCountByIds($ids, $params);
if (I('p', 1) == 1) { if (I('p', 1) == 1 && empty($promoteId)) {
$selfParams = $params; $selfParams = $params;
$selfParams['isContainSubs'] = false; $selfParams['isContainSubs'] = false;
$selfCreateRoleCountList = $promoteRepository->getCreateRoleCountByIds([$parent['id']], $selfParams); $selfCreateRoleCountList = $promoteRepository->getCreateRoleCountByIds([$parent['id']], $selfParams);

@ -201,7 +201,7 @@
<elseif condition="$vo['status'] eq -1"/> <elseif condition="$vo['status'] eq -1"/>
<!-- <span class="renew-review" data-id="{$vo['id']}" style="color: #0bb20c;cursor: pointer;">重新审核</span>--> <!-- <span class="renew-review" data-id="{$vo['id']}" style="color: #0bb20c;cursor: pointer;">重新审核</span>-->
</if> </if>
<a href="{:U('settlementOrder', array('id'=>$vo['id']))}">结算单</a> <a href="{:U('settlementOrder', array('id'=>$vo['id']))}">公会对账</a>
<if condition="$vo['status'] eq -1 or $vo['status'] eq 0"> <if condition="$vo['status'] eq -1 or $vo['status'] eq 0">
<!-- <span class="cancel-withdraw" data-id="{$vo['id']}" style="color: red;cursor: pointer;">撤销提现</span>--> <!-- <span class="cancel-withdraw" data-id="{$vo['id']}" style="color: red;cursor: pointer;">撤销提现</span>-->
</if> </if>

Loading…
Cancel
Save