12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package com.ym.controller;
- import com.alibaba.fastjson.JSONObject;
- import com.ym.common.BaseResponse;
- import com.ym.mec.biz.service.ImLiveBroadcastRoomService;
- import com.ym.mec.common.entity.ImUserState;
- import com.ym.service.UserService;
- import io.rong.models.user.UserModel;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- @RestController
- @RequestMapping("/user")
- public class UserController {
- private static final Logger log = LoggerFactory.getLogger(UserController.class);
- @Autowired
- private UserService userService;
- @Autowired
- private ImLiveBroadcastRoomService imLiveBroadcastRoomService;
- @RequestMapping(value = "/register", method = RequestMethod.POST)
- public Object register(@RequestBody UserModel userModel) throws Exception {
- return userService.register(userModel);
- }
- @RequestMapping(value = "/update", method = RequestMethod.POST)
- public Object update(@RequestBody UserModel userModel) throws Exception {
- return userService.update(userModel);
- }
- /**
- * 监听融云用户状态变更
- *
- * @param userState
- */
- @PostMapping(value = "/statusImUser")
- public BaseResponse statusImUser(@RequestBody List<ImUserState> userState) {
- log.info("statusImUser >>>>> : {}", JSONObject.toJSONString(userState));
- imLiveBroadcastRoomService.opsRoom(userState);
- return new BaseResponse<>();
- }
- }
|