| | |
| | | |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.speak.model.dto.SpeakTtsContextDto; |
| | | import com.dji.sample.speak.model.dto.SpeakTtsFileDto; |
| | | import com.dji.sample.speak.model.dto.SpeakTtsStartDto; |
| | | import com.dji.sample.speak.service.SpeakTtsService; |
| | | import com.dji.sample.speak.util.MD5Util; |
| | | 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; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("${url.speak.prefix}${url.speak.version}") |
| | |
| | | private SpeakTtsService ttsService; |
| | | |
| | | @PostMapping("/sendContext") |
| | | public ResponseResult sendContext(@RequestBody SpeakTtsContextDto dto) { |
| | | return ResponseResult.success(ttsService.sendTtsContext(dto)); |
| | | public ResponseResult sendContext(@RequestParam String sn, @RequestParam String value,@RequestParam Integer psdk_index) { |
| | | SpeakTtsContextDto dto=new SpeakTtsContextDto(); |
| | | dto.setValue(value); |
| | | dto.setPsdk_index(psdk_index); |
| | | return ResponseResult.success(ttsService.sendTtsContext(sn,dto)); |
| | | } |
| | | @PostMapping("/startTts") |
| | | public ResponseResult ttxStart(SpeakTtsStartDto dto){ |
| | | return ResponseResult.success(ttsService.speakTtxStart(dto)); |
| | | public ResponseResult ttxStart(@RequestParam String sn,@RequestParam Integer psdk_index,@RequestBody SpeakTtsFileDto fileDto){ |
| | | SpeakTtsStartDto dto= new SpeakTtsStartDto(); |
| | | dto.setPsdk_index(psdk_index); |
| | | fileDto.setMd5(MD5Util.getMD5Checksum(fileDto.getText())); |
| | | dto.setTts(fileDto); |
| | | return ResponseResult.success(ttsService.speakTtxStart(sn,dto)); |
| | | } |
| | | |
| | | |
| | | } |