package com.fdkankan.ucenter.controller.app; import com.alibaba.fastjson.JSONObject; import com.fdkankan.ucenter.common.Result; import com.fdkankan.ucenter.service.impl.AppCameraService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/app/camera") public class AppCameraController { @Autowired private AppCameraService appCameraService; @PostMapping("/getCamerasForUser") public Result getCamerasForUser(@RequestBody JSONObject param ){ String userName = param.get("userName") == null ? null : param.getString("userName"); Integer cameraType = param.get("cameraType") == null ? null : param.getInteger("cameraType"); return Result.success(appCameraService.getCameraForUser(userName,cameraType)); } /** * 绑定相机 */ @PostMapping("/bindCamera") public Result bindCamera(@RequestBody JSONObject param ){ String userName = param.get("userName") == null ? null : param.getString("userName"); String snCode = param.get("snCode") == null ? null : param.getString("snCode"); return Result.success(appCameraService.bindCamera(userName,snCode)); } /** * 解绑相机 */ @PostMapping("/unbind") public Result unbind(@RequestBody JSONObject param ){ String userName = param.get("userName") == null ? null : param.getString("userName"); String childName = param.get("childName") == null ? null : param.getString("childName"); appCameraService.unbindCamera(userName,childName); return Result.success(); } /** * 获取相机信息 */ @PostMapping("/getCameraInfo") public Result getCameraInfo(@RequestBody JSONObject param ){ String childName = param.get("childName") == null ? null : param.getString("childName"); String childPassword = param.get("childPassword") == null ? null : param.getString("childPassword"); return Result.success(appCameraService.getCameraInfo(childName,childPassword)); } }