Compare commits
7 Commits
87108a0dcd
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6166fee301 | ||
| f3b2b7e866 | |||
| 062212cffb | |||
|
|
79fcf614ca | ||
|
|
fbbe5be935 | ||
|
|
66419b39a7 | ||
|
|
e4f98271b6 |
@@ -1,8 +1,11 @@
|
|||||||
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.crm.entity.ECustomer;
|
import com.kelp.crm.entity.ECustomer;
|
||||||
import com.kelp.crm.service.ECustomerService;
|
import com.kelp.crm.service.ECustomerService;
|
||||||
import com.opensymphony.oscache.util.StringUtil;
|
import com.opensymphony.oscache.util.StringUtil;
|
||||||
@@ -14,6 +17,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class BuyController {
|
public class BuyController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IdWorker idWorker;
|
||||||
private final String prefix = "/business/buy";
|
private final String prefix = "/business/buy";
|
||||||
|
|
||||||
protected String RESULT = "result";
|
protected String RESULT = "result";
|
||||||
@@ -24,9 +30,11 @@ public class BuyController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ECustomerService customerService;
|
private ECustomerService customerService;
|
||||||
|
@Autowired
|
||||||
|
protected RedisBean redisBean;
|
||||||
|
|
||||||
@PostMapping(path = {prefix + "/{id}"})
|
@PostMapping(path = {prefix + "/{type}"})
|
||||||
public ModelMap index(@PathVariable("id") String id, Buy buy) {
|
public ModelMap index(@PathVariable("type") String type, Buy buy) {
|
||||||
|
|
||||||
ModelMap modelMap = new ModelMap();
|
ModelMap modelMap = new ModelMap();
|
||||||
ECustomer eCustomer = new ECustomer();
|
ECustomer eCustomer = new ECustomer();
|
||||||
@@ -53,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());
|
||||||
@@ -67,7 +87,8 @@ public class BuyController {
|
|||||||
} else {
|
} else {
|
||||||
buy.setCustomerId(customer.getId());
|
buy.setCustomerId(customer.getId());
|
||||||
}
|
}
|
||||||
buy.setType(id);
|
buy.setType(type);
|
||||||
|
buy.setId(idWorker.nextId());
|
||||||
buyDao.add(buy);
|
buyDao.add(buy);
|
||||||
|
|
||||||
modelMap.put(RESULT, true);
|
modelMap.put(RESULT, true);
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class EMAccountController extends BaseController {
|
|||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
account.setPassword(Md5Utils.hash("c1234567"));
|
account.setPassword(Md5Utils.hash("Yxt@67508182"));
|
||||||
accountService.add4m(account);
|
accountService.add4m(account);
|
||||||
|
|
||||||
modelMap.put(RESULT, true);
|
modelMap.put(RESULT, true);
|
||||||
@@ -103,6 +103,11 @@ public class EMAccountController extends BaseController {
|
|||||||
return modelMap;
|
return modelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String pa = Md5Utils.hash("Yxt@67508182");
|
||||||
|
System.out.println(pa);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
public @ResponseBody ModelMap update(HttpServletRequest request, EAccount account) {
|
public @ResponseBody ModelMap update(HttpServletRequest request, EAccount account) {
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ public class PAccountController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
account.setId(null);
|
account.setId(null);
|
||||||
account.setPassword(Md5Utils.hash("k1234567"));
|
account.setPassword(Md5Utils.hash("Yxt@67508182"));
|
||||||
accountService.add(account);
|
accountService.add(account);
|
||||||
|
|
||||||
modelMap.put(RESULT, true);
|
modelMap.put(RESULT, true);
|
||||||
|
|||||||
@@ -13,16 +13,24 @@ layui.use([ 'carousel', 'form' ], function() {
|
|||||||
timestamp = (new Date()).valueOf();
|
timestamp = (new Date()).valueOf();
|
||||||
var type = system_config?.captchaType || "math"; // 默认 math
|
var type = system_config?.captchaType || "math"; // 默认 math
|
||||||
var url = basePath + "/captcha/captchaImage?type=" + type + "×tamp=" + timestamp;
|
var url = basePath + "/captcha/captchaImage?type=" + type + "×tamp=" + timestamp;
|
||||||
|
console.log("点击验证码啦啦啦啦啦")
|
||||||
$(".imgcode").attr("src", url);
|
$(".imgcode").attr("src", url);
|
||||||
|
$(".imgcode").data("ts", timestamp); // 👈 存一下
|
||||||
}
|
}
|
||||||
|
|
||||||
// 页面加载时刷新验证码
|
// 页面加载时刷新验证码
|
||||||
refreshCaptcha(); // ✅ 页面加载手动刷新
|
refreshCaptcha(); // ✅ 页面加载手动刷新
|
||||||
$('#telephone').focus();
|
$('#telephone').focus();
|
||||||
|
|
||||||
// 点击验证码图片刷新
|
// 事件委托 + 每次点击时都能绑定
|
||||||
$('.imgcode').off('click').on('click', refreshCaptcha); // ✅ 点击后刷新
|
$(document).on('click', '.imgcode', function () {
|
||||||
|
console.log('验证码点击了');
|
||||||
|
var timestamp = Date.now();
|
||||||
|
var type = system_config?.captchaType || "math";
|
||||||
|
var url = basePath + "/captcha/captchaImage?type=" + type + "×tamp=" + timestamp;
|
||||||
|
$(this).attr("src", url);
|
||||||
|
$(".imgcode").data("ts", timestamp); // 👈 存一下
|
||||||
|
});
|
||||||
// 监听提交
|
// 监听提交
|
||||||
form.on('submit(login_)', function(data) {
|
form.on('submit(login_)', function(data) {
|
||||||
|
|
||||||
@@ -51,7 +59,7 @@ layui.use([ 'carousel', 'form' ], function() {
|
|||||||
"telephone":telephone,
|
"telephone":telephone,
|
||||||
"password":MD5(password),
|
"password":MD5(password),
|
||||||
"captcha":captcha,
|
"captcha":captcha,
|
||||||
"timestamp":timestamp
|
"timestamp":$(".imgcode").data("ts")
|
||||||
},
|
},
|
||||||
type : 'post',
|
type : 'post',
|
||||||
dataType : 'json',
|
dataType : 'json',
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class RichFreeMarkerView extends FreeMarkerView {
|
|||||||
protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request)
|
protected void exposeHelpers(Map<String, Object> model, HttpServletRequest request)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
|
|
||||||
String baseUrl = "http://aos.yyundong.com" + request.getContextPath();
|
String baseUrl = "http://netsafe.yxtsoft.com" + request.getContextPath();
|
||||||
// String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
|
// String baseUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
|
||||||
|
|
||||||
model.put("contextPath", request.getContextPath());
|
model.put("contextPath", request.getContextPath());
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public class InterceptorConfig extends WebMvcConfigurationSupport {
|
|||||||
public EInterceptor eInterceptor() {
|
public EInterceptor eInterceptor() {
|
||||||
return new EInterceptor();
|
return new EInterceptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
@@ -45,6 +44,7 @@ public class InterceptorConfig extends WebMvcConfigurationSupport {
|
|||||||
registry.addInterceptor(pInterceptor()).addPathPatterns("/plat/**").excludePathPatterns("/plat/index","/plat/login");
|
registry.addInterceptor(pInterceptor()).addPathPatterns("/plat/**").excludePathPatterns("/plat/index","/plat/login");
|
||||||
|
|
||||||
registry.addInterceptor(eInterceptor()).addPathPatterns("/crm/**").excludePathPatterns("/crm/index","/crm/login");
|
registry.addInterceptor(eInterceptor()).addPathPatterns("/crm/**").excludePathPatterns("/crm/index","/crm/login");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.kelp.base.Page;
|
import com.kelp.base.Page;
|
||||||
import com.kelp.crm.entity.ECustomer;
|
import com.kelp.crm.entity.ECustomer;
|
||||||
|
import com.kelp.crm.entity.Enterprise;
|
||||||
|
|
||||||
public interface ECustomerService {
|
public interface ECustomerService {
|
||||||
|
|
||||||
@@ -23,5 +24,5 @@ public interface ECustomerService {
|
|||||||
String state);
|
String state);
|
||||||
|
|
||||||
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate);
|
public Page<ECustomer> getPage4NoVisit(int pageNumber, int pageSize, String startDate, String endDate);
|
||||||
|
public ECustomer getByPhone(String phone);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,4 +26,5 @@ public interface EnterpriseService {
|
|||||||
public List<Enterprise> listTop(Long pId);
|
public List<Enterprise> listTop(Long pId);
|
||||||
public List<Enterprise> listdsub(String pId);
|
public List<Enterprise> listdsub(String pId);
|
||||||
public List<Enterprise> listdsub(String pId ,String type);
|
public List<Enterprise> listdsub(String pId ,String type);
|
||||||
|
public Enterprise getByPhone(String phone);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,11 @@ public class ECustomerServiceImpl implements ECustomerService {
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ECustomer getByPhone(String phone) {
|
||||||
|
return customerDao.get("telePhone",phone);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ECustomer> getAll(String state) {
|
public List<ECustomer> getAll(String state) {
|
||||||
return customerDao.getAll(state);
|
return customerDao.getAll(state);
|
||||||
|
|||||||
@@ -92,5 +92,10 @@ public class EnterpriseServiceImpl implements EnterpriseService {
|
|||||||
public List<Enterprise> listdsub(String pId,String type) {
|
public List<Enterprise> listdsub(String pId,String type) {
|
||||||
return enterpriseDao.listdsub(Long.valueOf(pId),type);
|
return enterpriseDao.listdsub(Long.valueOf(pId),type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enterprise getByPhone(String phone) {
|
||||||
|
return enterpriseDao.get("phone",phone);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user