chat commands: add ba high gamble command
This commit is contained in:
@@ -107,6 +107,28 @@ public class ChatController
|
||||
return kc;
|
||||
}
|
||||
|
||||
@PostMapping("/gc")
|
||||
public void submitGc(@RequestParam String name, @RequestParam int gc)
|
||||
{
|
||||
if (gc < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
chatService.setGc(name, gc);
|
||||
}
|
||||
|
||||
@GetMapping("/gc")
|
||||
public int getKc(@RequestParam String name)
|
||||
{
|
||||
Integer gc = chatService.getGc(name);
|
||||
if (gc == null)
|
||||
{
|
||||
throw new NotFoundException();
|
||||
}
|
||||
return gc;
|
||||
}
|
||||
|
||||
@PostMapping("/task")
|
||||
public void submitTask(@RequestParam String name, @RequestParam("task") String taskName, @RequestParam int amount,
|
||||
@RequestParam int initialAmount, @RequestParam String location)
|
||||
|
||||
@@ -139,4 +139,22 @@ public class ChatService
|
||||
jedis.setex("pb." + boss + "." + name, (int) EXPIRE.getSeconds(), Integer.toString(pb));
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getGc(String name)
|
||||
{
|
||||
String value;
|
||||
try (Jedis jedis = jedisPool.getResource())
|
||||
{
|
||||
value = jedis.get("gc." + name);
|
||||
}
|
||||
return value == null ? null : Integer.parseInt(value);
|
||||
}
|
||||
|
||||
public void setGc(String name, int gc)
|
||||
{
|
||||
try (Jedis jedis = jedisPool.getResource())
|
||||
{
|
||||
jedis.setex("gc." + name, (int) EXPIRE.getSeconds(), Integer.toString(gc));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user