This commit is contained in:
dimengzhe
2025-04-28 10:50:52 +08:00
parent fbbe5be935
commit 79fcf614ca
2 changed files with 37 additions and 0 deletions

View File

@@ -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());