回退短信和文件上传

This commit is contained in:
15856 2024-04-07 16:23:09 +08:00
parent ffa3c54014
commit 033f4ba75f
2 changed files with 17 additions and 14 deletions

View File

@ -63,9 +63,9 @@ public class SysFileServiceImpl implements SysFileService {
List<MultipartFile> items = (List<MultipartFile>) map.get("filePath");
MultipartFile item = items.get(0);
try {
//String url = saveFile(request, item, photoType);
AjaxResult res = fileClient.uploadFile(item);
String url = (String) res.get("msg");
String url = saveFile(request, item, photoType);
//AjaxResult res = fileClient.uploadFile(item);
//String url = (String) res.get("msg");
if (url != null) {
int words = getFileText(item);
String fileName = item.getOriginalFilename();
@ -98,9 +98,9 @@ public class SysFileServiceImpl implements SysFileService {
FileInfo file = new FileInfo();
Long userId = SecurityUtils.getLoginUser().getUserid();
try {
//String url = saveFilePic(item, fileType);
AjaxResult res = fileClient.uploadFile(item);
String url = (String) res.get("msg");
String url = saveFilePic(item, fileType);
/*AjaxResult res = fileClient.uploadFile(item);
String url = (String) res.get("msg");*/
if (url != null) {
int words = getFileText(item);
String fileName = item.getOriginalFilename();

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.system.service.impl;
import cn.hutool.http.HttpRequest;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.common.core.constant.UserConstants;
@ -66,13 +67,14 @@ public class SysSmsServiceImpl implements ISysSmsService {
if (phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号格式不正确");
}
try {
/* try {
String[] args = msg.split(",");
String body = sendMessageNew(phone,tencentSmsConfig.getTemplateId().get(0),args);
return success("发送手机号码:" + phone + ",内容:" + msg + ",返回结果:" + body);
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}*/
return sendMsgByPhone( phone, msg);
}
/**
@ -83,7 +85,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
@Override
public AjaxResult codeLogin(String phone) {
try {
/*try {
//获取六位验证码
String code = getSixBitCode();
//调用发送短信的方法
@ -93,7 +95,8 @@ public class SysSmsServiceImpl implements ISysSmsService {
return success("手机号:" + phone + ",用户登录验证码:" + code + ",返回结果:" + body);
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}*/
return sendCodeByPhone(phone,null);
}
@ -102,7 +105,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
* @param phone 手机号码
* @return AjaxResult对象
*/
/* private AjaxResult sendMsgByPhone(String phone, String msg) {
private AjaxResult sendMsgByPhone(String phone, String msg) {
// 校验手机号码
if (phone == null || phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号码不正确");
@ -120,7 +123,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}*/
}
/**
@ -128,7 +131,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
* @param phone 手机号码
* @return AjaxResult对象
*/
/* private AjaxResult sendCodeByPhone(String phone, String msg) {
private AjaxResult sendCodeByPhone(String phone, String msg) {
// 校验手机号码
if (phone == null || phone.length() != UserConstants.PHONE_DEFAULT_LENGTH_LOGIN) {
return AjaxResult.error("手机号格式错误请输入11位数字号码");
@ -152,7 +155,7 @@ public class SysSmsServiceImpl implements ISysSmsService {
} catch (Exception e) {
return AjaxResult.error("发送失败:" + e.getMessage());
}
}*/
}
/**