http-service: change pbs from int to double

This commit is contained in:
Hydrox6
2021-02-24 17:31:15 +00:00
committed by Adam
parent 02025f9d8f
commit 33cdd85ee7
3 changed files with 11 additions and 11 deletions

View File

@@ -173,7 +173,7 @@ public class ChatController
}
@PostMapping("/pb")
public void submitPb(@RequestParam String name, @RequestParam String boss, @RequestParam int pb)
public void submitPb(@RequestParam String name, @RequestParam String boss, @RequestParam double pb)
{
if (pb < 0)
{
@@ -184,9 +184,9 @@ public class ChatController
}
@GetMapping("/pb")
public int getPb(@RequestParam String name, @RequestParam String boss)
public double getPb(@RequestParam String name, @RequestParam String boss)
{
Integer pb = chatService.getPb(name, boss);
Double pb = chatService.getPb(name, boss);
if (pb == null)
{
throw new NotFoundException();

View File

@@ -127,21 +127,21 @@ public class ChatService
}
}
public Integer getPb(String name, String boss)
public Double getPb(String name, String boss)
{
String value;
try (Jedis jedis = jedisPool.getResource())
{
value = jedis.get("pb." + boss + "." + name);
}
return value == null ? null : Integer.parseInt(value);
return value == null ? null : Double.parseDouble(value);
}
public void setPb(String name, String boss, int pb)
public void setPb(String name, String boss, double pb)
{
try (Jedis jedis = jedisPool.getResource())
{
jedis.setex("pb." + boss + "." + name, (int) EXPIRE.getSeconds(), Integer.toString(pb));
jedis.setex("pb." + boss + "." + name, (int) EXPIRE.getSeconds(), Double.toString(pb));
}
}