You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.3 KiB
72 lines
2.3 KiB
package com.cweb.controller;
|
|
|
|
import com.hai.common.exception.ErrorCode;
|
|
import com.hai.common.exception.ErrorHelp;
|
|
import com.hai.common.exception.SysCode;
|
|
import com.hai.common.utils.ResponseMsgUtil;
|
|
import com.hai.config.MessageConfig;
|
|
import com.hai.model.ResponseData;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.io.filefilter.IOFileFilter;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
@Controller
|
|
@Api(value = "短信接口")
|
|
@RequestMapping(value = "/SendSms")
|
|
public class SendSmsController {
|
|
|
|
private static Logger log = LoggerFactory.getLogger(SendSmsController.class);
|
|
|
|
@Resource
|
|
private MessageConfig messageConfig;
|
|
|
|
@RequestMapping(value = "/sendSmsCodeByHw", method = RequestMethod.GET)
|
|
@ApiOperation(value = "发送短信验证码")
|
|
@ResponseBody
|
|
public ResponseData sendSmsCode(@RequestParam(value = "phone", required = true) String phone,
|
|
@RequestParam(value = "HWMSG", required = true) Integer HWMSG) {
|
|
try {
|
|
|
|
String smsMsgId;
|
|
|
|
switch (HWMSG) {
|
|
case 1 :
|
|
smsMsgId = MessageConfig.HWMSG_ID1;
|
|
break;
|
|
case 2 :
|
|
smsMsgId = MessageConfig.HWMSG_ID2;
|
|
break;
|
|
case 3 :
|
|
smsMsgId = MessageConfig.HWMSG_ID3;
|
|
break;
|
|
case 5 :
|
|
smsMsgId = MessageConfig.HWMSG_ID5;
|
|
break;
|
|
default :
|
|
smsMsgId = "错误";
|
|
}
|
|
|
|
if (HWMSG > 3) {
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂无当前模版");
|
|
}
|
|
|
|
return ResponseMsgUtil.success(messageConfig.sendSmsCodeHw(phone , smsMsgId));
|
|
} catch (Exception e) {
|
|
log.error("CmsContentController --> sendSmsCode() error!", e);
|
|
return ResponseMsgUtil.exception(e);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|