|
|
@ -24,14 +24,9 @@ class PromoteGradeController extends BaseController
|
|
|
|
public function index($p = 1)
|
|
|
|
public function index($p = 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$month = I('month', date('Y-m'));
|
|
|
|
$month = I('month', date('Y-m'));
|
|
|
|
|
|
|
|
$month = $month ? $month : date('Y-m');
|
|
|
|
|
|
|
|
$baseGameId = I('base_game_id', 0);
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
|
|
$promoteGradeService = new PromoteGradeService();
|
|
|
|
|
|
|
|
$setting = $promoteGradeService->getCurrentSetting($loginPromote);
|
|
|
|
|
|
|
|
if (is_null($setting)) {
|
|
|
|
|
|
|
|
return $this->error('未设置评级规则');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$parentId = I('parent_id', 0);
|
|
|
|
$parentId = I('parent_id', 0);
|
|
|
|
$promoteId = I('promote_id', 0);
|
|
|
|
$promoteId = I('promote_id', 0);
|
|
|
|
$searchLevel = 0;
|
|
|
|
$searchLevel = 0;
|
|
|
@ -51,6 +46,9 @@ class PromoteGradeController extends BaseController
|
|
|
|
$currentDisplay = '自己';
|
|
|
|
$currentDisplay = '自己';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$searchLevel = $parent['level'] + 1;
|
|
|
|
|
|
|
|
$searchLevelName = $promoteService->getLevelName($searchLevel);
|
|
|
|
|
|
|
|
|
|
|
|
$subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'group_remark'])->where(['parent_id' => $parent['id']])->select();
|
|
|
|
$subPromotes = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'group_remark'])->where(['parent_id' => $parent['id']])->select();
|
|
|
|
|
|
|
|
|
|
|
|
$map = ['parent_id' => $parent['id']];
|
|
|
|
$map = ['parent_id' => $parent['id']];
|
|
|
@ -58,6 +56,26 @@ class PromoteGradeController extends BaseController
|
|
|
|
$map['id'] = $promoteId;
|
|
|
|
$map['id'] = $promoteId;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$promoteGradeService = new PromoteGradeService();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$error = '';
|
|
|
|
|
|
|
|
$status = true;
|
|
|
|
|
|
|
|
$setting = null;
|
|
|
|
|
|
|
|
$pagination = null;
|
|
|
|
|
|
|
|
if ($baseGameId == 0) {
|
|
|
|
|
|
|
|
$status = false;
|
|
|
|
|
|
|
|
$error = '请选择游戏';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$monthNumber = date('Ym', strtotime($month . '-01'));
|
|
|
|
|
|
|
|
$setting = $promoteGradeService->getCurrentSetting($loginPromote, $baseGameId, $monthNumber);
|
|
|
|
|
|
|
|
if (is_null($setting)) {
|
|
|
|
|
|
|
|
$status = false;
|
|
|
|
|
|
|
|
$error = '该游戏在此月份未设置评级规则';
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
|
|
|
|
if ($status) {
|
|
|
|
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
|
|
|
|
$query = M('promote', 'tab_')->field(['id', 'account', 'real_name', 'level', 'chain'])->where($map);
|
|
|
|
list($promotes, $pagination, $count) = $this->paginate($query);
|
|
|
|
list($promotes, $pagination, $count) = $this->paginate($query);
|
|
|
|
|
|
|
|
|
|
|
@ -72,20 +90,37 @@ class PromoteGradeController extends BaseController
|
|
|
|
if (I('p', 1) == 1) {
|
|
|
|
if (I('p', 1) == 1) {
|
|
|
|
$records[0]['current_display'] = $currentDisplay;
|
|
|
|
$records[0]['current_display'] = $currentDisplay;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$this->meta_title = '团队评级';
|
|
|
|
$this->meta_title = '团队评级';
|
|
|
|
|
|
|
|
|
|
|
|
$this->assign('month', $month);
|
|
|
|
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
|
|
|
|
|
|
|
|
$this->assign('baseGames', $baseGames);
|
|
|
|
|
|
|
|
$this->assign('error', $error);
|
|
|
|
$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('parentId', $parentId);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
|
|
|
|
$this->assign('month', $month);
|
|
|
|
$this->assign('pagination', $pagination);
|
|
|
|
$this->assign('pagination', $pagination);
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function getMonthRangeDisplay($monthBegin, $monthEnd)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if ($monthBegin == 0 && $monthEnd == 0) {
|
|
|
|
|
|
|
|
return '永久';
|
|
|
|
|
|
|
|
} elseif ($monthBegin == 0 && $monthEnd > 0) {
|
|
|
|
|
|
|
|
return '从前 至 ' . date('Y-m', strtotime($monthEnd . '01'));
|
|
|
|
|
|
|
|
} elseif ($monthBegin > 0 && $monthEnd == 0) {
|
|
|
|
|
|
|
|
return date('Y-m', strtotime($monthBegin . '01')) . ' 至 永久';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return date('Y-m', strtotime($monthBegin . '01')) . ' 至 ' . date('Y-m', strtotime($monthEnd . '01'));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function settings()
|
|
|
|
public function settings()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->checkSettingPermission();
|
|
|
|
$this->checkSettingPermission();
|
|
|
@ -93,6 +128,13 @@ class PromoteGradeController extends BaseController
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
$items = M('promote_grade_setting', 'tab_')->where(['company_id' => $loginPromote['company_id']])->select();
|
|
|
|
$items = M('promote_grade_setting', 'tab_')->where(['company_id' => $loginPromote['company_id']])->select();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$baseGameIds = array_column($items, 'base_game_id');
|
|
|
|
|
|
|
|
$itemBaseGames = [];
|
|
|
|
|
|
|
|
if (count($baseGameIds) > 0) {
|
|
|
|
|
|
|
|
$itemBaseGames = M('base_game', 'tab_')->where(['id' => ['in', $baseGameIds]])->select();
|
|
|
|
|
|
|
|
$itemBaseGames = index_by_column('id', $itemBaseGames);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$symbols = PromoteGradeService::$symbols;
|
|
|
|
$symbols = PromoteGradeService::$symbols;
|
|
|
|
|
|
|
|
|
|
|
|
$records = [];
|
|
|
|
$records = [];
|
|
|
@ -100,11 +142,16 @@ class PromoteGradeController extends BaseController
|
|
|
|
$i = 0;
|
|
|
|
$i = 0;
|
|
|
|
$config = json_decode($item['config'], true);
|
|
|
|
$config = json_decode($item['config'], true);
|
|
|
|
$gradeCount = count($config['grades']) + 1;
|
|
|
|
$gradeCount = count($config['grades']) + 1;
|
|
|
|
|
|
|
|
$baseGame = $itemBaseGames[$item['base_game_id']] ?? null;
|
|
|
|
|
|
|
|
$baseGameName = $baseGame ? $baseGame['name'] : '--';
|
|
|
|
|
|
|
|
$monthRangeDisplay = $this->getMonthRangeDisplay($item['month_begin'], $item['month_end']);
|
|
|
|
if ($gradeCount == 1) {
|
|
|
|
if ($gradeCount == 1) {
|
|
|
|
$records[] = [
|
|
|
|
$records[] = [
|
|
|
|
'id' => $item['id'],
|
|
|
|
'id' => $item['id'],
|
|
|
|
'name' => $item['name'],
|
|
|
|
'name' => $item['name'],
|
|
|
|
|
|
|
|
'game_name' => $baseGameName,
|
|
|
|
'grade_count' => $gradeCount,
|
|
|
|
'grade_count' => $gradeCount,
|
|
|
|
|
|
|
|
'month_range' => $monthRangeDisplay,
|
|
|
|
'reach_level' => $config['reach_level'],
|
|
|
|
'reach_level' => $config['reach_level'],
|
|
|
|
'grade_name' => $config['default_grade_name'],
|
|
|
|
'grade_name' => $config['default_grade_name'],
|
|
|
|
'grade_value' => '全部'
|
|
|
|
'grade_value' => '全部'
|
|
|
@ -114,7 +161,9 @@ class PromoteGradeController extends BaseController
|
|
|
|
$records[] = [
|
|
|
|
$records[] = [
|
|
|
|
'id' => $item['id'],
|
|
|
|
'id' => $item['id'],
|
|
|
|
'name' => $item['name'],
|
|
|
|
'name' => $item['name'],
|
|
|
|
|
|
|
|
'game_name' => $baseGameName,
|
|
|
|
'grade_count' => $gradeCount,
|
|
|
|
'grade_count' => $gradeCount,
|
|
|
|
|
|
|
|
'month_range' => $monthRangeDisplay,
|
|
|
|
'reach_level' => $config['reach_level'],
|
|
|
|
'reach_level' => $config['reach_level'],
|
|
|
|
'grade_name' => $config['default_grade_name'],
|
|
|
|
'grade_name' => $config['default_grade_name'],
|
|
|
|
'grade_value' => ($firstGrade['symbol'] == 1 ? '<' : '<=') . $firstGrade['value']
|
|
|
|
'grade_value' => ($firstGrade['symbol'] == 1 ? '<' : '<=') . $firstGrade['value']
|
|
|
@ -123,7 +172,9 @@ class PromoteGradeController extends BaseController
|
|
|
|
$records[] = [
|
|
|
|
$records[] = [
|
|
|
|
'id' => $item['id'],
|
|
|
|
'id' => $item['id'],
|
|
|
|
'name' => $item['name'],
|
|
|
|
'name' => $item['name'],
|
|
|
|
|
|
|
|
'game_name' => $baseGameName,
|
|
|
|
'grade_count' => 0,
|
|
|
|
'grade_count' => 0,
|
|
|
|
|
|
|
|
'month_range' => $monthRangeDisplay,
|
|
|
|
'reach_level' => $config['reach_level'],
|
|
|
|
'reach_level' => $config['reach_level'],
|
|
|
|
'grade_name' => $grade['name'],
|
|
|
|
'grade_name' => $grade['name'],
|
|
|
|
'grade_value' => $symbols[$grade['symbol']] . $grade['value']
|
|
|
|
'grade_value' => $symbols[$grade['symbol']] . $grade['value']
|
|
|
@ -131,6 +182,10 @@ class PromoteGradeController extends BaseController
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
|
|
|
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
|
|
|
|
|
|
|
|
$this->assign('baseGames', $baseGames);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->assign('records', $records);
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -138,6 +193,8 @@ class PromoteGradeController extends BaseController
|
|
|
|
public function setting()
|
|
|
|
public function setting()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$this->checkSettingPermission();
|
|
|
|
$this->checkSettingPermission();
|
|
|
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
|
|
$id = I('id', 0);
|
|
|
|
$id = I('id', 0);
|
|
|
|
$setting = null;
|
|
|
|
$setting = null;
|
|
|
|
if ($id > 0) {
|
|
|
|
if ($id > 0) {
|
|
|
@ -148,6 +205,10 @@ class PromoteGradeController extends BaseController
|
|
|
|
$setting['config'] = json_decode($setting['config'], true);
|
|
|
|
$setting['config'] = json_decode($setting['config'], true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
|
|
|
$baseGames = $promoteService->getVisibleBaseGames($loginPromote);
|
|
|
|
|
|
|
|
$this->assign('baseGames', $baseGames);
|
|
|
|
$this->assign('setting', $setting);
|
|
|
|
$this->assign('setting', $setting);
|
|
|
|
$this->display();
|
|
|
|
$this->display();
|
|
|
|
}
|
|
|
|
}
|
|
|
|