|
@@ -3,6 +3,10 @@ package com.jd.controller;
|
|
|
import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.jd.code.ConstString;
|
|
|
import com.jd.entity.PersonCode;
|
|
|
import com.jd.entity.basic.User;
|
|
@@ -11,7 +15,6 @@ import com.jd.service.FlatService;
|
|
|
import com.jd.service.UserService;
|
|
|
import com.jd.util.Blank;
|
|
|
import com.jd.util.SendUtil;
|
|
|
-import com.jd.util.SmsUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@RestController
|
|
@@ -42,8 +46,6 @@ public class FlatController {
|
|
|
private UserService userService;
|
|
|
@Resource
|
|
|
private BasicDataService basicDataService;
|
|
|
- @Resource
|
|
|
- private RedisTemplate<String, Object> redisTemplate;
|
|
|
/**
|
|
|
* 平板端-导览-登录
|
|
|
* @param account
|
|
@@ -158,8 +160,26 @@ public class FlatController {
|
|
|
String content = Convert.toStr(basicDataService.getOneBasicDataByType("SMS_CONTENT").get("data_value"));
|
|
|
String addSerial = "";
|
|
|
content = content.replace("{doing}", doing).replace("{yzm}", String.valueOf(randomInt));
|
|
|
- boolean smsResult = SmsUtil.sendHttpSms(url, ecName, apId, secretKey, mobiles, content, sign, addSerial);
|
|
|
- if (!smsResult) {
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("mobiles", mobiles);
|
|
|
+ paramMap.put("ecName", ecName);
|
|
|
+ paramMap.put("apId", apId);
|
|
|
+ paramMap.put("secretKey", secretKey);
|
|
|
+ paramMap.put("sign", sign);
|
|
|
+ paramMap.put("url", url);
|
|
|
+ paramMap.put("content", content);
|
|
|
+ paramMap.put("addSerial", addSerial);
|
|
|
+ // 发送http请求
|
|
|
+ String redirectUrl = Convert.toStr(basicDataService.getOneBasicDataByType("SMS_REDIRECTURL").get("data_value"));
|
|
|
+ System.out.println(redirectUrl);
|
|
|
+ String body = HttpRequest.post(redirectUrl).form(paramMap).execute().body();
|
|
|
+ System.err.println(body);
|
|
|
+ Boolean result = false;
|
|
|
+ if (StrUtil.isNotBlank(body)) {
|
|
|
+ JSONObject jsonObject = JSONUtil.parseObj(body);
|
|
|
+ result = jsonObject.getBool("result");
|
|
|
+ }
|
|
|
+ if (!result) {
|
|
|
return SendUtil.send(false, ConstString.SEND_FAILED);
|
|
|
}
|
|
|
// 根据手机号删除验证码
|