parent
3f3c322ad5
commit
f2bfef1987
@ -0,0 +1,22 @@
|
|||||||
|
package com.mashibing.apipassenger.remote;
|
||||||
|
|
||||||
|
import com.mashibing.internalcommon.dto.ResponseResult;
|
||||||
|
import com.mashibing.internalcommon.response.NumberCodeResponse;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kezhen
|
||||||
|
* @date 2023/7/12
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@FeignClient("service-verificationcode")
|
||||||
|
public interface ServiceVefificationcodeClient {
|
||||||
|
|
||||||
|
@RequestMapping(method = RequestMethod.GET,value = "/numberCode/{size}")
|
||||||
|
ResponseResult<NumberCodeResponse> getNumberCode(@PathVariable("size") int size);
|
||||||
|
}
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.mashibing.apipassenger.service;
|
||||||
|
|
||||||
|
import com.mashibing.apipassenger.remote.ServiceVefificationcodeClient;
|
||||||
|
import com.mashibing.internalcommon.dto.ResponseResult;
|
||||||
|
import com.mashibing.internalcommon.response.NumberCodeResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author kezhen
|
||||||
|
* @date 2023/7/12
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VerificationCodeService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
ServiceVefificationcodeClient serviceVefificationcodeClient;
|
||||||
|
|
||||||
|
public String generatorCode(String passengerPhone) {
|
||||||
|
// 调用验证码服务,获取验证码
|
||||||
|
ResponseResult<NumberCodeResponse> numberCodeResponse = serviceVefificationcodeClient.getNumberCode(6);
|
||||||
|
int numberCode = numberCodeResponse.getData().getNumberCode();
|
||||||
|
System.out.println("numberCode = " + numberCode);
|
||||||
|
|
||||||
|
// 存入redis
|
||||||
|
|
||||||
|
return Integer.toString(numberCode);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue