微信小程序直播V0.2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package cn.lili.controller.other.broadcast;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
@@ -16,9 +17,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 店铺端,直播商品接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/5/17 2:05 下午
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,直播商品接口")
|
||||
@@ -37,18 +38,18 @@ public class CommodityController {
|
||||
@ApiOperation(value = "添加店铺直播商品")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> addCommodity(@Validated Commodity commodity) {
|
||||
if(commodityService.addCommodity(commodity)){
|
||||
if (commodityService.addCommodity(commodity)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除店铺直播商品")
|
||||
@DeleteMapping
|
||||
public ResultMessage<Object> delete(String goodsId) {
|
||||
if(commodityService.deleteCommodity(goodsId)){
|
||||
if (commodityService.deleteCommodity(goodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package cn.lili.controller.other.broadcast;
|
||||
|
||||
import cn.lili.common.enums.ResultCode;
|
||||
import cn.lili.common.exception.ServiceException;
|
||||
import cn.lili.common.utils.PageUtil;
|
||||
import cn.lili.common.utils.ResultUtil;
|
||||
import cn.lili.common.vo.PageVO;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.base.entity.enums.ClientTypeEnum;
|
||||
import cn.lili.modules.broadcast.entity.dos.Studio;
|
||||
import cn.lili.modules.broadcast.service.StudioService;
|
||||
import cn.lili.modules.message.util.WechatAccessTokenUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -19,9 +22,9 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 店铺端,直播间接口
|
||||
*
|
||||
* @author Bulbasaur
|
||||
* @date: 2021/5/17 2:05 下午
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "店铺端,直播间接口")
|
||||
@@ -30,6 +33,8 @@ public class StudioController {
|
||||
|
||||
@Autowired
|
||||
private StudioService studioService;
|
||||
@Autowired
|
||||
private WechatAccessTokenUtil wechatAccessTokenUtil;
|
||||
|
||||
@ApiOperation(value = "获取店铺直播间列表")
|
||||
@GetMapping
|
||||
@@ -47,10 +52,10 @@ public class StudioController {
|
||||
@ApiOperation(value = "添加直播间")
|
||||
@PostMapping
|
||||
public ResultMessage<Object> add(@Validated Studio studio) {
|
||||
if(studioService.create(studio)){
|
||||
if (studioService.create(studio)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "店铺直播间添加商品")
|
||||
@@ -59,23 +64,29 @@ public class StudioController {
|
||||
@ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path")
|
||||
})
|
||||
@PutMapping(value = "/push/{roomId}/{liveGoodsId}")
|
||||
public ResultMessage<Studio> push(@PathVariable Integer roomId,@PathVariable Integer liveGoodsId) {
|
||||
if(studioService.push(roomId,liveGoodsId)){
|
||||
public ResultMessage<Studio> push(@PathVariable Integer roomId, @PathVariable Integer liveGoodsId) {
|
||||
if (studioService.push(roomId, liveGoodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "店铺直播间删除商品")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "roomId", value = "房间ID", required = true, dataType = "Integer", paramType = "path"),
|
||||
@ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path")
|
||||
@ApiImplicitParam(name = "roomId", value = "房间ID", required = true, dataType = "Integer", paramType = "path"),
|
||||
@ApiImplicitParam(name = "liveGoodsId", value = "直播商品ID", required = true, dataType = "Integer", paramType = "path")
|
||||
})
|
||||
@Delete(value = "/deleteInRoom/{roomId}/{liveGoodsId}")
|
||||
public ResultMessage<Studio> deleteInRoom(@PathVariable Integer roomId,@PathVariable Integer liveGoodsId) {
|
||||
if(studioService.goodsDeleteInRoom(roomId,liveGoodsId)){
|
||||
public ResultMessage<Studio> deleteInRoom(@PathVariable Integer roomId, @PathVariable Integer liveGoodsId) {
|
||||
if (studioService.goodsDeleteInRoom(roomId, liveGoodsId)) {
|
||||
return ResultUtil.success(ResultCode.SUCCESS);
|
||||
}
|
||||
return ResultUtil.error(ResultCode.ERROR);
|
||||
throw new ServiceException(ResultCode.ERROR);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取素材,调用接口凭证")
|
||||
@PutMapping(value = "/getCgiAccessToken")
|
||||
public ResultMessage<Object> getCgiAccessToken() {
|
||||
return ResultUtil.data(wechatAccessTokenUtil.cgiAccessToken(ClientTypeEnum.WECHAT_MP));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user