首页>代码>基于ssm的微信小程序商城综合管理后台,包括微信小程序和管理后台>/platform/platform-admin/src/main/java/com/platform/controller/ApiSmsController.java
package com.platform.controller;
import com.platform.annotation.IgnoreAuth;
import com.platform.entity.SysSmsLogEntity;
import com.platform.service.SysSmsLogService;
import com.platform.utils.DateUtils;
import com.platform.utils.R;
import com.platform.utils.RRException;
import com.platform.utils.RequestUtil;
import com.platform.utils.ResourceUtil;
import com.platform.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* 名称:ApiSmsController <br>
* 描述:Api<br>
*
* @author 李鹏军
* @version 1.0
* @since 1.0.0
*/
@RestController
@RequestMapping("api")
public class ApiSmsController {
@Autowired
private SysSmsLogService smsLogService;
/**
* 发送短信
* mobile:电话号码字符串,中间用英文逗号间隔
* content:内容字符串
* stime:追加发送时间,可为空,为空为及时发送
*/
@IgnoreAuth
@RequestMapping("/sendSms")
public R sendSms(HttpServletRequest request, @RequestParam Map<String, String> params) {
SysSmsLogEntity smsLog = new SysSmsLogEntity();
String validIP = RequestUtil.getIpAddrByRequest(request);
if (ResourceUtil.getConfigByName("sms.validIp").indexOf(validIP) < 0) {
throw new RRException("非法IP请求!");
}
smsLog.setMobile(params.get("mobile"));
smsLog.setContent(params.get("content"));
String stime = params.get("stime");
if (StringUtils.isNotEmpty(stime)) {
smsLog.setStime(DateUtils.convertStringToDate(stime));
}
SysSmsLogEntity sysSmsLogEntity = smsLogService.sendSms(smsLog);
return R.ok().put("result", sysSmsLogEntity);
}
}
最近下载更多
陈小灏 LV18
2月23日
dsffssff LV4
2024年12月17日
educationAAA LV11
2024年12月13日
zolscy LV24
2024年11月27日
WHY-small LV15
2024年11月23日
1231321321212 LV1
2024年9月18日
tangyongheng08 LV6
2024年5月23日
mariolc LV6
2024年4月3日
janly989713 LV3
2024年3月4日
n2352441 LV4
2024年3月3日
最近浏览更多
一个神秘人 LV1
10月23日
jimodeai LV15
10月21日
不爱吃香菜
10月17日
暂无贡献等级
yifeng868 LV9
9月26日
毛毛maomao LV3
7月3日
微信网友_7557768985513984
6月17日
暂无贡献等级
汤汤汤要学编程 LV11
5月6日
微信网友_7398626323435520 LV3
4月29日
18650066502 LV12
4月27日
zjjhzjb LV15
4月16日

