From f788607ff771a47bc60d6a86e00b3433c40f3d2c Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期五, 24 九月 2021 15:22:03 +0800
Subject: [PATCH] 接入视频直播

---
 src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java
index 91567f7..ff9a4b3 100644
--- a/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java
+++ b/src/main/java/com/yeshi/buwan/service/imp/live/TVLiveChannelServiceImpl.java
@@ -43,8 +43,36 @@
             channel.setUpdateTime(new Date());
         }
 
+
         tvLiveChannelDao.save(channel);
         return channel;
+    }
+
+    @Override
+    public TVLiveChannel addChannel(TVLiveChannel channel) throws ParamsException, Exception {
+        if (channel == null || StringUtil.isNullOrEmpty(channel.getName())) {
+            throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "鍚嶇О涓嶈兘涓虹┖");
+        }
+
+        if (StringUtil.isNullOrEmpty(channel.gethPicture())) {
+            throw new ParamsException(ParamsException.CODE_PARAMS_NOT_ENOUGH, "妯浘涓嶈兘涓虹┖");
+        }
+
+        if (channel.getId() == null) {
+            channel.setId(StringUtil.Md5(channel.getName()));
+        }
+
+        if (channel.getState() == null) {
+            channel.setState(TVLiveChannel.STATE_NORMAL);
+        }
+
+
+        if (tvLiveChannelDao.get(channel.getId()) != null) {
+            throw new Exception("棰戦亾宸茬粡瀛樺湪");
+        }
+
+
+        return save(channel);
     }
 
     @Override
@@ -88,5 +116,18 @@
         daoQuery.name = name;
         return tvLiveChannelDao.count(daoQuery);
     }
-    
+
+    @Override
+    public TVLiveChannel selectByPrimaryKey(String id) {
+        return tvLiveChannelDao.get(id);
+    }
+
+    @Override
+    public void savePrograms(String id, List<TVLiveChannel.TVLiveProgram> tvLivePrograms) {
+        TVLiveChannel channel = new TVLiveChannel();
+        channel.setId(id);
+        channel.setProgramList(tvLivePrograms);
+        tvLiveChannelDao.updateSelective(channel);
+    }
+
 }

--
Gitblit v1.8.0