http-service: change pbs from int to double
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user