|
|
|
@ -29,20 +29,22 @@ class TestingResourceController extends BaseController
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
$conditions = [];
|
|
|
|
|
$subConditions = [];
|
|
|
|
|
|
|
|
|
|
if ($createTimeStart) {
|
|
|
|
|
$subConditions['create_time'] = ['egt', strtotime($createTimeStart . ' 00:00:00')];
|
|
|
|
|
}
|
|
|
|
|
if ($createTimeEnd) {
|
|
|
|
|
$subConditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')];
|
|
|
|
|
}
|
|
|
|
|
$subConditions = [
|
|
|
|
|
'_string' => '1=1'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @todo 仅有游戏猫
|
|
|
|
|
*/
|
|
|
|
|
$strCondition = 'game_id in (229, 230)';
|
|
|
|
|
|
|
|
|
|
if ($createTimeStart) {
|
|
|
|
|
$strCondition .= ' and create_time >=' . strtotime($createTimeStart . ' 00:00:00');
|
|
|
|
|
}
|
|
|
|
|
if ($createTimeEnd) {
|
|
|
|
|
$strCondition .= ' and create_time <=' . strtotime($createTimeEnd . ' 23:59:59');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$subSql = M('testing_user', 'tab_')->field(['user_id'])->where($subConditions)->select(false);
|
|
|
|
|
$strCondition .= ' and user_id in (' . $subSql . ')';
|
|
|
|
|
|
|
|
|
@ -275,10 +277,10 @@ class TestingResourceController extends BaseController
|
|
|
|
|
'_string' => 'exists (' . $subSql . ')'
|
|
|
|
|
];
|
|
|
|
|
if ($createTimeStart) {
|
|
|
|
|
$conditions['create_time'] = ['egt', strtotime($createTimeStart . ' 00:00:00')];
|
|
|
|
|
$conditions['_string'] .= ' and create_time >=' . strtotime($createTimeStart . ' 00:00:00');
|
|
|
|
|
}
|
|
|
|
|
if ($createTimeEnd) {
|
|
|
|
|
$conditions['create_time'] = ['elt', strtotime($createTimeEnd . ' 23:59:59')];
|
|
|
|
|
$conditions['_string'] .= ' and create_time <=' . strtotime($createTimeEnd . ' 23:59:59');
|
|
|
|
|
}
|
|
|
|
|
if ($verifyStatus != -1) {
|
|
|
|
|
$conditions['verify_status'] = $verifyStatus;
|
|
|
|
@ -481,6 +483,10 @@ class TestingResourceController extends BaseController
|
|
|
|
|
$records = I('records', []);
|
|
|
|
|
$loginPromote = $this->getLoginPromote();
|
|
|
|
|
|
|
|
|
|
if ($loginPromote['level'] != 1) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '权限不足']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$resources = [];
|
|
|
|
|
/**
|
|
|
|
|
* @todo 目前仅限游戏猫
|
|
|
|
@ -522,6 +528,19 @@ class TestingResourceController extends BaseController
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '角色不存在']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$otherRoleBatch = M('testing_resource_batch', 'tab_')
|
|
|
|
|
->where([
|
|
|
|
|
'user_id' => $user['id'],
|
|
|
|
|
'game_id' => $gameId,
|
|
|
|
|
'server_id' => $server['server_id'],
|
|
|
|
|
'role_id' => ['neq', $roleId],
|
|
|
|
|
'verify_status' => ['in', [0, 1]],
|
|
|
|
|
])
|
|
|
|
|
->find();
|
|
|
|
|
if ($otherRoleBatch) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '每个账号同区服只能申请一个角色']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$testPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $role['promote_id']])->find();
|
|
|
|
|
if (is_null($testPromote) || !$promoteService->isSubOrSelf($testPromote, $loginPromote)) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '测试角色所属推广员异常']);
|
|
|
|
|