完善批量设置

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

View File

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

View File

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

View File

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

View File

@ -140,13 +140,20 @@ public class LiveConfigController {
@RequestMapping(value = "set/array", method = RequestMethod.POST) @RequestMapping(value = "set/array", method = RequestMethod.POST)
@ResponseBody @ResponseBody
public JSONObject addArrayConfig(@RequestBody JSONObject jsonObject) { 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()) { if (!bean.verifyLiveTimer()) {
return ResultData.fail(ReturnCode.RC999.getCode(), "视频录制时间格式错误"); return ResultData.fail(ReturnCode.RC999.getCode(), "视频录制时间格式错误");
} }
if (!bean.verifyDanmuTimer()) { if (!bean.verifyDanmuTimer()) {
return ResultData.fail(ReturnCode.RC999.getCode(), "弹幕录制时间格式错误"); 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"); JSONArray jsonArray = jsonObject.getJSONArray("array");
List<LiveConfigDatabaseBean> list = jsonArray.stream().map(roomId -> configService.addConfig(roomId.toString(), bean)).toList(); List<LiveConfigDatabaseBean> list = jsonArray.stream().map(roomId -> configService.addConfig(roomId.toString(), bean)).toList();
int countNull = list.stream().filter(Objects::isNull).toList().size(); int countNull = list.stream().filter(Objects::isNull).toList().size();
@ -160,6 +167,7 @@ public class LiveConfigController {
int countNull = list.stream().filter(it -> !it).toList().size(); int countNull = list.stream().filter(it -> !it).toList().size();
return ResultData.success("成功删除" + (list.size() - countNull) + "个直播间"); return ResultData.success("成功删除" + (list.size() - countNull) + "个直播间");
} }
@RequestMapping(value = "delete/all", method = RequestMethod.GET) @RequestMapping(value = "delete/all", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public JSONObject deleteAllConfig() { public JSONObject deleteAllConfig() {