|
@@ -4,6 +4,7 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.validation.Valid;
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -22,6 +23,9 @@ import io.swagger.annotations.ApiOperation;
|
|
|
@RestController
|
|
|
public class SmsController {
|
|
|
|
|
|
+ @Value("${mta.debug}")
|
|
|
+ private boolean debug;
|
|
|
+
|
|
|
@Autowired
|
|
|
private SmsService smsService;
|
|
|
|
|
@@ -29,8 +33,9 @@ public class SmsController {
|
|
|
@ApiOperation(value="发送验证码")
|
|
|
@PostMapping("/sendCode")
|
|
|
public ResponseVo<Boolean> sendCode(@Valid @RequestBody SendCodeRequestVo vo, HttpServletRequest request) throws MtaException{
|
|
|
+ String ip = debug ? "119.109.18.203" : ServletUtil.getIp(request);
|
|
|
return ResponseVo.success(smsService.sendCode(vo.getPhone(), vo.getAppkey(),
|
|
|
- vo.getScene(), vo.getToken(), vo.getSessionid(), vo.getSig(), ServletUtil.getIp(request)));
|
|
|
+ vo.getScene(), vo.getToken(), vo.getSessionid(), vo.getSig(), ip));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value="发送消息")
|