|
|
|
@ -8,6 +8,7 @@ use Base\Repository\PromoteRepository;
|
|
|
|
|
use Base\Repository\SpendRepository;
|
|
|
|
|
use Base\Repository\UserRepository;
|
|
|
|
|
use Base\Service\PromoteService;
|
|
|
|
|
use Base\Service\PromoteGradeService;
|
|
|
|
|
use Base\Facade\Request;
|
|
|
|
|
use Base\Service\ApplyService;
|
|
|
|
|
use Base\Service\PromoteCoinRecordService;
|
|
|
|
@ -1888,6 +1889,66 @@ class DownloadController extends BaseController {
|
|
|
|
|
$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() {
|
|
|
|
|
$gameId = I('relation_game_id', 0);
|
|
|
|
@ -2158,6 +2219,9 @@ class DownloadController extends BaseController {
|
|
|
|
|
case "推广员业绩":
|
|
|
|
|
$this->achievementExcelInfo($id,$map);
|
|
|
|
|
break;
|
|
|
|
|
case "团队评级":
|
|
|
|
|
$this->promoteGradeExcelInfo($id,$map);
|
|
|
|
|
break;
|
|
|
|
|
case "渠道管理":
|
|
|
|
|
$this->childrenExcelInfo($id,$map);
|
|
|
|
|
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) {
|
|
|
|
|
$xlsName = "推广员业绩";
|
|
|
|
|
$xlsCell = array(
|
|
|
|
|