//后台接口 用来获取手机验证码
@RequestMapping("/getCode")
@ResponseBodypublic Map<String, Object> getCode(HttpServletRequest request,
HttpServletResponse response) throws Exception {
this.map = new HashMap();
request.setCharacterEncoding("utf-8");
Map<String, Object> m = new HashMap<String, Object>();
m.put("mobile", request.getParameter("mobile"));
try {
// System.out.println("m------->" + m);
String mobile = m.get("mobile").toString();
int msg = (int) (Math.random() * 900000.0D + 100000.0D);
System.out.println("验证码" + msg);
String sn = "SDK-MDQ-010-00148";
String pwd = "957-41D"; //21
Client client = new Client(sn, pwd);
// 短信发送
String content = URLEncoder.encode(" 欢迎使用东汇养车App,您的验证码为:" + msg
+ ",请于5分钟内正确输入。东汇养车,让您的爱车再次进化。【东汇养车】", "utf8");// 短信签名【东汇集团】必须后置
// 签名根据自己的项目名称报备
// 报备联系QQ
// 1113434894
String result_mt = client.mdsmssend(mobile, content, "14",
"", "", "");
System.out.print(result_mt);
if (result_mt==null) {
m.put("type", 2);//短信状态失败
userService.saveSMS(m);//保存到数据库
this.map.put("message", "获取失败");
this.map.put("status", Boolean.valueOf(false));
} else {
m.put("type", 1);//短信状态成功
userService.saveSMS(m);//保存到数据库