From ec3bccd7342b533a6580bfed01a16b55453bb1e6 Mon Sep 17 00:00:00 2001 From: "kuang.yifei@iwhalecloud.com" Date: Fri, 12 Aug 2022 15:29:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=94=80=E9=AA=8C=E8=AF=81=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../customer/CustomerPlaceController.java | 18 +++++++++++++++++- .../com/ghy/customer/domain/CustomerPlace.java | 10 ++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java index 0df8f4c6..904b410b 100644 --- a/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java +++ b/ghy-admin/src/main/java/com/ghy/web/controller/customer/CustomerPlaceController.java @@ -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("验证码错误!"); + } } /** diff --git a/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java b/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java index ff142aa5..b3f545a6 100644 --- a/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java +++ b/ghy-custom/src/main/java/com/ghy/customer/domain/CustomerPlace.java @@ -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)