master
ELF 4 years ago
parent c42a123ad7
commit 0169d8a2db

@ -8,6 +8,7 @@ use Base\Repository\PromoteRepository;
use Base\Repository\SpendRepository; use Base\Repository\SpendRepository;
use Base\Repository\UserRepository; use Base\Repository\UserRepository;
use Base\Service\PromoteService; use Base\Service\PromoteService;
use Base\Service\PromoteGradeService;
use Base\Facade\Request; use Base\Facade\Request;
use Base\Service\ApplyService; use Base\Service\ApplyService;
use Base\Service\PromoteCoinRecordService; use Base\Service\PromoteCoinRecordService;
@ -1888,6 +1889,66 @@ class DownloadController extends BaseController {
$this->success('添加下载成功',U('listsIndex')); $this->success('添加下载成功',U('listsIndex'));
} }
public function promote_grade_export()
{
$month = I('month', date('Y-m'));
$loginPromote = $this->getLoginPromote();
$promoteGradeService = new PromoteGradeService();
$setting = $promoteGradeService->getCurrentSetting($loginPromote);
if (is_null($setting)) {
return $this->error('未设置评级规则');
}
$parentId = I('parent_id', 0);
$promoteId = I('promote_id', 0);
$searchLevel = 0;
$searchLevelName = '';
$currentDisplay = '';
$prevParentId = 0;
$promoteService = new PromoteService();
$parent = null;
if ($parentId > 0) {
$parent = M('promote', 'tab_')->where(['id' => $parentId])->find();
$currentDisplay = $promoteService->getLevelName($parent['level']) . '推广';
$prevParentId = $parent['parent_id'] == $loginPromote['parent_id'] ? 0 : $parent['parent_id'];
} else {
$parent = $loginPromote;
$currentDisplay = '自己';
}
// $subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'group_remark'])->where(['parent_id' => $parent['id']])->select();
$map = ['parent_id' => $parent['id']];
if ($promoteId > 0) {
$map['id'] = $promoteId;
}
$promotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map)->select();
array_unshift($promotes, $parent);
$conditions = json_encode(['promotes' => $promotes, 'setting' => $setting, 'month' => $month], true);
$addtime = time();
$data1 = [
'logid' => 'pg_'.time(),
'promote_id' => PID,
'type' => '/Home/PromoteGrade/index',
'dataname' => '团队评级',
'status' => 0,
'addtime' => $addtime,
'begintime' => 0,
'content' => '',
'conditions' => $conditions
];
$res = M('downloadlog','tab_')->add($data1);
if (!$res) {
$this->error('添加下载失败');
}
$this->success('添加下载成功', U('listsIndex'));
}
//玩家角色 //玩家角色
public function userRoles_data_export() { public function userRoles_data_export() {
$gameId = I('relation_game_id', 0); $gameId = I('relation_game_id', 0);
@ -2158,6 +2219,9 @@ class DownloadController extends BaseController {
case "推广员业绩": case "推广员业绩":
$this->achievementExcelInfo($id,$map); $this->achievementExcelInfo($id,$map);
break; break;
case "团队评级":
$this->promoteGradeExcelInfo($id,$map);
break;
case "渠道管理": case "渠道管理":
$this->childrenExcelInfo($id,$map); $this->childrenExcelInfo($id,$map);
break; break;
@ -3973,6 +4037,35 @@ public function iosDetailExcelInfo($id,$map) {
} }
public function promoteGradeExcelInfo($tid, $map)
{
$xlsName = "团队评级";
$xlsCell = array(
array('account','账号'),
array('real_name','姓名'),
array('promote_group', '部门/小组'),
array('grade_name','等级'),
array('value','系数值'),
array('num','当月玩家达标个数'),
array('amount','当月注册充值总额'),
);
recordPromoteLogs('评级管理', '团队评级导出');
$map = json_decode(json_encode($map), true);
$promoteGradeService = new PromoteGradeService();
$records = $promoteGradeService->searchGradeByPromotes($map['promotes'], [
'month' => $map['month'],
], $map['setting']);
$xlsData = [];
foreach ($records as $key => $value) {
$xlsData[] = $value;
}
$this->exportExcel($xlsName, $xlsCell, $xlsData, $tid);
}
public function achievementExcelInfo($tid, $map) { public function achievementExcelInfo($tid, $map) {
$xlsName = "推广员业绩"; $xlsName = "推广员业绩";
$xlsCell = array( $xlsCell = array(

@ -67,7 +67,7 @@ class PromoteGradeController extends BaseController
$this->assign('prevParentId', $prevParentId); $this->assign('prevParentId', $prevParentId);
$this->assign('searchLevelName', $searchLevelName); $this->assign('searchLevelName', $searchLevelName);
$this->assign('subPromotes', $subPromotes); $this->assign('subPromotes', $subPromotes);
$this->assign('parentId', $parentId);
$this->assign('records', $records); $this->assign('records', $records);
$this->assign('pagination', $pagination); $this->assign('pagination', $pagination);
$this->display(); $this->display();

@ -93,7 +93,7 @@
</div> </div>
<div class="pagenation clearfix"> <div class="pagenation clearfix">
<?php if ($loginer['level'] !== 4) :?> <?php if ($loginer['level'] !== 4) :?>
<a id="sch-btn" href="{:U('download/achievement_data_export',array_merge(['parent_id'=>$parentid,'time'=>$time],I('post.')))}" class="ajax-get">导出</a> <a id="sch-btn" href="{:U('download/promote_grade_export',array_merge(['parent_id'=>$parentId,'month'=>$month],I('post.')))}" class="ajax-get">导出</a>
<?php endif ;?> <?php endif ;?>
{$pagination} {$pagination}
</div> </div>

Loading…
Cancel
Save