perf:调整消息日志相关代码
This commit is contained in:
@@ -7,9 +7,9 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.service.TsMessageSender;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import com.tiesheng.util.service.http.OkHttpUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@@ -119,17 +119,7 @@ public class AliyunSmsSender implements TsMessageSender {
|
||||
* @param tempParam 短信模板
|
||||
* @return
|
||||
*/
|
||||
public MessageReqResp sendSms(String phoneNumbers, AliyunTempParam tempParam) {
|
||||
|
||||
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
|
||||
reqResp.setTarget(phoneNumbers);
|
||||
reqResp.setResult(1);
|
||||
reqResp.setContent(JSONUtil.createObj()
|
||||
.putOpt("PhoneNumbers", phoneNumbers)
|
||||
.putOpt("SignName", tempParam.getSignName())
|
||||
.putOpt("TemplateCode", tempParam.getTemplateCode())
|
||||
.putOpt("TemplateParam", tempParam.getTemplateParam())
|
||||
.toString());
|
||||
public ApiResp<String> sendSms(String phoneNumbers, AliyunTempParam tempParam) {
|
||||
|
||||
// 业务API参数
|
||||
ConcurrentHashMap<String, String> queryMap = new ConcurrentHashMap<>();
|
||||
@@ -140,18 +130,16 @@ public class AliyunSmsSender implements TsMessageSender {
|
||||
queryMap.put("TemplateParam", tempParam.getTemplateParam().toString());
|
||||
}
|
||||
|
||||
reqResp.setRespBody(request("SendSms", queryMap));
|
||||
JSONObject respObj = JSONUtil.parseObj(reqResp.getRespBody());
|
||||
JSONObject respObj = JSONUtil.parseObj(request("SendSms", queryMap));
|
||||
if (!Objects.equals(respObj.getStr("Code"), "OK")) {
|
||||
reqResp.setResult(0);
|
||||
reqResp.setToast(respObj.getStr("Message"));
|
||||
return ApiResp.resp130(respObj.getStr("Message"));
|
||||
}
|
||||
|
||||
return reqResp;
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public MessageReqResp send(String user, JSONObject body) {
|
||||
public ApiResp<String> send(String user, JSONObject body) {
|
||||
boolean mobile = Validator.isMobile(user);
|
||||
if (!mobile) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user