ifish_english/src/main/java/com/ifish/controller/LiveRoom.java

125 lines
3.6 KiB
Java

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.controller;
import com.ifish.bean.Tbl_Live_Message;
import com.ifish.bean.Tbl_Live_Room;
import com.ifish.enums.ResultEnum;
import com.ifish.helper.LiveRoomHelperI;
import com.ifish.util.IfishUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Administrator
*/
@RestController
public class LiveRoom {
@Autowired
private LiveRoomHelperI liveRoomHelperI;
/**
* 新增直播间
*
* @param liveRoom
* @param fileUpload
* @return
*/
@RequestMapping(value = "/liveRoom/v3/addLiveRoom.do", method = RequestMethod.POST)
public Object addLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
try {
return liveRoomHelperI.addLiveRoom(fileUpload, liveRoom);
} catch (Exception e) {
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 直播间点赞
*
* @param roomId
* @param userId
* @return
*/
@RequestMapping(value = "/liveRoomZan/{roomId}/{userId}", method = RequestMethod.POST)
public Object liveRoomsZan(@PathVariable Integer roomId, @PathVariable Integer userId) {
try {
return liveRoomHelperI.liveRoomsZan(roomId, userId);
} catch (Exception e) {
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 直播间留言
*
* @param liveMessage
* @return
*/
@RequestMapping(value = "/liveRoom/v3/leaveMessage.do", method = RequestMethod.POST)
public Object leaveMessage(Tbl_Live_Message liveMessage) {
try {
return liveRoomHelperI.leaveMessage(liveMessage);
} catch (Exception e) {
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 获取直播间信息
*
* @param roomId
* @return
*/
@RequestMapping(value = "/liveRoom/v3/getLiveRoomInfo.do", method = RequestMethod.GET)
public Object getLiveRoomInfo(Integer userId) {
try {
return liveRoomHelperI.getLiveRoomInfo(userId);
} catch (Exception e) {
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 获取直播列表
*
* @param firstResult
* @param pageSize
* @return
*/
@RequestMapping(value = "/liveRoom/v3/getLiveRooms.do", method = RequestMethod.GET)
public Object getLiveRooms(Integer firstResult, Integer pageSize, String orders) {
try {
return liveRoomHelperI.getLiveRooms(firstResult, pageSize, orders);
} catch (Exception e) {
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 修改直播间
*
* @param fileUpload
* @param liveRoom
* @return
*/
@RequestMapping(value = "/liveRoom/v3/updateLiveRoom.do", method = RequestMethod.GET)
public Object updateLiveRoom(MultipartFile fileUpload, Tbl_Live_Room liveRoom) {
try {
return liveRoomHelperI.updateLiveRoom(fileUpload, liveRoom);
} catch (Exception e) {
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
}