1
1
mirror of https://github.com/geekfrog/PermissionsTime.git synced 2025-09-10 05:03:26 +00:00

设置、移除、测试权限组添加

This commit is contained in:
GeekFrog
2017-07-13 07:17:41 +08:00
parent 193f0a7dc4
commit e0e3ce448c
13 changed files with 347 additions and 79 deletions

View File

@ -69,18 +69,31 @@ public class SqlitePlayerDataService extends DatabaseUtil implements IPlayerData
}
@Override
public boolean addTime(String uuid, String packageName, int days) throws Exception {
PlayerDataBean pdb = queryPlayerData(uuid, packageName);
public boolean setTime(String uuid, String packageName, int days) throws Exception {
long now = new Date().getTime();
long addTime = days * 24 * 60 * 60 * 1000L;
long expire = 0L;
long expire = now + addTime;
PlayerDataBean pdb = queryPlayerData(uuid, packageName);
if (pdb == null) {
pdb = new PlayerDataBean(null, uuid, packageName, expire);
return setPlayerData(pdb);
} else {
pdb.setExpire(expire);
return setPlayerData(pdb);
}
}
@Override
public boolean addTime(String uuid, String packageName, int days) throws Exception {
long now = new Date().getTime();
long addTime = days * 24 * 60 * 60 * 1000L;
long expire = now + addTime;
PlayerDataBean pdb = queryPlayerData(uuid, packageName);
if (pdb == null) {
expire = now + addTime;
pdb = new PlayerDataBean(null, uuid, packageName, expire);
return setPlayerData(pdb);
} else {
if (pdb.getExpire() < now) {
expire = now + addTime;
pdb.setExpire(expire);
return setPlayerData(pdb);
} else {