|
|
@ -178,8 +178,14 @@ class TestingResourceService
|
|
|
|
|
|
|
|
|
|
|
|
$totalQuota = $role['testing_other_quota'] + ($gameSetting['base_quota'] ?? 0);
|
|
|
|
$totalQuota = $role['testing_other_quota'] + ($gameSetting['base_quota'] ?? 0);
|
|
|
|
if (!is_null($bindRole)) {
|
|
|
|
if (!is_null($bindRole)) {
|
|
|
|
|
|
|
|
$bindTime = $bindRole['binding_time'] ?? 0;
|
|
|
|
$spendQuota += M('spend', 'tab_')
|
|
|
|
$spendQuota += M('spend', 'tab_')
|
|
|
|
->where(['game_id' => $role['game_id'], 'game_player_id' => $bindRole['role_id'], 'pay_status' => 1])
|
|
|
|
->where([
|
|
|
|
|
|
|
|
'game_id' => $role['game_id'],
|
|
|
|
|
|
|
|
'game_player_id' => $bindRole['role_id'],
|
|
|
|
|
|
|
|
'pay_status' => 1,
|
|
|
|
|
|
|
|
'egt' => strtotime(date('Y-m-d 00:00:00', $bindTime))
|
|
|
|
|
|
|
|
])
|
|
|
|
->group('game_id,game_player_id')
|
|
|
|
->group('game_id,game_player_id')
|
|
|
|
->sum('pay_amount');
|
|
|
|
->sum('pay_amount');
|
|
|
|
$totalQuota += round($gameSetting['rate'] / 100 * $spendQuota, 2);
|
|
|
|
$totalQuota += round($gameSetting['rate'] / 100 * $spendQuota, 2);
|
|
|
@ -421,6 +427,7 @@ class TestingResourceService
|
|
|
|
if (is_null($bindingRole)) {
|
|
|
|
if (is_null($bindingRole)) {
|
|
|
|
throw new \Exception('绑定玩家角色不存在');
|
|
|
|
throw new \Exception('绑定玩家角色不存在');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$bindingRole['binding_time'] = $binding['create_time'];
|
|
|
|
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindingRole['promote_id']])->find();
|
|
|
|
$bindPromote = M('promote', 'tab_')->field(['id', 'chain'])->where(['id' => $bindingRole['promote_id']])->find();
|
|
|
|
if (is_null($bindPromote) || ($promote && !$promoteService->isSubOrSelf($bindPromote, $promote))) {
|
|
|
|
if (is_null($bindPromote) || ($promote && !$promoteService->isSubOrSelf($bindPromote, $promote))) {
|
|
|
|
throw new \Exception('绑定角色所属推广员异常');
|
|
|
|
throw new \Exception('绑定角色所属推广员异常');
|
|
|
@ -461,7 +468,7 @@ class TestingResourceService
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$remainQuota = $this->getRemainQuota($role, $bindingRole);
|
|
|
|
$remainQuota = $this->getRemainQuota($role, $bindingRole, $gameSetting);
|
|
|
|
if ($amount > $remainQuota) {
|
|
|
|
if ($amount > $remainQuota) {
|
|
|
|
throw new \Exception('额度不足');
|
|
|
|
throw new \Exception('额度不足');
|
|
|
|
}
|
|
|
|
}
|
|
|
|