Merge branch 'feature/group_type' of 47.111.118.107:wmtx/platform into dev

master
chenzhi 5 years ago
commit dfdad21d8e

@ -52,7 +52,7 @@ class AdminController extends Controller {
if(!in_array(CONTROLLER_NAME, $access_controller)){//ajax放行
//检测访问权限
$rule = strtolower(MODULE_NAME.'/'.CONTROLLER_NAME.'/'.ACTION_NAME);
if($rule == "admin/statistics/overview"){//第一级菜单单独判断
if($rule == "admin/statistics/overview"||$rule == "admin/spend/lists"){//第一级菜单单独判断
$this->strictCheckRule($rule);

@ -45,7 +45,6 @@ class FinancePromoteController extends AdminController
$senddata[$v['p_id']] = $v;
}
// dump($cash);die();
//内冲
$inside = self::getJoinPromoteData([],$istimeselect,"promote_coin");
foreach($inside as $k=>$v){
@ -109,7 +108,6 @@ class FinancePromoteController extends AdminController
"bind_coin_count"=>0,
"inside_cash_count"=>0,
);
// dump($senddata);die();
foreach($senddata as $k=>$v){
if ($v['company_belong']==1) {
$v['company_belong']='外团';
@ -152,7 +150,6 @@ class FinancePromoteController extends AdminController
$outBelong = 0;
$insideBelong = 0;
// dump($data);die();
foreach ($data as $key => $value) {
if ($value['company_belong']=='外团') {
@ -174,7 +171,6 @@ class FinancePromoteController extends AdminController
$this->assign('all_count', $count);
$this->meta_title = '公会统计';
$this->display();
# code...
}
private function getJoinPromoteData($map,$istimeselect,$type="spend")
{
@ -264,12 +260,17 @@ class FinancePromoteController extends AdminController
}
$senddata = [];
//获取各会长的现金充值
$cash = self::promoteUserData([],$istimeselect);
$map=[];
$title = '';
self::setPromoteMap($map,"s.promote_id",$title);
$title .= "渠道统计";
$this->assign('title', $title);
$cash = self::promoteUserData($map,$istimeselect);
foreach($cash as $k=>$v){
$senddata[$v['promote_id']] = $v;
}
$inside = self::promoteUserData([],$istimeselect,"promote_coin");
$inside = self::promoteUserData($map,$istimeselect,"promote_coin");
foreach($inside as $k=>$v){
if(array_key_exists($v['promote_id'],$senddata)){
@ -280,19 +281,11 @@ class FinancePromoteController extends AdminController
$senddata[$v['promote_id']] = $v;
};
}
if(!empty($senddata)){
if(array_key_exists(0,$senddata) || $_REQUEST['promote_id']==0){
$pmap['status']=1;
if($istimeselect){
$pmap['create_time'] = $istimeselect;
}
$admininside = M("provide_user p","tab_")->field("sum(amount) amount")->where($pmap)->find();
if($admininside['amount'] >0){
$senddata[0]['inside_cash_count']= $admininside['amount'];
}
}
if(array_key_exists(0,$senddata)){
unset($senddata[0]);
}
$count = count($senddata);
if ($_REQUEST['data_order'] != '') {
$data_order = reset(explode(',', $_REQUEST['data_order']));
@ -354,17 +347,6 @@ class FinancePromoteController extends AdminController
}
private function promoteUserData($map,$istimeselect,$type="spend")
{
// setPowerPromoteIds($map,"s.promote_id");
if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] == 0) {
$map['s.promote_id'] = 0;
} else {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
if ($promoter_ids) {
$map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}
}
}
if (isset($_REQUEST['company_id'])) {
$map['promote.company_id'] = $_REQUEST['company_id'];
}
@ -376,6 +358,7 @@ class FinancePromoteController extends AdminController
$map['s.pay_time']=$istimeselect;
}
$map['s.pay_status']=1;
// dd($map);
$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 = -1 THEN pay_amount ELSE 0 END) as bind_coin_count,
@ -404,7 +387,6 @@ class FinancePromoteController extends AdminController
->group('promote_id')
->select();
}
# code...
}
/**
*游戏统计
@ -413,7 +395,6 @@ class FinancePromoteController extends AdminController
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row = $_REQUEST['row'] ?? 10;
$map = [];
if (isset($_REQUEST['game_name']) || isset($_REQUEST['game_type'])) {
$map["s.game_id"] = array("in",implode(',', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')) );
@ -429,23 +410,13 @@ class FinancePromoteController extends AdminController
} elseif (isset($_REQUEST['time_end'])) {
$map['s.pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
//判断是否有推广员
$level = 1;
if ($_REQUEST['promote_id'] != '') {
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['s.promote_id'] = $_REQUEST['promote_id'];
} else {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
if ($promoter_ids) {
$map['s.promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}
}
}
$this->assign('promote_level', $level);
//获取推广员
$title = '';
self::setPromoteMap($map,"s.promote_id",$title);
$title .= "游戏统计";
$this->assign('title', $title);
//游戏统计列表
$data =self::gameStatisticsData($map, $row, $p);
if(isset($_REQUEST['export'])){
@ -462,7 +433,7 @@ class FinancePromoteController extends AdminController
if(!$value['game_name']) $value['game_name'] = "无";
}
if (isset($_REQUEST['export'])) {
data2csv($data,'游戏统计', array(
data2csv($data,$title, array(
"partner_name"=>"合作公司",
"game_name"=>"游戏",
"cash_count"=>"游戏现金金额",
@ -530,33 +501,16 @@ class FinancePromoteController extends AdminController
} elseif (isset($_REQUEST['time_end'])) {
$map['pay_time'] = ['LT', strtotime($_REQUEST['time_end']) + 86399];
}
//判断是否有推广员
if ($_REQUEST['promote_id'] != '') {
if ($_REQUEST['promote_id'] == 0 || $_REQUEST['promote_type'] == 2) {
$map['promote_id'] = $_REQUEST['promote_id'];
} else {
$promoter_ids = D("Promote")->where("chain like '%/{$_REQUEST['promote_id']}/%' or id={$_REQUEST['promote_id']}")->field('id')->select();
if ($promoter_ids) {
$map['promote_id'] = ['in', implode(',', array_column($promoter_ids, 'id'))];
}
}
}
if (!empty(I("root_id"))) {
$root_id = I("root_id");
$promote_id = $this->getPromoteList($root_id);
array_push($promote_id, $root_id);
}
if ($_REQUEST['root_id']=='0') {
$map['promote_id'] = $_REQUEST['root_id'];
//获取推广员
$title = '';
self::setPromoteMap($map,"promote_id",$title);
if (isset($_REQUEST['game_name'])){
$title .= ($_REQUEST['game_name']."-");
}
$title .= "游戏订单查看";
$this->assign('title', $title);
$promote_id = implode(',',$promote_id);
if ($promote_id) {
$map['promote_id'] = ['in',$promote_id];
}
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
@ -587,7 +541,7 @@ class FinancePromoteController extends AdminController
$data[$key]['pay_way'] = getPayType($value['pay_way']);
}
if (isset($_REQUEST['export'])) {
data2csv($data,'游戏订单查看', array(
data2csv($data,$title, array(
"pay_order_number"=>"支付订单号",
"pay_time"=>"充值时间",
"user_account"=>"玩家账号",
@ -925,5 +879,68 @@ class FinancePromoteController extends AdminController
$this->display();
}
private function setPromoteMap(&$map,$field,&$title)
{
//公司判断
$pmap = false; //非特意推广员检索
$gfflg = true; //是否有官方
if (isset($_REQUEST['company_id'])) {
$pmap['company_id'] = $_REQUEST['company_id'];
//获取公司名称
if($pmap['company_id'] == 0){
$title .= "万盟天下科技-";
}else{
$gfflg = false;
$title .= (M('promote_company',"tab_")->field("company_name")->where("id = '{$pmap['company_id']}'")->find()['company_name'] . "-");
}
}
if (isset($_REQUEST['company_belong'])) {
$pmap['company_belong'] = $_REQUEST['company_belong'];
if($_REQUEST['company_belong'] == 0){
$title .= "内团-";
}else{
$gfflg = false;
$title .= "外团-";
}
}
if (isset($_REQUEST['promote_id'])) {
$pmap = false; //取消非特异推广员检索
$title .= (get_promote_name($_REQUEST['promote_id'])."-");
if ($_REQUEST['promote_id'] != 0){
$gfflg = false;
}
}
if($pmap){
$promoter_ids = D("Promote")->where($pmap)->field('id')->select();
if ($promoter_ids) {
if($gfflg){
$t_in = "0,".implode(',', array_column($promoter_ids, 'id'));
}else{
$t_in = implode(',', array_column($promoter_ids, 'id'));
}
$map[$field] = ['in',$t_in];
}
}
//判断是否有推广员
$level = 1;
if ($_REQUEST['promote_id'] != '') {
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'];
} else {
$promoter_ids = D("Promote")->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'))];
}
}
}
// dd($map);
$_POST['promote_level'] = $level;
}
}

@ -72,10 +72,7 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">
<if condition="isset($_GET['promote_id'])">
[{:get_promote_name(I('promote_id'))}]
</if>
游戏统计
{$title}
</h3>
<p class="description_text">
<if condition="isset($_GET['promote_id'])">
@ -132,6 +129,8 @@
<input type="hidden" name="from" value="{$_GET['from']}"/>
<input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/>
<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_belong" value="{$_GET['company_belong']}"/>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('FinancePromote/gameStatistics','model='.$model['name'].'&row='.I('row'),false)}"

@ -31,10 +31,8 @@
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">
<if condition="isset($_GET['promote_id'])">
[{:get_promote_name(I('promote_id'))}]
</if>
{$_REQUEST['game_name']}游戏订单查看</h3>
{$title}</h3>
<p class="description_text">
<if condition="isset($_GET['promote_id'])">
<if condition="$_GET['promote_type'] eq 1">
@ -98,8 +96,9 @@
</div>
<input type="hidden" name="promote_type" value="{$_GET['promote_type']}"/>
<!-- <input type="hidden" name="promote_id" value="{$_GET['promote_id']}"/> -->
<!-- <input type="hidden" name="game_name" value="{$_GET['game_name']}"/> -->
<input type="hidden" name="company_id" value="{$_GET['company_id']}"/>
<input type="hidden" name="company_belong" value="{$_GET['company_belong']}"/>
<div class="input-list">
<input type="text" name="pay_order_number" placeholder="请输入支付订单号" class="" value="{:I('pay_order_number')}" style="width: 180px"/>&nbsp;

@ -77,8 +77,8 @@
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">渠道统计</h3>
<p class="description_text">说明:渠道相关统计</p>
<h3 class="page_title">{$title}</h3>
<p class="description_text">说明:渠道相关统计/不含官方渠道</p>
</div>
<style>
@ -136,6 +136,8 @@
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<input type="hidden" name="company_belong" value="{$_GET['company_belong']}"/>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('FinancePromote/promoteUser','model='.$model['name'] .'&row='.I('row'),false)}">

Loading…
Cancel
Save