美文网首页工作生活
restful风格接口api

restful风格接口api

作者: jianshuqiang | 来源:发表于2019-07-02 13:06 被阅读0次

    一、数组传递
    http://localhost:9000/im-notice/imnotice/sms/sendsms/1,2,3,4/c3d5149a8cb34ba5922b89e711621874
    其中1,2,3,4为一个数组
    代码如下

     @GetMapping("sendsms/{phoneNumbers}/{noticeTemplateId}")
        @ApiImplicitParams({
                @ApiImplicitParam(name = "phoneNumbers", value = "电话号码集合(数据类型List)", required = true, dataType = "Set"),
                @ApiImplicitParam(name = "noticeTemplateId", value = "消息模板Id", required = true, dataType = "String")
        })
        @ApiOperation(value = "发送短信消息",tags = "短信发送接口")
        public ResultUtil sendSMS(@PathVariable String[] phoneNumbers,@PathVariable String noticeTemplateId) {
            ResultUtil<BsNoticeTemplate> resultUtil = noticeTemplateService.selectById(noticeTemplateId);
            String content=resultUtil.getData().getTemplateDec();
            String sendList = String.join(",", phoneNumbers);
            Object sendResult = iimNoticeService.sendSms(sendList, content);
            return ResultUtil.success(sendResult);
    
        }
    

    相关文章

      网友评论

        本文标题:restful风格接口api

        本文链接:https://www.haomeiwen.com/subject/fhszcctx.html