后台分区网页优化,HomeVideo初步支持来自全网搜的数据
| | |
| | | hv.setTag(tagStr[i]); |
| | | hv.setPicture(pictureStr[i]); |
| | | hv.setType(new HomeType(hometypeid + "")); |
| | | hv.setVideo(new VideoInfo(videoStr[i])); |
| | | hv.setVideoId(videoStr[i]); |
| | | hv.setBigPicture(false); |
| | | } |
| | | |
| | |
| | | |
| | | import com.yeshi.buwan.domain.recommend.HomeRecommendSpecial; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.util.SystemUtil; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | |
| | | |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | |
| | | @Resource |
| | | private HomeVideoService homeVideoService; |
| | | |
| | | @Resource |
| | | private HomeRecommendSpecialService homeRecommendSpecialService; |
| | |
| | | hv.setTag(tag); |
| | | } |
| | | hv.setType(new HomeType(ht)); |
| | | hv.setVideo(new VideoInfo(vid)); |
| | | hv.setVideoId(vid); |
| | | hv.setBigPicture(false); |
| | | list.add(hv); |
| | | } |
| | |
| | | @RequestMapping(value = "/gethomevideolist", method = RequestMethod.POST) |
| | | public void getHomeVideoList(long id, int page, String key, PrintWriter out) { |
| | | key = StringUtil.isNullOrEmpty(key) ? "" : key; |
| | | List<HomeVideo> list = homeTypeService.getHomeVideoList(id + "", key, page); |
| | | List<HomeVideo> list = homeVideoService.getHomeVideoList(id + "", key, page); |
| | | for (HomeVideo homeVideo : list) { |
| | | homeVideo.setType(null); |
| | | homeVideo.setAdmin(null); |
| | | } |
| | | long count = homeTypeService.getHomeVideoListCount(id + "", key); |
| | | long count = homeVideoService.getHomeVideoListCount(id + "", key); |
| | | PageEntity pe = new PageEntity(); |
| | | pe.setPageIndex(page); |
| | | pe.setPageSize(Constant.pageCount); |
| | |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | import com.google.common.base.Function; |
| | | import com.google.common.collect.Maps; |
| | | import com.google.gson.Gson; |
| | | import com.yeshi.buwan.domain.VideoResource; |
| | | import com.yeshi.buwan.domain.solr.SolrAlbumVideo; |
| | | import com.yeshi.buwan.domain.video.VideoInfoExtra; |
| | | import com.yeshi.buwan.dto.search.SolrResultDTO; |
| | | import com.yeshi.buwan.dto.search.SolrVideoSearchFilter; |
| | | import com.yeshi.buwan.iqiyi.IqiYiNewAPI; |
| | | import com.yeshi.buwan.service.imp.VideoResourceService; |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; |
| | | import com.yeshi.buwan.service.manager.SolrAlbumVideoDataManager; |
| | | import com.yeshi.buwan.util.Constant; |
| | |
| | | |
| | | @Resource |
| | | private ResourceVideoService resourceVideoService; |
| | | |
| | | @Resource |
| | | private VideoResourceService videoResourceService; |
| | | |
| | | @Resource |
| | | private IqiyiUtil iqiyiUtil; |
| | |
| | | |
| | | filter.setArea(StringUtil.isNullOrEmpty(area) ? null : area.trim()); |
| | | |
| | | List<VideoResource> resourceList = videoResourceService.getResourceList(); |
| | | Map<Long, String> resourceMap = new HashMap<>(); |
| | | for (VideoResource vr : resourceList) { |
| | | resourceMap.put(Long.parseLong(vr.getId()), vr.getName()); |
| | | } |
| | | |
| | | SolrResultDTO dto = solrAlbumDataManager.find(filter, page, Constant.pageCount); |
| | | if (dto.getVideoList() != null) |
| | | for (SolrAlbumVideo videoInfo : (List<SolrAlbumVideo>) dto.getVideoList()) |
| | | voList.add(VideoAdminInfoVO.create(videoInfo)); |
| | | voList.add(VideoAdminInfoVO.create(videoInfo,resourceMap)); |
| | | count = dto.getTotalCount(); |
| | | } else { |
| | | list = classService.getTypeVideoListAdmin(videotype == 0 ? "" : videotype + "", page, key, |
| | |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.juhe.YouKuService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeRecommendSpecialService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.service.manager.VideoPlayStatisticManager; |
| | | import com.yeshi.buwan.tencent.TencentVideoUtil; |
| | |
| | | private HomeAdService homeAdService; |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | |
| | | @Resource |
| | | private HomeVideoService homeVideoService; |
| | | |
| | | @Resource |
| | | private DetailSystemConfigService configService; |
| | | @Resource |
| | |
| | | |
| | | long bigPictureCount = homeType.isBigPicture() ? 1 : 0;// homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, true); |
| | | |
| | | List<HomeVideo> homeVideoList = homeTypeService.getHomeVideoList(homeType.getId(), resourceKey, resourceList, null, 1, homeType.getNumber() + (int) bigPictureCount); |
| | | List<HomeVideo> homeVideoList = homeVideoService.getHomeVideoList(homeType.getId(), resourceKey, resourceList, null, 1, homeType.getNumber() + (int) bigPictureCount); |
| | | if (bigPictureCount > 0 && homeVideoList.size() > 0) { |
| | | homeVideoList.get(0).setBigPicture(true); |
| | | } |
| | | long videoCount = homeTypeService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null); |
| | | long videoCount = homeVideoService.getHomeVideoListCount(homeType.getId(), resourceKey, resourceList, null); |
| | | |
| | | if (videoCount - bigPictureCount > homeType.getNumber()) { |
| | | while ((videoCount - bigPictureCount) % homeType.getNumber() != 0) { |
| | |
| | | List<HomeVideo> bigPictureVideos = new ArrayList<>(); |
| | | |
| | | if (homeType.isBigPicture()) { |
| | | bigPictureVideos = homeTypeService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, null, 1, 1); |
| | | bigPictureVideos = homeVideoService.getHomeVideoList(homeTypeId, org.yeshi.utils.StringUtil.concat(resourceList, ","), resourceList, null, 1, 1); |
| | | if (bigPictureVideos != null && bigPictureVideos.size() > 0) |
| | | bigPictureVideos.get(0).setBigPicture(true); |
| | | } |
| | |
| | | JSONObject object = new JSONObject(); |
| | | String resourceKey = StringUtil.Md5(org.yeshi.utils.StringUtil.concat(resourceList, ",")); |
| | | |
| | | Long count = homeTypeService.getHomeVideoListCount(homeTypeId, resourceKey, resourceList, null); |
| | | Long count = homeVideoService.getHomeVideoListCount(homeTypeId, resourceKey, resourceList, null); |
| | | if (count - bigPictureVideos.size() > homeType.getNumber()) { |
| | | |
| | | while ((count - bigPictureVideos.size()) % homeType.getNumber() != 0) { |
| | |
| | | } |
| | | |
| | | |
| | | List<HomeVideo> list1 = homeTypeService.getHomeVideoList(homeTypeId, resourceKey, resourceList, homeType.isBigPicture(), page, homeType.getNumber()); |
| | | List<HomeVideo> list1 = homeVideoService.getHomeVideoList(homeTypeId, resourceKey, resourceList, homeType.isBigPicture(), page, homeType.getNumber()); |
| | | List<HomeVideo> list = new ArrayList<>(); |
| | | list.addAll(bigPictureVideos); |
| | | list.addAll(list1); |
| | |
| | | |
| | | List<HomeVideo> homeVideoList = homeTypeService.getVideoByTypes(type, pageIndex, detailSystem); |
| | | |
| | | List<VideoInfo> list = new ArrayList<VideoInfo>(); |
| | | List<VideoInfo> list = new ArrayList<>(); |
| | | for (int i = 0; i < homeVideoList.size(); i++) { |
| | | HomeVideo hv = (HomeVideo) homeVideoList.get(i); |
| | | if (acceptData.getPackageName().contains("doudou")) { |
| | |
| | | @Expose |
| | | private Boolean bigPicture;//是否为大图显示 |
| | | |
| | | @Expose |
| | | private String videoId; |
| | | |
| | | public String getVideoId() { |
| | | return videoId; |
| | | } |
| | | |
| | | public void setVideoId(String videoId) { |
| | | this.videoId = videoId; |
| | | } |
| | | |
| | | public Boolean getBigPicture() { |
| | | return bigPicture; |
| | | } |
| | |
| | | |
| | | // 电视剧解析 |
| | | public static List<FunTVTVAlbum> parseTVListAlbum(String protocolXML) { |
| | | List<FunTVTVAlbum> videoList = new ArrayList<FunTVTVAlbum>(); |
| | | List<FunTVTVAlbum> videoList = new ArrayList<>(); |
| | | try { |
| | | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
| | | DocumentBuilder builder = factory.newDocumentBuilder(); |
| | |
| | | |
| | | // 综艺解析 |
| | | public static List<FunTVShowAlbum> parseShowListVideo(String protocolXML) { |
| | | List<FunTVShowAlbum> videoList = new ArrayList<FunTVShowAlbum>(); |
| | | List<FunTVShowAlbum> videoList = new ArrayList<>(); |
| | | try { |
| | | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
| | | DocumentBuilder builder = factory.newDocumentBuilder(); |
| | |
| | | |
| | | // 小视频解析 |
| | | public static List<FunTVShortVideo> parseShortListVideo(String protocolXML) { |
| | | List<FunTVShortVideo> videoList = new ArrayList<FunTVShortVideo>(); |
| | | List<FunTVShortVideo> videoList = new ArrayList<>(); |
| | | try { |
| | | DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); |
| | | DocumentBuilder builder = factory.newDocumentBuilder(); |
| | |
| | | } else if ("details".equalsIgnoreCase(contents.item(j).getNodeName())) { |
| | | // 详情 |
| | | NodeList videos = contents.item(j).getChildNodes(); |
| | | List<FunTVTVVideo> videoList = new ArrayList<FunTVTVVideo>(); |
| | | List<FunTVTVVideo> videoList = new ArrayList<>(); |
| | | for (int n = 0; n < videos.getLength(); n++) { |
| | | if (videos.item(n).getNodeName().equalsIgnoreCase("detail")) { |
| | | NodeList videoDetails = videos.item(n).getChildNodes(); |
| | |
| | | } else if ("details".equalsIgnoreCase(contents.item(j).getNodeName())) { |
| | | // 详情 |
| | | NodeList videos = contents.item(j).getChildNodes(); |
| | | List<FunTVCartoonVideo> videoList = new ArrayList<FunTVCartoonVideo>(); |
| | | List<FunTVCartoonVideo> videoList = new ArrayList<>(); |
| | | for (int n = 0; n < videos.getLength(); n++) { |
| | | if (videos.item(n).getNodeName().equalsIgnoreCase("detail")) { |
| | | NodeList videoDetails = videos.item(n).getChildNodes(); |
| | |
| | | } else if ("shows".equalsIgnoreCase(contents.item(j).getNodeName())) { |
| | | // 详情 |
| | | NodeList videos = contents.item(j).getChildNodes(); |
| | | List<FunTVShowVideo> videoList = new ArrayList<FunTVShowVideo>(); |
| | | List<FunTVShowVideo> videoList = new ArrayList<>(); |
| | | for (int n = 0; n < videos.getLength(); n++) { |
| | | if (videos.item(n).getNodeName().equalsIgnoreCase("show")) { |
| | | NodeList videoDetails = videos.item(n).getChildNodes(); |
| | |
| | | }; |
| | | |
| | | Collections.sort(pm.getVideoList(), cp); |
| | | List<FunTVVideo> vlist = new ArrayList<FunTVVideo>(); |
| | | List<FunTVVideo> vlist = new ArrayList<>(); |
| | | |
| | | boolean isUpdate = false; |
| | | if (pm.getVideoList().size() > 0 && pv != null) |
| | |
| | | private OrderService orderService; |
| | | |
| | | |
| | | //打开华为应用市场的广告 |
| | | //取消订单 |
| | | @XxlJob("order-cancel") |
| | | public ReturnT<String> cancelOrder(String params) throws Exception { |
| | | |
| | |
| | | video = (HomeVideo) iterator.next(); |
| | | } |
| | | |
| | | public long getHomeVideoCount(String homeId) { |
| | | |
| | | return homeVideoDao.getCount("from HomeVideo h where h.type.id=?", new String[]{homeId}); |
| | | } |
| | | |
| | | public long getHomeTypeVideoPage(String homeId) { |
| | | long count = getHomeVideoCount(homeId); |
| | | return count % (long) Constant.pageCount != 0L ? count / (long) Constant.pageCount + 1L |
| | | : count / (long) Constant.pageCount; |
| | | } |
| | | |
| | | public List<HomeVideo> getHomeVideoList(String homeId, int page) { |
| | | |
| | | return homeVideoDao.list( |
| | | "from HomeVideo h where h.type.id=? order by h.video.orderby desc,h.createtime desc", |
| | | (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{homeId}); |
| | | } |
| | | |
| | | public List<HomeVideo> getHomeVideoList(String homeId, String key, int page) { |
| | | return homeVideoDao.list( |
| | | "from HomeVideo h where h.type.id=? and h.video.name like ? order by h.bigPicture desc, h.video.orderby desc,h.video.watchCount desc,h.createtime desc", |
| | | (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{homeId, "%" + key + "%"}); |
| | | } |
| | | |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getHomeVideoList-'+#homeId+'-'+#resourceKey+'-'+#hasBigPicture+'-'+#page+'-'+#pageSize") |
| | | public List<HomeVideo> getHomeVideoList(String homeId, String resourceKey, List<Long> resourceIds, Boolean hasBigPicture, int page, int pageSize) { |
| | | List<HomeVideo> homeVideos = (List<HomeVideo>) homeVideoDao.excute(new HibernateCallback<List<HomeVideo>>() { |
| | | @Override |
| | | public List<HomeVideo> doInHibernate(Session session) throws HibernateException { |
| | | |
| | | List<String> rids = new ArrayList<>(); |
| | | for (Long rid : resourceIds) { |
| | | rids.add("rv.`resourceid`=" + rid); |
| | | } |
| | | |
| | | String sql = String.format("SELECT hv.* FROM wk_video_homevideo hv LEFT JOIN wk_resource_video rv ON rv.`videoid`=hv.`videoid` LEFT JOIN wk_video_video v ON v.`id`=hv.`videoid` WHERE v.show=1 and hv.`hometype`=%s AND (%s) ", homeId, org.yeshi.utils.StringUtil.concat(rids, " or ")); |
| | | |
| | | // if (bigPicture != null) { |
| | | // sql += " and hv.big_picture=" + (bigPicture ? 1 : 0); |
| | | // } |
| | | sql += " GROUP BY hv.id ORDER BY hv.big_picture desc,hv.`orderby` DESC,hv.`createtime` DESC"; |
| | | |
| | | return session.createSQLQuery(sql).addEntity(HomeVideo.class).setFirstResult((page - 1) * pageSize + (hasBigPicture!=null&&hasBigPicture ? 1 : 0)).setMaxResults(pageSize).list(); |
| | | } |
| | | }); |
| | | |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | for (HomeVideo hv : homeVideos) { |
| | | if (hv.getVideo() != null) |
| | | videoInfoList.add(hv.getVideo()); |
| | | } |
| | | videoInfoExtraService.batchExtra(videoInfoList, resourceIds); |
| | | return homeVideos; |
| | | } |
| | | |
| | | @Cacheable(value = "homeCache", key = "'getHomeVideoListCount-'+#homeId+'-'+#resourceKey+'-'+#bigPicture") |
| | | public long getHomeVideoListCount(String homeId, String resourceKey, List<Long> resourceIds, Boolean bigPicture) { |
| | | return (Long) homeVideoDao.excute(new HibernateCallback<Long>() { |
| | | @Override |
| | | public Long doInHibernate(Session session) throws HibernateException { |
| | | |
| | | List<String> rids = new ArrayList<>(); |
| | | for (Long rid : resourceIds) { |
| | | rids.add("rv.`resourceid`=" + rid); |
| | | } |
| | | |
| | | String sql = String.format("SELECT count(distinct(hv.id)) FROM wk_video_homevideo hv LEFT JOIN wk_resource_video rv ON rv.`videoid`=hv.`videoid` LEFT JOIN wk_video_video v ON v.`id`=hv.`videoid` WHERE v.show=1 and hv.`hometype`=%s AND (%s)", homeId, org.yeshi.utils.StringUtil.concat(rids, " or ")); |
| | | |
| | | if (bigPicture != null) { |
| | | sql += " and hv.big_picture=" + (bigPicture ? 1 : 0); |
| | | |
| | | } |
| | | |
| | | return Long.parseLong(session.createSQLQuery(sql).uniqueResult() + ""); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public long getHomeVideoListCount(String homeId, String key) { |
| | | return homeVideoDao.getCount("select count(*) from HomeVideo h where h.type.id=? and h.video.name like ? ", |
| | | new String[]{homeId, "%" + key + "%"}); |
| | | } |
| | | |
| | | public Serializable addHomeType(HomeType type) { |
| | | return homeTypeDao.save(type); |
| | |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | return internetSearchVideoDao.get(id); |
| | | } |
| | | |
| | | @Cacheable(value = "internetSearch", key = "'selectByPrimaryKey-'+#id") |
| | | @Override |
| | | public InternetSearchVideo selectByPrimaryKeyCache(String id) { |
| | | |
| | | return selectByPrimaryKey(id); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | list.get(0).getVideo().setTag(tag); |
| | | if (ilist != null && ilist.size() > 0) { |
| | | updateVideo = list.get(0).getVideo(); |
| | | List<VideoDetailInfo> detailList = new ArrayList<VideoDetailInfo>(); |
| | | List<VideoDetailInfo> detailList = new ArrayList<>(); |
| | | detailList.add(convertVideoinfoToDetail(album, ilist.get(0))); |
| | | updateVideo.setVideoDetailList(detailList); |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.imp.recommend; |
| | | |
| | | import com.yeshi.buwan.dao.HomeVideoDao; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.yeshi.buwan.domain.video.InternetSearchVideo; |
| | | import com.yeshi.buwan.service.inter.juhe.InternetSearchVideoService; |
| | | import com.yeshi.buwan.service.inter.recommend.HomeVideoService; |
| | | import com.yeshi.buwan.service.inter.video.VideoInfoExtraService; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.NumberUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import org.hibernate.Session; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class HomeVideoServiceImpl implements HomeVideoService { |
| | | |
| | | @Resource |
| | | private HomeVideoDao homeVideoDao; |
| | | |
| | | @Resource |
| | | private VideoInfoExtraService videoInfoExtraService; |
| | | |
| | | @Resource |
| | | private InternetSearchVideoService internetSearchVideoService; |
| | | |
| | | private List<HomeVideo> betchInternetVideos(List<HomeVideo> homeVideoList) { |
| | | for (HomeVideo hv : homeVideoList) { |
| | | if (hv == null || hv.getVideo() == null || !StringUtil.isNullOrEmpty(hv.getVideoId())) { |
| | | continue; |
| | | } |
| | | if (NumberUtil.isNumeric(hv.getVideoId())) { |
| | | continue; |
| | | } |
| | | InternetSearchVideo internetSearchVideo = internetSearchVideoService.selectByPrimaryKeyCache(hv.getVideoId()); |
| | | if (internetSearchVideo != null) { |
| | | hv.setVideo(VideoInfoFactory.create(internetSearchVideo)); |
| | | } |
| | | } |
| | | |
| | | return homeVideoList; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public List<HomeVideo> getHomeVideoList(String homeId, String key, int page) { |
| | | List<HomeVideo> homeVideoList = homeVideoDao.list( |
| | | "from HomeVideo h where h.type.id=? and h.video.name like ? order by h.bigPicture desc, h.video.orderby desc,h.video.watchCount desc,h.createtime desc", |
| | | (page - 1) * Constant.pageCount, Constant.pageCount, new String[]{homeId, "%" + key + "%"}); |
| | | return betchInternetVideos(homeVideoList); |
| | | } |
| | | |
| | | @Override |
| | | public long getHomeVideoListCount(String homeId, String key) { |
| | | return homeVideoDao.getCount("select count(*) from HomeVideo h where h.type.id=? and h.video.name like ? ", |
| | | new String[]{homeId, "%" + key + "%"}); |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "homeCache", key = "'getHomeVideoList-'+#homeId+'-'+#resourceKey+'-'+#hasBigPicture+'-'+#page+'-'+#pageSize") |
| | | public List<HomeVideo> getHomeVideoList(String homeId, String resourceKey, List<Long> resourceIds, Boolean hasBigPicture, int page, int pageSize) { |
| | | List<HomeVideo> homeVideos = (List<HomeVideo>) homeVideoDao.excute((Session session) -> { |
| | | |
| | | |
| | | List<String> rids = new ArrayList<>(); |
| | | for (Long rid : resourceIds) { |
| | | rids.add("rv.`resourceid`=" + rid); |
| | | } |
| | | |
| | | String sql = String.format("SELECT hv.* FROM wk_video_homevideo hv LEFT JOIN wk_resource_video rv ON rv.`videoid`=hv.`videoid` LEFT JOIN wk_video_video v ON v.`id`=hv.`videoid` WHERE v.show=1 and hv.`hometype`=%s AND (%s) ", homeId, org.yeshi.utils.StringUtil.concat(rids, " or ")); |
| | | |
| | | sql += " GROUP BY hv.id ORDER BY hv.`orderby` DESC,hv.`createtime` DESC"; |
| | | |
| | | List<HomeVideo> homeVideoList = session.createSQLQuery(sql).addEntity(HomeVideo.class).setFirstResult((page - 1) * pageSize + (hasBigPicture != null && hasBigPicture ? 1 : 0)).setMaxResults(pageSize).list(); |
| | | |
| | | return homeVideoList; |
| | | }); |
| | | |
| | | List<VideoInfo> videoInfoList = new ArrayList<>(); |
| | | for (HomeVideo hv : homeVideos) { |
| | | if (hv.getVideo() != null) |
| | | videoInfoList.add(hv.getVideo()); |
| | | } |
| | | homeVideos = betchInternetVideos(homeVideos); |
| | | videoInfoExtraService.batchExtra(videoInfoList, resourceIds); |
| | | return betchInternetVideos(homeVideos); |
| | | } |
| | | |
| | | @Override |
| | | @Cacheable(value = "homeCache", key = "'getHomeVideoListCount-'+#homeId+'-'+#resourceKey+'-'+#bigPicture") |
| | | public long getHomeVideoListCount(String homeId, String resourceKey, List<Long> resourceIds, Boolean bigPicture) { |
| | | return (Long) homeVideoDao.excute((Session session) -> { |
| | | |
| | | List<String> rids = new ArrayList<>(); |
| | | for (Long rid : resourceIds) { |
| | | rids.add("rv.`resourceid`=" + rid); |
| | | } |
| | | |
| | | String sql = String.format("SELECT count(distinct(hv.id)) FROM wk_video_homevideo hv LEFT JOIN wk_resource_video rv ON rv.`videoid`=hv.`videoid` LEFT JOIN wk_video_video v ON v.`id`=hv.`videoid` WHERE v.show=1 and hv.`hometype`=%s AND (%s)", homeId, org.yeshi.utils.StringUtil.concat(rids, " or ")); |
| | | |
| | | if (bigPicture != null) { |
| | | sql += " and hv.big_picture=" + (bigPicture ? 1 : 0); |
| | | } |
| | | return Long.parseLong(session.createSQLQuery(sql).uniqueResult() + ""); |
| | | }); |
| | | } |
| | | } |
| | |
| | | |
| | | public InternetSearchVideo selectByPrimaryKey(String id); |
| | | |
| | | /** |
| | | * 主键查询缓存 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public InternetSearchVideo selectByPrimaryKeyCache(String id); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.service.inter.recommend; |
| | | |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface HomeVideoService { |
| | | |
| | | public List<HomeVideo> getHomeVideoList(String homeId, String key, int page); |
| | | |
| | | public long getHomeVideoListCount(String homeId, String key); |
| | | |
| | | |
| | | public List<HomeVideo> getHomeVideoList(String homeId, String resourceKey, List<Long> resourceIds, Boolean hasBigPicture, int page, int pageSize); |
| | | |
| | | public long getHomeVideoListCount(String homeId, String resourceKey, List<Long> resourceIds, Boolean hasBigPicture); |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | public class VideoAdminInfoVO { |
| | | |
| | | private String id; |
| | |
| | | private String tag; |
| | | private Integer freeType; |
| | | private String area; |
| | | private List<String> resourceList; |
| | | private String createTime; |
| | | |
| | | public String getArea() { |
| | | return area; |
| | |
| | | StringUtil.isNullOrEmpty(video.getCreatetime() + "") ? "0" : video.getCreatetime() + ""), |
| | | "yyyy-MM-dd")); |
| | | vo.setTag(video.getTag()); |
| | | vo.setCreateTime(TimeUtil.getGernalTime(video.getCreatetime(), "yyyy-MM-dd")); |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | public static VideoAdminInfoVO create(SolrAlbumVideo solrVideo) { |
| | | public static VideoAdminInfoVO create(SolrAlbumVideo solrVideo, Map<Long, String> resourceNameMap) { |
| | | VideoAdminInfoVO vo = new VideoAdminInfoVO(); |
| | | vo.setId(solrVideo.getId()); |
| | | vo.setName(solrVideo.getName()); |
| | | if (VideoConstant.isMainCategory(solrVideo.getRootVideoType())) |
| | | vo.setVpicture(solrVideo.getPicture()); |
| | | else |
| | | vo.setHpicture(solrVideo.getHpicture()); |
| | | vo.setVpicture(solrVideo.getVpicture()); |
| | | vo.setShow(solrVideo.getShow() + ""); |
| | | vo.setUpdatetime(TimeUtil.getGernalTime( |
| | | Long.parseLong( |
| | |
| | | vo.setTag(solrVideo.getTag()); |
| | | vo.setFreeType(solrVideo.getFreeType()); |
| | | vo.setArea(solrVideo.getArea()); |
| | | vo.setHpicture(solrVideo.getHpicture()); |
| | | List<String> resources = new ArrayList<>(); |
| | | if (solrVideo.getResourceIds() != null) { |
| | | String[] rids = solrVideo.getResourceIds().split(","); |
| | | for (String rid : rids) { |
| | | resources.add(resourceNameMap.get(Long.parseLong(rid))); |
| | | } |
| | | } |
| | | vo.setResourceList(resources); |
| | | vo.setCreateTime(TimeUtil.getGernalTime(Long.parseLong(solrVideo.getCreatetime()), "yyyy-MM-dd")); |
| | | return vo; |
| | | } |
| | | |
| | |
| | | public void setVpicture(String vpicture) { |
| | | this.vpicture = vpicture; |
| | | } |
| | | |
| | | public List<String> getResourceList() { |
| | | return resourceList; |
| | | } |
| | | |
| | | public void setResourceList(List<String> resourceList) { |
| | | this.resourceList = resourceList; |
| | | } |
| | | |
| | | public String getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | } |
| | |
| | | "-//Hibernate/Hibernate Mapping DTD 3.0//EN" |
| | | "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> |
| | | <hibernate-mapping package="com.yeshi.buwan.domain"> |
| | | <class name="HomeVideo" table="wk_video_homevideo"> |
| | | <class name="HomeVideo" table="wk_video_homevideo_bak"> |
| | | <id name="id" column="Id"> |
| | | <generator class="native"></generator> |
| | | </id> |
| | |
| | | |
| | | <property name="bigPicture" type="boolean" column="big_picture"></property> |
| | | |
| | | <property name="videoId" column="videoid" type="string"></property> |
| | | |
| | | |
| | | <many-to-one name="type" column="hometype" lazy="false" |
| | | |
| | | <many-to-one name="type" column="hometype" lazy="false" not-found="ignore" |
| | | unique="true"></many-to-one> |
| | | <many-to-one name="video" column="videoid" lazy="false" |
| | | <many-to-one name="video" column="videoid" lazy="false" not-found="ignore" update="false" insert="false" |
| | | unique="true"></many-to-one> |
| | | <many-to-one name="admin" column="adminid" lazy="false"></many-to-one> |
| | | |
| | |
| | | memoryStoreEvictionPolicy="LRU" /> |
| | | |
| | | |
| | | <cache name="internetSearch" maxElementsInMemory="1000" |
| | | maxElementsOnDisk="10000" eternal="false" timeToIdleSeconds="1200" |
| | | timeToLiveSeconds="1200" overflowToDisk="true" |
| | | memoryStoreEvictionPolicy="LRU" /> |
| | | |
| | | |
| | | </ehcache> |
| | |
| | | #hometype-sure div { |
| | | margin-bottom: 20px; |
| | | } |
| | | |
| | | .video { |
| | | height: 100px !important; |
| | | } |
| | | |
| | | .video .cover-h { |
| | | height: 100px; |
| | | max-width: 180px; |
| | | } |
| | | |
| | | .video .cover-v { |
| | | height: 100px; |
| | | } |
| | | |
| | | .video tr td { |
| | | text-align: center; |
| | | } |
| | | |
| | | .video .title { |
| | | background: #1DC7EA; |
| | | color: #006dcc; |
| | | border-radius: 5px; |
| | | height: 100px; |
| | | padding: 2px 5px; |
| | | } |
| | | |
| | | .video .resource { |
| | | background: #EEEEEE; |
| | | color: #666666; |
| | | border-radius: 5px; |
| | | height: 100px; |
| | | padding: 2px 5px; |
| | | } |
| | | </style> |
| | | </head> |
| | | |
| | |
| | | </label> |
| | | </div> |
| | | </div> |
| | | <button class="btn btn-warning pl-del" type="button">批量删除</button> |
| | | <button class="btn btn-primary pl-addrecommend" type="button">添加推荐</button> |
| | | <button class="btn btn-primary pl-addspecial" type="button">添加到合辑</button> |
| | | <button class="btn btn-primary pl-addtop" type="button">添加到榜首</button> |
| | | <button class="btn btn-warning pl-del" type="button" v-on:click="deleteItems">批量删除</button> |
| | | <button class="btn btn-primary pl-addrecommend" type="button" v-on:click="addToRecommends">添加推荐</button> |
| | | <button class="btn btn-primary pl-addspecial" type="button" v-on:click="addToSpecials" >添加到合辑</button> |
| | | <button class="btn btn-primary pl-addtop" type="button" v-on:click="addToTops">添加到榜首</button> |
| | | <div class="page"> |
| | | <ul class="pagination"> |
| | | <li class="disabled pre"> |
| | |
| | | <thead> |
| | | <th width="7%">选择</th> |
| | | <th width="7%">编号</th> |
| | | <th width="12%">横版封面</th> |
| | | <th width="8%">竖版封面</th> |
| | | <th width="17%">标题</th> |
| | | <th width="8%">来源</th> |
| | | <th width="12%">时间</th> |
| | | <th width="12%">标签</th> |
| | | <th width="5%">区域</th> |
| | | <th width="12%">封面</th> |
| | | <th width="17%">名称</th> |
| | | <th width="15%">更新时间</th> |
| | | <th width="8%">是否显示</th> |
| | | <th width="4%">显示</th> |
| | | <th width="8%">操作</th> |
| | | <th width="7%">删除</th> |
| | | <th width="7%">编辑</th> |
| | | </thead> |
| | | <tbody> |
| | | <tr style="display: none;"> |
| | | <tr v-for="(item,index) in videos" class="video"> |
| | | <td width="7%"> |
| | | <div class="xuanze"> |
| | | <label> <input type="checkbox" class="check-item" |
| | | <label> <input type="checkbox" class="check-item" v-bind:key="item.id" |
| | | value="#"> |
| | | </label> |
| | | </div> |
| | | </td> |
| | | <td width="7%"> |
| | | <div class="bianhao videoid">623</div> |
| | | <div class="bianhao videoid">{{item.id}}</div> |
| | | </td> |
| | | <td width="12%"> |
| | | <div class="area" style="text-align: center;line-height: 105px;"></div> |
| | | </td> |
| | | <td width="12%"> |
| | | <div class="tupian-banner" style="position: relative"> |
| | | <img alt src="image/banner/青云志.jpg" class="video-img"> |
| | | |
| | | <span style="position: absolute;right: 2px;bottom: 2px;color: red" class="tag"></span> |
| | | |
| | | <img src="image/icon_vip.png" |
| | | style="position: absolute;right: 0px;top: 0px;height: 40px;" |
| | | class="vip"/> |
| | | </div> |
| | | </td> |
| | | <td width="17%"> |
| | | <div class="bianhao video-name"></div> |
| | | </td> |
| | | <td width="15%" style="text-align: center; line-height: 105px;" class="video-updatetime"> |
| | | 2016-09-27 |
| | | <img v-bind:src="item.hpicture" class="cover-h"> |
| | | </td> |
| | | <td width="8%"> |
| | | <img v-bind:src="item.vpicture" class="cover-v"> |
| | | </td> |
| | | <td width="17%"> |
| | | <div class="title">{{item.name}}</div> |
| | | </td> |
| | | <td width="8%"> |
| | | <div class="resource"> |
| | | <div v-for="resource in item.resourceList">{{resource}}</div> |
| | | </div> |
| | | </td> |
| | | |
| | | <td width="12%"> |
| | | <div> |
| | | 创建:{{item.createTime}}<br> |
| | | 更新:{{item.updatetime}} |
| | | </div> |
| | | </td> |
| | | |
| | | <td width="8%"> |
| | | <div> |
| | | {{item.tag}} |
| | | </div> |
| | | </td> |
| | | <td width="8%"> |
| | | <div> |
| | | {{item.area}} |
| | | </div> |
| | | </td> |
| | | |
| | | <td width="4%"> |
| | | <div class="xuanze"> |
| | | <label> <input type="checkbox" value="#" class="video-show"> |
| | | <label> <input type="checkbox" value="#" class="video-show" v-bind:checked="item.show" |
| | | v-on:click="changeShow($event,item.id)"> |
| | | </label> |
| | | </div> |
| | | </td> |
| | | <td width="8%"> |
| | | <div class="bianhao addrecommend"> |
| | | <a href="javascript:void(0)">添加推荐</a> |
| | | <a href="javascript:void(0)" v-on:click="addRecommend(item)">添加<br>推荐</a> |
| | | </div> |
| | | </td> |
| | | <td width="7%"> |
| | | <div class="anniu"> |
| | | <img src="image/dustbin.png" class="delete"> |
| | | |
| | | <img src="image/dustbin.png" class="delete" v-on:click="deleteItem(index,item.id)"> |
| | | </div> |
| | | </td> |
| | | <td width="7%"> |
| | | <div class="anniu"> |
| | | <a key="370" target="_blank" class="edit"><img src="image/bianji.png"></a> |
| | | <a key="370" target="_blank" class="edit" |
| | | v-bind:href="'edit-lmneirong-video.html?id='+item.id"><img |
| | | src="image/bianji.png"></a> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | |
| | | </label> |
| | | </div> |
| | | </div> |
| | | <button class="btn btn-warning pl-del" type="button">批量删除</button> |
| | | <button class="btn btn-primary pl-addrecommend" type="button">添加推荐</button> |
| | | <button class="btn btn-primary pl-addspecial" type="button">添加到合辑</button> |
| | | <button class="btn btn-primary pl-addtop" type="button">添加到榜首</button> |
| | | <button class="btn btn-warning pl-del" type="button" v-on:click="deleteItems">批量删除</button> |
| | | <button class="btn btn-primary pl-addrecommend" type="button" v-on:click="addToRecommends">添加推荐</button> |
| | | <button class="btn btn-primary pl-addspecial" type="button" v-on:click="addToSpecials">添加到合辑</button> |
| | | <button class="btn btn-primary pl-addtop" type="button" v-on:click="addToTops">添加到榜首</button> |
| | | |
| | | <div class="page"> |
| | | <ul class="pagination"> |
| | |
| | | <script src="js/bootstrap.min.js"></script> |
| | | <script src="js/page.js"></script> |
| | | <script src="js/common.js"></script> |
| | | <script src="js/vue.min.js"></script> |
| | | <script src="layer/layer.js"></script> |
| | | <script> |
| | | $(function () { |
| | | |
| | | function getCheckedItems() { |
| | | var ids = ""; |
| | | for (var i = 0; i < $(".check-item").length; i++) { |
| | | if ($(".check-item").eq(i).is(':checked')) { |
| | | ids += $(".check-item").eq(i).attr("key") + ","; |
| | | } |
| | | } |
| | | if (ids.length > 0) |
| | | ids = ids.substr(0, ids.length - 1); |
| | | return ids; |
| | | } |
| | | |
| | | $(".pl-del").click(function () { |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) { |
| | | layer.msg("请选择视频"); |
| | | return; |
| | | } |
| | | |
| | | $.post('api/video/deletevideo', { |
| | | 'id': ids |
| | | }, function (data) { |
| | | layer.msg(data.msg); |
| | | if (data.code == 0) { |
| | | $deleteElement.parent().parent().parent().remove(); |
| | | } |
| | | }, 'json'); |
| | | |
| | | }); |
| | | |
| | | $(".pl-addrecommend").click(function () { |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) |
| | | layer.msg("未选择视频"); |
| | | else { |
| | | $("#hometype .videoids").val(ids); |
| | | $("#hometype").modal("show"); |
| | | } |
| | | |
| | | }); |
| | | |
| | | $(".pl-addspecial").click(function () { |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) |
| | | layer.msg("未选择视频"); |
| | | else { |
| | | $("#special .videoids").val(ids); |
| | | $("#special").modal("show"); |
| | | } |
| | | }); |
| | | |
| | | $(".pl-addtop").click(function () { |
| | | layer.open({ |
| | | type: 1, |
| | | title: '分类选择', |
| | | shadeClose: true, |
| | | btn: ['确定', '取消'], |
| | | shade: 0.8, |
| | | area: ['400px', '300px'], |
| | | yes: function (index) { |
| | | var arr = new Array(); |
| | | $(".check-item:checked").each(function () { |
| | | var vid = $(this).attr("key"); |
| | | arr.push(vid); |
| | | }); |
| | | if (arr.length == 0) { |
| | | layer.msg("请先选择数据"); |
| | | return false; |
| | | } |
| | | var type = $("#dialog-chooselink .addType option:selected").val(); |
| | | addTop(arr, type); |
| | | layer.close(index); |
| | | $(".check-item").prop("checked", false); |
| | | }, |
| | | btn2: function (index) { |
| | | layer.close(index); |
| | | }, |
| | | content: $("#dialog-chooselink") |
| | | }); |
| | | |
| | | }); |
| | | |
| | | //获取栏目列表 |
| | | $.post('api/home/gethometypelist', {}, function (data) { |
| | |
| | | $(function () { |
| | | var htmlSrc = "<tr>" + $(".zhuti .table tbody tr").eq(0).html() + "</tr>"; |
| | | |
| | | function getData(page) { |
| | | var index = layer.load(1, { |
| | | shade: false |
| | | }) |
| | | var resourceIds = new Array(); |
| | | if ("0" != $(".search-div .resourceIds").val()) { |
| | | resourceIds.push($(".search-div .resourceIds").val()); |
| | | } |
| | | $.post('api/video/videolist', { |
| | | "page": page, |
| | | "videotype": $(".search-div .videotypes select:last").val(), |
| | | "detailsystem": $(".search-div .select-detailsystem").val(), |
| | | "type": $(".search-div .type").val(), |
| | | "contenttype": $(".contenttype").val(), |
| | | "freeType": $(".freeType").val(), |
| | | "area": $(".area").val(), |
| | | "key": $("#kw").val(), |
| | | "resourceIds": JSON.stringify(resourceIds) |
| | | }, function (data) { |
| | | layer.close(index); |
| | | if (data.code != 0) |
| | | return; |
| | | |
| | | fillPage(data.data.pageEntity, function (pageIndex) { |
| | | getData(pageIndex); |
| | | }); |
| | | //填充数据 |
| | | |
| | | $(".page-totalcount").html(data.data.pageEntity.totalCount); |
| | | |
| | | $(".zhuti .table tbody").empty(); |
| | | for (var i = 0; i < data.data.data.length; i++) { |
| | | var da = data.data.data[i]; |
| | | $(".zhuti .table tbody").append(htmlSrc); |
| | | var fk = $(".zhuti .table tbody tr").eq(i); |
| | | fk.find(".check-item").attr("key", da.id); |
| | | fk.find(".videoid").html(da.id); |
| | | fk.find(".video-name").html(da.name); |
| | | fk.find(".tag").html(da.tag); |
| | | if(da.vpicture) { |
| | | fk.find(".video-img").attr("src", da.vpicture); |
| | | fk.find(".video-img").css("width","180px"); |
| | | }else{ |
| | | fk.find(".video-img").attr("src", da.hpicture); |
| | | fk.find(".video-img").css("width","240px"); |
| | | } |
| | | |
| | | fk.find(".video-updatetime").html(da.updatetime); |
| | | if (da.show == 1) |
| | | fk.find(".video-show").attr("checked", true); |
| | | else |
| | | fk.find(".video-show").attr("checked", false); |
| | | fk.find(".video-show").attr("key", da.id); |
| | | fk.find(".addrecommend a").attr("key", da.id); |
| | | fk.find(".edit").attr("key", da.id); |
| | | fk.find(".delete").attr("key", da.id); |
| | | fk.find(".area").text(da.area); |
| | | fk.find(".edit").attr("href","edit-lmneirong-video.html?id=" + da.id); |
| | | |
| | | if (da.freeType == 1) |
| | | fk.find(".vip").css("display", "block"); |
| | | else |
| | | fk.find(".vip").css("display", "none"); |
| | | fk.css("display", "table-row"); |
| | | function getCheckedItems() { |
| | | var ids = ""; |
| | | for (var i = 0; i < $(".check-item").length; i++) { |
| | | if ($(".check-item").eq(i).is(':checked')) { |
| | | ids += $(".check-item").eq(i).attr("key") + ","; |
| | | } |
| | | } |
| | | if (ids.length > 0) |
| | | ids = ids.substr(0, ids.length - 1); |
| | | return ids; |
| | | } |
| | | |
| | | $(".table .addrecommend a").bind("click", function () { |
| | | |
| | | var app = new Vue({ |
| | | el: "#neirong", |
| | | data: { |
| | | videos: [] |
| | | }, |
| | | methods: { |
| | | addRecommend: function (video) { |
| | | //直接添加到推荐 |
| | | var key = $(this).attr("key"); |
| | | var key = video.id; |
| | | $("#hometype .videoids").val(key); |
| | | $("#hometype").modal("show"); |
| | | |
| | |
| | | // layer.close(index); |
| | | // $("#hometype").modal("show"); |
| | | // }); |
| | | }, |
| | | |
| | | }); |
| | | |
| | | $(".table .video-show").bind("click", function () { |
| | | var show = $(this).is(":checked") ? "1" : "0"; |
| | | var key = $(this).attr("key"); |
| | | changeShow: function (event, id) { |
| | | var el = event.currentTarget; |
| | | var show = $(el).is(":checked") ? "1" : "0"; |
| | | $.post('api/video/changevideoshow', { |
| | | 'id': key, |
| | | 'id': id, |
| | | 'show': show |
| | | }, function (data) { |
| | | layer.msg(data.msg); |
| | | layer.close(index); |
| | | if (data.code == 0) { |
| | | $deleteElement.parent().parent().parent().remove(); |
| | | } |
| | | }, 'json'); |
| | | }, |
| | | |
| | | }); |
| | | |
| | | $(".table .anniu .delete").bind("click", function () { |
| | | var id = $(this).attr("key"); |
| | | var $deleteElement = $(this); |
| | | deleteItem: function (index1, id) { |
| | | alert(index1); |
| | | var index = layer.confirm('是否删除该条目?', { |
| | | btn: ['是', '否'] //按钮 |
| | | }, function () { |
| | |
| | | layer.msg(data.msg); |
| | | layer.close(index); |
| | | if (data.code == 0) { |
| | | $deleteElement.parent().parent().parent().remove(); |
| | | app.videos.splice(index1, 1); |
| | | } |
| | | }, 'json'); |
| | | }, function () { |
| | | |
| | | }); |
| | | }, |
| | | |
| | | }); |
| | | getVideoList: function (page) { |
| | | var index = layer.load(1, { |
| | | shade: false |
| | | }) |
| | | var resourceIds = new Array(); |
| | | if ("0" != $(".search-div .resourceIds").val()) { |
| | | resourceIds.push($(".search-div .resourceIds").val()); |
| | | } |
| | | $.post('api/video/videolist', { |
| | | "page": page, |
| | | "videotype": $(".search-div .videotypes select:last").val(), |
| | | "detailsystem": $(".search-div .select-detailsystem").val(), |
| | | "type": $(".search-div .type").val(), |
| | | "contenttype": $(".contenttype").val(), |
| | | "freeType": $(".freeType").val(), |
| | | "area": $(".area").val(), |
| | | "key": $("#kw").val(), |
| | | "resourceIds": JSON.stringify(resourceIds) |
| | | }, function (data) { |
| | | layer.close(index); |
| | | if (data.code != 0) |
| | | return; |
| | | |
| | | // $(".table .anniu .edit").bind("click", function () { |
| | | // var id = $(this).attr("key"); |
| | | // $("#video-edit-frame").attr("src", "edit-lmneirong-video.html?id=" + id); |
| | | // $("#video-edit").modal("show") |
| | | // }); |
| | | fillPage(data.data.pageEntity, function (pageIndex) { |
| | | app.getVideoList(pageIndex); |
| | | }); |
| | | app.videos = data.data.data; |
| | | |
| | | }, 'json'); |
| | | } |
| | | |
| | | //填充数据 |
| | | $(".page-totalcount").html(data.data.pageEntity.totalCount); |
| | | }, 'json'); |
| | | |
| | | }, |
| | | |
| | | |
| | | addToRecommends: function () { |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) |
| | | layer.msg("未选择视频"); |
| | | else { |
| | | $("#hometype .videoids").val(ids); |
| | | $("#hometype").modal("show"); |
| | | } |
| | | }, |
| | | |
| | | addToSpecials: function () { |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) |
| | | layer.msg("未选择视频"); |
| | | else { |
| | | $("#special .videoids").val(ids); |
| | | $("#special").modal("show"); |
| | | } |
| | | }, |
| | | addToTops: function () { |
| | | layer.open({ |
| | | type: 1, |
| | | title: '分类选择', |
| | | shadeClose: true, |
| | | btn: ['确定', '取消'], |
| | | shade: 0.8, |
| | | area: ['400px', '300px'], |
| | | yes: function (index) { |
| | | var arr = new Array(); |
| | | $(".check-item:checked").each(function () { |
| | | var vid = $(this).attr("key"); |
| | | arr.push(vid); |
| | | }); |
| | | if (arr.length == 0) { |
| | | layer.msg("请先选择数据"); |
| | | return false; |
| | | } |
| | | var type = $("#dialog-chooselink .addType option:selected").val(); |
| | | addTop(arr, type); |
| | | layer.close(index); |
| | | $(".check-item").prop("checked", false); |
| | | }, |
| | | btn2: function (index) { |
| | | layer.close(index); |
| | | }, |
| | | content: $("#dialog-chooselink") |
| | | }); |
| | | }, |
| | | |
| | | |
| | | deleteItems: function () { |
| | | var ids = getCheckedItems(); |
| | | if (ids.length < 1) { |
| | | layer.msg("请选择视频"); |
| | | return; |
| | | } |
| | | |
| | | $.post('api/video/deletevideo', { |
| | | 'id': ids |
| | | }, function (data) { |
| | | layer.msg(data.msg); |
| | | if (data.code == 0) { |
| | | $deleteElement.parent().parent().parent().remove(); |
| | | } |
| | | }, 'json'); |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | }); |
| | | |
| | | |
| | | $(".search-div .search-button").click(function () { |
| | | getData(1); |
| | | app.getVideoList(1); |
| | | }); |
| | | |
| | | $("#special .modal-footer button:last").click(function () { |
| | |
| | | package com.hxh.spring.test; |
| | | |
| | | import com.yeshi.buwan.dao.HomeVideoDao; |
| | | import com.yeshi.buwan.domain.HomeType; |
| | | import com.yeshi.buwan.domain.HomeVideo; |
| | | import com.yeshi.buwan.service.imp.HomeTypeService; |
| | |
| | | @Resource |
| | | private HomeTypeService homeTypeService; |
| | | |
| | | @Resource |
| | | private HomeVideoDao homeVideoDao; |
| | | |
| | | |
| | | @Test |
| | | public void addTest() { |
| | |
| | | } |
| | | |
| | | |
| | | @Test |
| | | public void testHomeVideo() { |
| | | HomeVideo homeVideo = homeVideoDao.find(HomeVideo.class, "47628"); |
| | | System.out.println(homeVideo); |
| | | } |
| | | |
| | | |
| | | } |