| | |
| | | * 判定依据来自 {@code RyTask} 中通过 {@code SysDept.campusid} 查到的院区编码, |
| | | * 调用方负责把 {@code campus} 传进来;不传则保持与线上「非湖滨即吴山」一致的默认行为。 |
| | | * <p> |
| | | * 成功判定:网关返回字符串包含「处理成功」。 |
| | | * 成功判定:HTTP 200({@link ShiyiSmsApi} 返回 {@code "true"}),或响应字符串包含「处理成功」。 |
| | | * 代码来源:{@code RyTask.hzszlyy 分支}(行为保持不变)。 |
| | | */ |
| | | @Slf4j |
| | |
| | | : shiyiSmsApi.sendWushan(request.getPhone(), request.getContent()); |
| | | |
| | | log.info("【{}】市一短信发送结果({}):{}", KEY, hibin ? "湖滨" : "吴山", result); |
| | | if (StringUtils.isNotEmpty(result) && result.contains("处理成功")) { |
| | | // ⚠️ 这里必须与 /sms/sendTest 的成功判定保持一致: |
| | | // ShiyiSmsApi 底层用的是 HttpUtil.postJsonRequest,HTTP 200 时固定返回 "true" |
| | | // (非 200 会直接抛异常),并不会返回网关报文里的「处理成功」。 |
| | | // 原判断只认「处理成功」,导致 sendTest 能发、定时任务却一律判失败。 |
| | | boolean accepted = StringUtils.isNotEmpty(result) |
| | | && ("true".equalsIgnoreCase(result) || result.contains("处理成功")); |
| | | if (accepted) { |
| | | return SendResult.success(KEY, MessageChannel.SMS, result).withCode(result); |
| | | } |
| | | return SendResult.fail(KEY, MessageChannel.SMS, "短信发送失败", result).withCode(result); |