Browse Source

修改

master
dimengzhe 1 month ago
parent
commit
79fcf614ca
  1. 16
      ksafepack-admin/src/main/java/com/kelp/business/BuyController.java
  2. 21
      ksafepack-system/src/main/java/com/kelp/business/entity/Buy.java

16
ksafepack-admin/src/main/java/com/kelp/business/BuyController.java

@ -1,8 +1,10 @@
package com.kelp.business;
import com.google.code.kaptcha.Constants;
import com.kelp.business.dao.BuyDao;
import com.kelp.business.entity.Buy;
import com.kelp.common.config.RedisBean;
import com.kelp.common.utils.IdWorker;
import com.kelp.crm.entity.ECustomer;
import com.kelp.crm.service.ECustomerService;
@ -28,6 +30,8 @@ public class BuyController {
@Autowired
private ECustomerService customerService;
@Autowired
protected RedisBean redisBean;
@PostMapping(path = {prefix + "/{type}"})
public ModelMap index(@PathVariable("type") String type, Buy buy) {
@ -57,6 +61,18 @@ public class BuyController {
modelMap.put(RESULT, false);
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.setEffctiveTime(System.currentTimeMillis());
eCustomer.setExpiredTime(System.currentTimeMillis());

21
ksafepack-system/src/main/java/com/kelp/business/entity/Buy.java

@ -24,6 +24,27 @@ public class Buy extends BaseEntity {
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() {
return fuwu;
}

Loading…
Cancel
Save