分销验证码

This commit is contained in:
kuang.yifei@iwhalecloud.com 2022-08-12 15:29:15 +08:00
parent 1ae2b1370a
commit ec3bccd734
2 changed files with 27 additions and 1 deletions

View File

@ -1,6 +1,8 @@
package com.ghy.web.controller.customer;
import java.util.List;
import com.ghy.common.utils.CacheUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -106,7 +108,21 @@ public class CustomerPlaceController extends BaseController
@ResponseBody
public AjaxResult appAdd(@RequestBody CustomerPlace customerPlace)
{
return toAjax(customerPlaceService.insertCustomerPlace(customerPlace));
if (CacheUtils.get(customerPlace.getPhone()) == null){
return AjaxResult.error("验证码无效!");
}
// 验证码校验正确
if(CacheUtils.get(customerPlace.getPhone()).toString().equals(customerPlace.getCode())){
int result = customerPlaceService.insertCustomerPlace(customerPlace);
if(result > 0){
CacheUtils.remove(customerPlace.getPhone());
return AjaxResult.success("分销申请成功!");
}else {
return AjaxResult.error("分销申请失败!");
}
}else {
return AjaxResult.error("验证码错误!");
}
}
/**

View File

@ -34,6 +34,8 @@ public class CustomerPlace extends BaseEntity
@Excel(name = "城市id")
private Long city;
public String code;
public void setId(String id)
{
this.id = id;
@ -80,6 +82,14 @@ public class CustomerPlace extends BaseEntity
return city;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)