|
|
|
@ -180,7 +180,7 @@ class TestingResourceController extends BaseController
|
|
|
|
|
'role_name' => $role['role_name'],
|
|
|
|
|
'bind_user_account' => $bindingRole ? $bindingRole['user_account'] : '',
|
|
|
|
|
'bind_role_name' => $bindingRole ? $bindingRole['role_name'] : '',
|
|
|
|
|
'base_quota' => $binding ? $binding['base_quota'] : 0,
|
|
|
|
|
'base_quota' => $binding ? $binding['base_quota'] : 300,
|
|
|
|
|
'other_quota' => $binding ? $binding['other_quota'] : 0,
|
|
|
|
|
'quota' => $bindingRole && isset($spendItems[$bindingRole['game_role_id']]) ? $spendItems[$bindingRole['game_role_id']] : 0,
|
|
|
|
|
'verify_amount' => $verifyRecords[$role['game_role_id']] ?? 0,
|
|
|
|
@ -487,9 +487,9 @@ class TestingResourceController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$binding = M('testing_binding', 'tab_')->where(['game_id' => $gameId, 'role_id' => $roleId])->find();
|
|
|
|
|
if (is_null($binding)) {
|
|
|
|
|
/* if (is_null($binding)) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '该角色未绑定玩家角色']);
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
$user = M('user', 'tab_')->field(['id', 'promote_id'])->where(['account' => $userAccount])->find();
|
|
|
|
|
if (is_null($user)) {
|
|
|
|
@ -508,7 +508,7 @@ class TestingResourceController extends BaseController
|
|
|
|
|
$promoteService = new PromoteService();
|
|
|
|
|
|
|
|
|
|
$role = M('user_play_info', 'tab_')
|
|
|
|
|
->field(['id', 'role_id', 'promote_id'])
|
|
|
|
|
->field(['id', 'role_id', 'promote_id', 'game_id'])
|
|
|
|
|
->where(['user_id' => $user['id'], 'game_id' => $gameId, 'server_id' => $server['server_id'], 'role_id' => $roleId])
|
|
|
|
|
->find();
|
|
|
|
|
if (is_null($role)) {
|
|
|
|
@ -519,20 +519,22 @@ class TestingResourceController extends BaseController
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '测试角色所属推广员异常']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$bindingRole = M('user_play_info', 'tab_')
|
|
|
|
|
->field(['id', 'role_id', 'user_id', 'promote_id', 'game_id'])
|
|
|
|
|
->where(['game_id' => $gameId, 'role_id' => $binding['bind_role_id']])
|
|
|
|
|
->find();
|
|
|
|
|
if (is_null($bindingRole)) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '绑定玩家角色不存在']);
|
|
|
|
|
}
|
|
|
|
|
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindingRole['promote_id']])->find();
|
|
|
|
|
if (is_null($bindPromote) || !$promoteService->isSubOrSelf($bindPromote, $loginPromote)) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '绑定角色所属推广员异常']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($testPromote['id'] != $bindPromote['id']) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '测试账号与玩家账号所属推广员不同']);
|
|
|
|
|
$bindingRole = null;
|
|
|
|
|
if ($binding) {
|
|
|
|
|
$bindingRole = M('user_play_info', 'tab_')
|
|
|
|
|
->field(['id', 'role_id', 'user_id', 'promote_id', 'game_id'])
|
|
|
|
|
->where(['game_id' => $gameId, 'role_id' => $binding['bind_role_id']])
|
|
|
|
|
->find();
|
|
|
|
|
if (is_null($bindingRole)) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '绑定玩家角色不存在']);
|
|
|
|
|
}
|
|
|
|
|
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindingRole['promote_id']])->find();
|
|
|
|
|
if (is_null($bindPromote) || !$promoteService->isSubOrSelf($bindPromote, $loginPromote)) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '绑定角色所属推广员异常']);
|
|
|
|
|
}
|
|
|
|
|
/* if ($testPromote['id'] != $bindPromote['id']) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '测试账号与玩家账号所属推广员不同']);
|
|
|
|
|
} */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$amount = 0;
|
|
|
|
@ -553,7 +555,7 @@ class TestingResourceController extends BaseController
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$remainQuota = $this->getRemainQuota($bindingRole['game_id'], $bindingRole['role_id'], $role['role_id']);
|
|
|
|
|
$remainQuota = $this->getRemainQuota($role['game_id'], $bindingRole ? $bindingRole['role_id'] : null, $role['role_id']);
|
|
|
|
|
if ($amount > $remainQuota) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '额度不足']);
|
|
|
|
|
}
|
|
|
|
@ -643,9 +645,9 @@ class TestingResourceController extends BaseController
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '玩家账号所属推广员异常']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($testPromote['id'] != $bindPromote['id']) {
|
|
|
|
|
/* if ($testPromote['id'] != $bindPromote['id']) {
|
|
|
|
|
return $this->ajaxReturn(['status' => 0, 'message' => '玩家账号与测试账号非同一推广员']);
|
|
|
|
|
}
|
|
|
|
|
} */
|
|
|
|
|
|
|
|
|
|
$bindIsTesting = M('testing_user', 'tab_')->where(['user_id' => $bindRole['user_id']])->find();
|
|
|
|
|
if ($bindIsTesting) {
|
|
|
|
|