完善批量设置

This commit is contained in:
zlzw 2024-11-27 18:06:15 +08:00
parent ad84c71a30
commit 38854993d0
5 changed files with 22 additions and 14 deletions

View File

@ -32,13 +32,13 @@
<div class="layui-form-item" pane>
<label class="layui-form-label">录制日期</label>
<div class="layui-input-block">
<input type="checkbox" checked name="week_1" title="周一" lay-skin="tag">
<input type="checkbox" checked name="week_2" title="周二" lay-skin="tag">
<input type="checkbox" checked name="week_3" title="周三" lay-skin="tag">
<input type="checkbox" checked name="week_4" title="周四" lay-skin="tag">
<input type="checkbox" checked name="week_5" title="周五" lay-skin="tag">
<input type="checkbox" checked name="week_6" title="周六" lay-skin="tag">
<input type="checkbox" checked name="week_7" title="周日" lay-skin="tag">
<input type="checkbox" name="week_1" title="周一" lay-skin="tag">
<input type="checkbox" name="week_2" title="周二" lay-skin="tag">
<input type="checkbox" name="week_3" title="周三" lay-skin="tag">
<input type="checkbox" name="week_4" title="周四" lay-skin="tag">
<input type="checkbox" name="week_5" title="周五" lay-skin="tag">
<input type="checkbox" name="week_6" title="周六" lay-skin="tag">
<input type="checkbox" name="week_7" title="周日" lay-skin="tag">
</div>
</div>
<div class="layui-form-item">

View File

@ -46,7 +46,7 @@
elem: '#followList',
url: '/live/config/follow?userId=' + userId,
toolbar: '#toolbarDemo',
height: '350px',
height: 'full',
totalRow: true, // 开启合计行
page: true,
response: {

View File

@ -38,7 +38,7 @@
elem: '#followList',
url: '/live/config/followLive?userId=' + userId,
toolbar: '#toolbarDemo',
height: '350px',
height: 'full',
totalRow: false, // 开启合计行
page: false,
response: {

View File

@ -25,7 +25,7 @@ public class FollowLive extends BaseBean {
private String roomId;
@JSONField(name = "uid")
private int uid;
private String uid;
@JSONField(name = "online")
private int online;

View File

@ -140,13 +140,20 @@ public class LiveConfigController {
@RequestMapping(value = "set/array", method = RequestMethod.POST)
@ResponseBody
public JSONObject addArrayConfig(@RequestBody JSONObject jsonObject) {
LiveConfigDatabaseBean bean = jsonObject.getJSONObject("config").to(LiveConfigDatabaseBean.class);
JSONObject config=jsonObject.getJSONObject("config");
LiveConfigDatabaseBean bean = config.to(LiveConfigDatabaseBean.class);
if (!bean.verifyLiveTimer()) {
return ResultData.fail(ReturnCode.RC999.getCode(), "视频录制时间格式错误");
}
if (!bean.verifyDanmuTimer()) {
return ResultData.fail(ReturnCode.RC999.getCode(), "弹幕录制时间格式错误");
}
if("on".equals(config.getString("recordDanmu"))){
bean.setRecordDanmu(true);
}
if("on".equals(config.getString("recordLive"))){
bean.setRecordLive(true);
}
JSONArray jsonArray = jsonObject.getJSONArray("array");
List<LiveConfigDatabaseBean> list = jsonArray.stream().map(roomId -> configService.addConfig(roomId.toString(), bean)).toList();
int countNull = list.stream().filter(Objects::isNull).toList().size();
@ -160,16 +167,17 @@ public class LiveConfigController {
int countNull = list.stream().filter(it -> !it).toList().size();
return ResultData.success("成功删除" + (list.size() - countNull) + "个直播间");
}
@RequestMapping(value = "delete/all", method = RequestMethod.GET)
@ResponseBody
public JSONObject deleteAllConfig() {
for (LiveConfigDatabaseBean bean : configService.getAllConfig()) {
configService.deleteConfig(bean.getRoomId());
}
if(configService.getAllConfig().isEmpty()) {
if (configService.getAllConfig().isEmpty()) {
return ResultData.success("成功删除");
}else{
return ResultData.fail(-1,"删除失败,剩余:"+configService.getAllConfig().size()+"个直播间");
} else {
return ResultData.fail(-1, "删除失败,剩余:" + configService.getAllConfig().size() + "个直播间");
}
}