master
ELF 4 years ago
parent 36c240c608
commit b44a5118cf

@ -290,6 +290,9 @@ class TestingResourceController extends ThinkController
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])
->where(['game_id' => $binding['game_id'], 'role_id' => $binding['bind_role_id']])
->find();
if ($bindingRole) {
$bindingRole['binding_time'] = $binding['create_time'];
}
}
$repository = new TestingResourceRepository();

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

@ -143,6 +143,9 @@ class TestingResourceController extends BaseController
->field(['id', 'role_id', 'user_id', 'game_id', 'server_id', 'user_account', 'role_name'])
->where(['game_id' => $binding['game_id'], 'role_id' => $binding['bind_role_id']])
->find();
if ($bindingRole) {
$bindingRole['binding_time'] = $binding['create_time'];
}
}
$repository = new TestingResourceRepository();

Loading…
Cancel
Save