diff --git a/Application/Base/Service/DiscountService.class.php b/Application/Base/Service/DiscountService.class.php index bf290e093..eac24fecc 100644 --- a/Application/Base/Service/DiscountService.class.php +++ b/Application/Base/Service/DiscountService.class.php @@ -12,8 +12,8 @@ class DiscountService $data = [ 'base_game_id' => $params['base_game_id'], 'base_game_name' => $baseGame['name'], - 'start_time' => strtotime($params['start_time']), - 'end_time' => empty($params['end_time']) ? self::FOREVER_TIME : strtotime($params['end_time']), + 'start_time' => strtotime($params['start_time'] . ' 00:00:00'), + 'end_time' => empty($params['end_time']) ? self::FOREVER_TIME : strtotime($params['end_time'] . ' 23:59:59'), 'first_rate' => $params['first_rate'], 'second_rate' => $params['second_rate'], 'status' => $params['status'], @@ -69,6 +69,18 @@ class DiscountService if ($record['end_time'] < time()) { throw new \Exception('生效时间已过,不可修改'); } + + if ($record['start_time'] < time()) { + if ($record['base_game_id'] != $params['base_game_id']) { + throw new \Exception('已生效不能修改游戏'); + } + if (intval($firstRate * 10) != intval($record['first_rate'] * 10)) { + throw new \Exception('已生效不能修改首充折扣'); + } + if (intval($secondRate * 10) != intval($record['second_rate'] * 10)) { + throw new \Exception('已生效不能修改次充折扣'); + } + } } $map = [];