|
1
|
package com.zhonglai.luhui.order.service.controller;
|
1
|
package com.zhonglai.luhui.order.service.controller;
|
|
2
|
|
2
|
|
|
3
|
import java.util.List;
|
3
|
import java.util.List;
|
|
|
|
4
|
+import javax.servlet.http.HttpServletRequest;
|
|
4
|
import javax.servlet.http.HttpServletResponse;
|
5
|
import javax.servlet.http.HttpServletResponse;
|
|
5
|
|
6
|
|
|
|
|
7
|
+import com.ruoyi.common.utils.DESUtil;
|
|
6
|
import com.ruoyi.common.utils.DateUtils;
|
8
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
9
|
+import com.ruoyi.common.utils.StringUtils;
|
|
7
|
import io.swagger.annotations.Api;
|
10
|
import io.swagger.annotations.Api;
|
|
8
|
import io.swagger.annotations.ApiOperation;
|
11
|
import io.swagger.annotations.ApiOperation;
|
|
9
|
import org.springframework.beans.factory.annotation.Autowired;
|
12
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,7 +39,7 @@ public class ContentGroupManagementController extends BaseController |
|
@@ -36,7 +39,7 @@ public class ContentGroupManagementController extends BaseController |
|
36
|
{
|
39
|
{
|
|
37
|
@Autowired
|
40
|
@Autowired
|
|
38
|
private IContentGroupManagementService contentGroupManagementService;
|
41
|
private IContentGroupManagementService contentGroupManagementService;
|
|
39
|
-
|
42
|
+ public static String ENCODE_KEY = "com/zhonglai";
|
|
40
|
/**
|
43
|
/**
|
|
41
|
* 查询分组内容管理列表
|
44
|
* 查询分组内容管理列表
|
|
42
|
*/
|
45
|
*/
|
|
@@ -65,9 +68,34 @@ public class ContentGroupManagementController extends BaseController |
|
@@ -65,9 +68,34 @@ public class ContentGroupManagementController extends BaseController |
|
65
|
@ApiOperation("新增分组内容管理")
|
68
|
@ApiOperation("新增分组内容管理")
|
|
66
|
@Log(title = "分组内容管理", businessType = BusinessType.INSERT)
|
69
|
@Log(title = "分组内容管理", businessType = BusinessType.INSERT)
|
|
67
|
@PostMapping
|
70
|
@PostMapping
|
|
68
|
- public AjaxResult add(@RequestBody ContentGroupManagement contentGroupManagement)
|
71
|
+ public AjaxResult add(@RequestBody ContentGroupManagement contentGroupManagement, HttpServletRequest httpServletRequest)
|
|
69
|
{
|
72
|
{
|
|
|
|
73
|
+ if(StringUtils.isNoneBlank(contentGroupManagement.getPhone()))
|
|
|
|
74
|
+ {
|
|
|
|
75
|
+ String key = httpServletRequest.getHeader("key");
|
|
|
|
76
|
+ String code = httpServletRequest.getParameter("code");
|
|
|
|
77
|
+ if(org.apache.commons.lang3.StringUtils.isBlank(key) || key.equals("undefined"))
|
|
|
|
78
|
+ {
|
|
|
|
79
|
+ return AjaxResult.error("请求密钥错误");
|
|
|
|
80
|
+ }
|
|
70
|
|
81
|
|
|
|
|
82
|
+ String[] keys = DESUtil.decode(key, ENCODE_KEY).split("_");
|
|
|
|
83
|
+ Integer time = Integer.parseInt(keys[2]);
|
|
|
|
84
|
+ if((DateUtils.getNowTimeMilly()-time)>5*60)
|
|
|
|
85
|
+ {
|
|
|
|
86
|
+ return AjaxResult.success("验证码超时");
|
|
|
|
87
|
+ }
|
|
|
|
88
|
+ //code
|
|
|
|
89
|
+ if(!keys[0].equals(code))
|
|
|
|
90
|
+ {
|
|
|
|
91
|
+ return AjaxResult.success("验证码错误");
|
|
|
|
92
|
+ }
|
|
|
|
93
|
+ //phone
|
|
|
|
94
|
+ if(!keys[1].equals(contentGroupManagement.getPhone()))
|
|
|
|
95
|
+ {
|
|
|
|
96
|
+ return AjaxResult.success("手机号不一致");
|
|
|
|
97
|
+ }
|
|
|
|
98
|
+ }
|
|
71
|
contentGroupManagement.setCreate_time(DateUtils.getNowTimeMilly());
|
99
|
contentGroupManagement.setCreate_time(DateUtils.getNowTimeMilly());
|
|
72
|
contentGroupManagement.setUpdate_time(contentGroupManagement.getCreate_time());
|
100
|
contentGroupManagement.setUpdate_time(contentGroupManagement.getCreate_time());
|
|
73
|
return toAjax(contentGroupManagementService.insertContentGroupManagement(contentGroupManagement));
|
101
|
return toAjax(contentGroupManagementService.insertContentGroupManagement(contentGroupManagement));
|