From e5731ae5286e4d1da8d2273aace808cff4dc6781 Mon Sep 17 00:00:00 2001 From: liuyuanqiang <837052308@qq.com> Date: Wed, 26 Oct 2022 08:37:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BAservice-passenger-user?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/compiler.xml | 4 ++- .idea/encodings.xml | 1 + .../service/VerificationCodeService.java | 13 ++++++-- .../service/VerificationCodeService.class | Bin 3566 -> 4078 bytes .../common/constant/CommonStatusEnum.java | 6 ++++ .../common/constant/CommonStatusEnum.class | Bin 1552 -> 1650 bytes pom.xml | 1 + service-passenger-user/pom.xml | 30 ++++++++++++++++++ .../ServicePassengerUserApplication.java | 13 ++++++++ .../controller/TestController.java | 14 ++++++++ .../src/main/resources/application.yml | 3 ++ 11 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 service-passenger-user/pom.xml create mode 100644 service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/ServicePassengerUserApplication.java create mode 100644 service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/controller/TestController.java create mode 100644 service-passenger-user/src/main/resources/application.yml diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 0549b8a..bfff9c9 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -7,8 +7,9 @@ - + + @@ -17,6 +18,7 @@ diff --git a/.idea/encodings.xml b/.idea/encodings.xml index 075f92c..b534f82 100644 --- a/.idea/encodings.xml +++ b/.idea/encodings.xml @@ -3,6 +3,7 @@ + diff --git a/api-passenger/src/main/java/com/mashibing/apipassenger/service/VerificationCodeService.java b/api-passenger/src/main/java/com/mashibing/apipassenger/service/VerificationCodeService.java index a3047ad..fdc1c8d 100644 --- a/api-passenger/src/main/java/com/mashibing/apipassenger/service/VerificationCodeService.java +++ b/api-passenger/src/main/java/com/mashibing/apipassenger/service/VerificationCodeService.java @@ -1,10 +1,12 @@ package com.mashibing.apipassenger.service; import com.mashibing.apipassenger.remote.ServiceVefificationcodeClient; +import com.mashibing.common.constant.CommonStatusEnum; import com.mashibing.common.dto.ResponseResult; import com.mashibing.common.response.NumberCodeResponse; import com.mashibing.common.response.TokenResponse; import net.sf.json.JSONObject; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -24,7 +26,7 @@ public class VerificationCodeService { /** * 生成验证码 * @param passengerPhone - * @return + * @return ResponseResult */ public ResponseResult generatorCode(String passengerPhone){ //调用验证码服务,获取验证码 @@ -51,7 +53,7 @@ public class VerificationCodeService { * 校验验证码 * @param passengerPhone * @param verificationCode - * @return + * @return ResponseResult */ public ResponseResult checkCode(String passengerPhone, String verificationCode) { System.out.println("根据手机号和验证码,查询redis"); @@ -60,7 +62,12 @@ public class VerificationCodeService { System.out.println("code in redis:" + codeRedis); System.out.println("校验验证码"); - + if(StringUtils.isBlank(codeRedis)){ + return ResponseResult.fail(CommonStatusEnum.VERIFICATION_CODE_FAIL.getCode(),CommonStatusEnum.VERIFICATION_CODE_FAIL.getMsg()); + } + if(!verificationCode.trim().equals(codeRedis.trim())){ + return ResponseResult.fail(CommonStatusEnum.VERIFICATION_CODE_FAIL.getCode(),CommonStatusEnum.VERIFICATION_CODE_FAIL.getMsg()); + } System.out.println("判断是否有用户,没有则新增用户"); System.out.println("颁发token"); diff --git a/api-passenger/target/classes/com/mashibing/apipassenger/service/VerificationCodeService.class b/api-passenger/target/classes/com/mashibing/apipassenger/service/VerificationCodeService.class index 8b857d52a17fab5e8e9e655c692b546c3246c5ec..8a1956458dec4365dcf31a688426ff06f79af38f 100644 GIT binary patch delta 1373 zcmZ{j`%{!v7{@>F-rkp&qcf3c3=LP6OTub-2~ZRebd5_2SkeVwmIar~F0u=WWh)t( zU6r>2%(9zh7eg?CshRw}|HB{p#eblw={bwzG~=|h^F7Zw&+Yq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aRNcy@aDVL7ziWGbe3M>A!x90h`k{XKV&-hAf61()IYW+K*VAvp8?CYRE0O zlivLP=5>Ggnlje2!5}aa8VvV@yE=x$1O0hj1KpuK#X1TsMim#h=(d@;NtYCt8B?rb zt;M)vf-4qR71y|KP~blICAlxX0aGU?-S1{`)fCf;DQ+lka?2ok{?+XKwVvr+$e(||lH@)q@n2?m5PvRnk*h2TKTA5QMF-JOJ zh2-MdC?_RZh^ClL;tfhDm5M?)E@pCE*Qa5NO%|I%oM1_oNC_EiCzEPH)-P!EoFep1 z4lm8or=Vakq^F(DY>}DCG_aL2;ZZG^w@KC~Qz8f=RpnAuArVuQ5EtdqaxS7tjm@gj zXf$i2Q*VryjJ6Tv`V`st&jf=icIp9A_)8Z1#rL{1u@&QQ@dZ-n@N1tY{uAlV?^zu* z6U;!y9GMB`2NGXPxks2Gsykv!MTH=-!Y4%-1%*q6FxV}&PH?u$vQFWqv6V$uEo19l v!Y1pbqJT<|jA>aE!7IaR^X!kDP{XX~$)$fF$ diff --git a/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java b/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java index 66ee143..da08587 100644 --- a/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java +++ b/internal-common/src/main/java/com/mashibing/common/constant/CommonStatusEnum.java @@ -4,6 +4,11 @@ import lombok.Data; import lombok.Getter; public enum CommonStatusEnum { + + /** + *验证码错误 + */ + VERIFICATION_CODE_FAIL(1001,"验证码错误!"), /** * 成功 */ @@ -12,6 +17,7 @@ public enum CommonStatusEnum { * 失败 */ FAIL(0,"fail"); + @Getter private int code; @Getter diff --git a/internal-common/target/classes/com/mashibing/common/constant/CommonStatusEnum.class b/internal-common/target/classes/com/mashibing/common/constant/CommonStatusEnum.class index 437e6ecfea1560a90e97686aae5ffd4b0349968f..7a290d8984eccea98bde2c014e32dde5e9651f8b 100644 GIT binary patch delta 810 zcmZuuOK(y^6#nMkxp29R1ug~JY87eg1C{!~_oGD$ijp?*stK#6615~&O^9n`V`AdM z1UIfUao3n&sZrxAUHeBYD-(Z!@tnDAG@WGTyuNe3bIv?hzg6qUpU>X`PapXKd7i$jUt zg(REu&Qjx^LJEn_UGqsRPE!YFM;Qu`B#f36r-;EcS`rfw9Rqd683jRFVgj_5ML zL6QazQ3p9p)0-xnr66f#-y`@|1Bkmd7&4&={hqA>A^kIsY>{pMKX7V`WE)3uY>@nr zNcdF0K-S!l88iE?^AX{7sAcWiCZ#*19T9CuEz^x@+YNl99J2@I)npG5uV(e&dg~Bt dRM7t>e|=$EPlP@yPQ(G4-rqqU#|dZP#9ty*Ud#Xh delta 628 zcmZuv%TC)+5Iv5sW5>B9u?e9`fQENT3x$M7d9+XhUtmCDi4aIgSyYNx!-_SPx7~JE z2|+3$f!Yt~pLE*~K%BYGf<-Nj@0~ew=A5zoPhabUKTi+80W4xS1BIr~+meg2i)9}L ztjOzwAgl6P^ALDg_j%or{G*3{51-_^>0--*8|}ARyHWJ@%hK&lJC%JUlgb*Ou^ms@ z&Bh2?8spf}C}KdPgh6sT=f}qh$QWtxq()qm1Naz~c^G3j7Dg{c zir!$8_E(Kx2rcB!pn)_kWVuK{N{y8oy9Avy7Ud=;lbYC6W^AA^#igbhMYfk1Zx|`e z&_Nw<#XIx&JjIby{|WbpX`uE5MWvcIf{ACRCurdvW`!N!I3;5==?(tV>tW6)h|(Ts z%Cqapi-passenger service-verificationcode internal-common + service-passenger-user pom diff --git a/service-passenger-user/pom.xml b/service-passenger-user/pom.xml new file mode 100644 index 0000000..c309f2b --- /dev/null +++ b/service-passenger-user/pom.xml @@ -0,0 +1,30 @@ + + + + online-taxi-public + org.mashibing + 1.0-SNAPSHOT + + 4.0.0 + + service-passenger-user + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot + + + org.springframework.cloud + spring-cloud-commons + + + + + + \ No newline at end of file diff --git a/service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/ServicePassengerUserApplication.java b/service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/ServicePassengerUserApplication.java new file mode 100644 index 0000000..35d4bbf --- /dev/null +++ b/service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/ServicePassengerUserApplication.java @@ -0,0 +1,13 @@ +package com.mashibing.serviceDriverUser; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; + +@SpringBootApplication +@EnableDiscoveryClient +public class ServicePassengerUserApplication { + public static void main(String[] args) { + SpringApplication.run(ServicePassengerUserApplication.class); + } +} diff --git a/service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/controller/TestController.java b/service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/controller/TestController.java new file mode 100644 index 0000000..edc4869 --- /dev/null +++ b/service-passenger-user/src/main/java/com/mashibing/serviceDriverUser/controller/TestController.java @@ -0,0 +1,14 @@ +package com.mashibing.serviceDriverUser.controller; + +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; + +@RestController +public class TestController { + @GetMapping + public String test(){ + return "service-passenger-user"; + } +} diff --git a/service-passenger-user/src/main/resources/application.yml b/service-passenger-user/src/main/resources/application.yml new file mode 100644 index 0000000..ac79bd8 --- /dev/null +++ b/service-passenger-user/src/main/resources/application.yml @@ -0,0 +1,3 @@ +server: + port: 8083 +