- 添加短信服务 admin api

This commit is contained in:
sin-ning@aliyun.com
2019-05-27 00:24:14 +08:00
parent 5c68383abb
commit d1a793729a
8 changed files with 91 additions and 26 deletions

View File

@@ -1,5 +1,6 @@
package cn.iocoder.mall.admin.application.controller.admins;
import cn.iocoder.common.framework.vo.CommonResult;
import cn.iocoder.mall.admin.api.SmsService;
import cn.iocoder.mall.admin.api.bo.sms.PageSmsTemplateBO;
import cn.iocoder.mall.admin.api.dto.sms.PageQuerySmsSignDTO;
@@ -9,10 +10,7 @@ import cn.iocoder.mall.admin.application.po.sms.SmsTemplateUpdatePO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* 短信服务
@@ -21,33 +19,34 @@ import org.springframework.web.bind.annotation.RestController;
* @time 2019/5/26 12:26 PM
*/
@RestController
@RequestMapping("sms/template")
@RequestMapping("admins/sms/template")
@Api("短信服务(短信模板)")
public class SmsTemplateController {
@Autowired
private SmsService smsService;
@PostMapping("page")
@GetMapping("page")
@ApiOperation("短信模板-page")
public PageSmsTemplateBO pageSign(PageQuerySmsTemplateDTO pageQuerySmsTemplateDTO) {
return smsService.pageSmsTemplate(pageQuerySmsTemplateDTO);
public CommonResult<PageSmsTemplateBO> pageSign(PageQuerySmsTemplateDTO pageQuerySmsTemplateDTO) {
return CommonResult.success(smsService.pageSmsTemplate(pageQuerySmsTemplateDTO));
}
@PostMapping("add")
@ApiOperation("短信模板-添加")
public void addSign(SmsTemplateAddPO smsTemplateAddPO) {
public CommonResult addSign(SmsTemplateAddPO smsTemplateAddPO) {
smsService.addTemplate(
smsTemplateAddPO.getSmsSignId(),
smsTemplateAddPO.getTemplateCode(),
smsTemplateAddPO.getTemplate(),
smsTemplateAddPO.getPlatform(),
smsTemplateAddPO.getSmsType());
return CommonResult.success(null);
}
@PostMapping("update")
@PutMapping("update")
@ApiOperation("短信模板-更新")
public void updateSign(SmsTemplateUpdatePO smsTemplateUpdatePO) {
public CommonResult updateSign(SmsTemplateUpdatePO smsTemplateUpdatePO) {
smsService.updateTemplate(
smsTemplateUpdatePO.getId(),
smsTemplateUpdatePO.getSmsSignId(),
@@ -55,11 +54,13 @@ public class SmsTemplateController {
smsTemplateUpdatePO.getTemplate(),
smsTemplateUpdatePO.getPlatform(),
smsTemplateUpdatePO.getSmsType());
return CommonResult.success(null);
}
@PostMapping("deleted")
@DeleteMapping("deleted")
@ApiOperation("短信模板-删除")
public void deletedSign(@RequestParam("id") Integer id) {
public CommonResult deletedSign(@RequestParam("id") Integer id) {
smsService.deleteTemplate(id);
return CommonResult.success(null);
}
}