工作生活

restful风格接口api

2019-07-02  本文已影响0人  jianshuqiang

一、数组传递
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);

    }
上一篇 下一篇

猜你喜欢

热点阅读