fix: allow clerk apply without sms verification
Some checks failed
Build and Push Backend / docker (push) Failing after 5s

This commit is contained in:
irving
2025-10-26 12:21:25 -04:00
parent 0356834b88
commit 5a116eedf6
3 changed files with 23 additions and 4 deletions

View File

@@ -234,7 +234,9 @@ public class WxClerkController {
if (entity != null) {
throw new CustomException("已有申请未审核");
}
smsUtils.checkSmsCode(vo.getPhone(), vo.getSmsCode());
if (StringUtils.isNotEmpty(vo.getPhone()) && StringUtils.isNotEmpty(vo.getSmsCode())) {
smsUtils.checkSmsCode(vo.getPhone(), vo.getSmsCode());
}
entity = ConvertUtil.entityToVo(vo, PlayClerkUserReviewInfoEntity.class);
entity.setReviewState("0");

View File

@@ -44,13 +44,11 @@ public class PlayClerkUserByWxAddVo {
/**
* 手机号码区号
*/
@NotBlank(message = "手机号码区号不能为空")
private String areaCode;
/**
* 手机号码
*/
@NotBlank(message = "手机号码不能为空")
private String phone;
/**

View File

@@ -89,9 +89,28 @@ public class SmsUtils {
try {
HttpResponse response = HttpUtils.doPost(host, path, method, headers, querys, bodys);
HttpEntity entity = response.getEntity();
if (entity == null) {
log.error("send sms code failed: empty http entity, statusLine={}", response.getStatusLine());
throw new RuntimeException("发送短信验证码失败,短信服务无响应");
}
String result = EntityUtils.toString(entity, "UTF-8");
if (StringUtils.isEmpty(result)) {
log.error("send sms code failed: empty response body, statusLine={}", response.getStatusLine());
throw new RuntimeException("发送短信验证码失败,短信服务返回空响应");
}
JSONObject parsed = JSONObject.parseObject(result);
if (parsed == null) {
log.error("send sms code failed: invalid json response, statusLine={}, body={}",
response.getStatusLine(), result);
throw new RuntimeException("发送短信验证码失败,短信服务响应格式异常");
}
log.info("send sms code result:" + result);
if (!"ok".equalsIgnoreCase(JSONObject.parseObject(result).getString("status"))) {
if (!"ok".equalsIgnoreCase(parsed.getString("status"))) {
log.error("send sms code failed: status not ok, statusLine={}, body={}", response.getStatusLine(),
result);
throw new RuntimeException("发送短信验证码失败,错误信息:" + result);
}
} catch (Exception e) {