修改
This commit is contained in:
@@ -1,8 +1,10 @@
|
|||||||
package com.kelp.business;
|
package com.kelp.business;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.code.kaptcha.Constants;
|
||||||
import com.kelp.business.dao.BuyDao;
|
import com.kelp.business.dao.BuyDao;
|
||||||
import com.kelp.business.entity.Buy;
|
import com.kelp.business.entity.Buy;
|
||||||
|
import com.kelp.common.config.RedisBean;
|
||||||
import com.kelp.common.utils.IdWorker;
|
import com.kelp.common.utils.IdWorker;
|
||||||
import com.kelp.crm.entity.ECustomer;
|
import com.kelp.crm.entity.ECustomer;
|
||||||
import com.kelp.crm.service.ECustomerService;
|
import com.kelp.crm.service.ECustomerService;
|
||||||
@@ -28,6 +30,8 @@ public class BuyController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ECustomerService customerService;
|
private ECustomerService customerService;
|
||||||
|
@Autowired
|
||||||
|
protected RedisBean redisBean;
|
||||||
|
|
||||||
@PostMapping(path = {prefix + "/{type}"})
|
@PostMapping(path = {prefix + "/{type}"})
|
||||||
public ModelMap index(@PathVariable("type") String type, Buy buy) {
|
public ModelMap index(@PathVariable("type") String type, Buy buy) {
|
||||||
@@ -57,6 +61,18 @@ public class BuyController {
|
|||||||
modelMap.put(RESULT, false);
|
modelMap.put(RESULT, false);
|
||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String timestamp = buy.getTimestamp();
|
||||||
|
String captcha = buy.getCaptcha();
|
||||||
|
if(!StringUtil.isEmpty(timestamp)){
|
||||||
|
String captcha_ = redisBean.hget(Constants.KAPTCHA_SESSION_KEY, timestamp);
|
||||||
|
if(captcha_ == null || !captcha_.equals(captcha)) {
|
||||||
|
modelMap.put(RESULT, false);
|
||||||
|
modelMap.put(MESSAGE, "验证码不正确或已过期!");
|
||||||
|
return modelMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
eCustomer.setTelephone(telephone);
|
eCustomer.setTelephone(telephone);
|
||||||
eCustomer.setEffctiveTime(System.currentTimeMillis());
|
eCustomer.setEffctiveTime(System.currentTimeMillis());
|
||||||
eCustomer.setExpiredTime(System.currentTimeMillis());
|
eCustomer.setExpiredTime(System.currentTimeMillis());
|
||||||
|
|||||||
@@ -24,6 +24,27 @@ public class Buy extends BaseEntity {
|
|||||||
|
|
||||||
private String fuwu;
|
private String fuwu;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private String captcha;
|
||||||
|
@Transient
|
||||||
|
private String timestamp;
|
||||||
|
|
||||||
|
public String getCaptcha() {
|
||||||
|
return captcha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCaptcha(String captcha) {
|
||||||
|
this.captcha = captcha;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(String timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
public String getFuwu() {
|
public String getFuwu() {
|
||||||
return fuwu;
|
return fuwu;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user