diff --git a/Application/Admin/Controller/TestingResourceController.class.php b/Application/Admin/Controller/TestingResourceController.class.php index b2f28a187..881cc1934 100644 --- a/Application/Admin/Controller/TestingResourceController.class.php +++ b/Application/Admin/Controller/TestingResourceController.class.php @@ -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(); diff --git a/Application/Base/Service/TestingResourceService.class.php b/Application/Base/Service/TestingResourceService.class.php index bb9aea68a..54124fc71 100644 --- a/Application/Base/Service/TestingResourceService.class.php +++ b/Application/Base/Service/TestingResourceService.class.php @@ -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('额度不足'); } diff --git a/Application/Home/Controller/TestingResourceController.class.php b/Application/Home/Controller/TestingResourceController.class.php index 83fa00dcb..37ca7a3fa 100644 --- a/Application/Home/Controller/TestingResourceController.class.php +++ b/Application/Home/Controller/TestingResourceController.class.php @@ -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();