|
@@ -306,6 +306,7 @@ public class MidJourneyAccountServiceImpl extends ServiceImpl<MidjourneyAccountM
|
|
|
List<MidjourneyProxyAccountInfo> content = JSONUtil.parseArray(jsonObject.getStr("content")).toList(MidjourneyProxyAccountInfo.class);
|
|
List<MidjourneyProxyAccountInfo> content = JSONUtil.parseArray(jsonObject.getStr("content")).toList(MidjourneyProxyAccountInfo.class);
|
|
|
//如果 该账号不存在于 proxy 上,则在本地删除该账号
|
|
//如果 该账号不存在于 proxy 上,则在本地删除该账号
|
|
|
|
|
|
|
|
|
|
+ String key = RedisService.key.MIDJOURNEY_ACCOUNT.getName();
|
|
|
content.forEach((accountInfo)->{
|
|
content.forEach((accountInfo)->{
|
|
|
if (StringUtils.isNotBlank(accountInfo.getRemark()) && StringUtils.isNumeric(accountInfo.getRemark())) {
|
|
if (StringUtils.isNotBlank(accountInfo.getRemark()) && StringUtils.isNumeric(accountInfo.getRemark())) {
|
|
|
MidjourneyAccount midjourneyAccount = getById(Long.parseLong(accountInfo.getRemark()));
|
|
MidjourneyAccount midjourneyAccount = getById(Long.parseLong(accountInfo.getRemark()));
|
|
@@ -322,7 +323,10 @@ public class MidJourneyAccountServiceImpl extends ServiceImpl<MidjourneyAccountM
|
|
|
midjourneyAccount.setStatus(accountInfo.isEnable());
|
|
midjourneyAccount.setStatus(accountInfo.isEnable());
|
|
|
Long instanceId = midjourneyAccount.getInstanceId();
|
|
Long instanceId = midjourneyAccount.getInstanceId();
|
|
|
if(accountInfo.isEnable()){
|
|
if(accountInfo.isEnable()){
|
|
|
- redisService.hincr(RedisService.key.MIDJOURNEY_ACCOUNT.getName(), instanceId.toString(), 1.0);
|
|
|
|
|
|
|
+ Map<Object, Object> accountsUsage = redisService.hmget(key);
|
|
|
|
|
+ if (MapUtil.isNotEmpty(accountsUsage)) {
|
|
|
|
|
+ redisService.hset(key,midjourneyAccount.getInstanceId().toString(),accountsUsage.values().toArray()[0]);
|
|
|
|
|
+ }
|
|
|
//重置setting
|
|
//重置setting
|
|
|
TASK_EXECUTOR.execute(() -> {
|
|
TASK_EXECUTOR.execute(() -> {
|
|
|
if (!"default".equals(accountInfo.getVersion()) || !accountInfo.isRaw()) {
|
|
if (!"default".equals(accountInfo.getVersion()) || !accountInfo.isRaw()) {
|
|
@@ -330,7 +334,7 @@ public class MidJourneyAccountServiceImpl extends ServiceImpl<MidjourneyAccountM
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}else {
|
|
}else {
|
|
|
- redisService.hdel(RedisService.key.MIDJOURNEY_ACCOUNT.getName(), instanceId.toString());
|
|
|
|
|
|
|
+ redisService.hdel(key, instanceId.toString());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -345,7 +349,7 @@ public class MidJourneyAccountServiceImpl extends ServiceImpl<MidjourneyAccountM
|
|
|
list.forEach((account)->{
|
|
list.forEach((account)->{
|
|
|
if (!ids.contains(account.getInstanceId().toString())) {
|
|
if (!ids.contains(account.getInstanceId().toString())) {
|
|
|
removeById(account.getId());
|
|
removeById(account.getId());
|
|
|
- redisService.hdel(RedisService.key.MIDJOURNEY_ACCOUNT.getName(),account.getInstanceId().toString());
|
|
|
|
|
|
|
+ redisService.hdel(key,account.getInstanceId().toString());
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
|