This commit is contained in:
彭勇平 2025-03-31 14:37:13 +08:00
parent a0e8cc603a
commit bccc0204de
7 changed files with 27 additions and 11 deletions

View file

@ -62,6 +62,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import weixin.popular.api.SnsAPI;
@ -84,6 +85,9 @@ import java.util.*;
@Service("userService")
@Slf4j
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
@Value("${file.upload.url}")
public static String fileUrl = "";
@Autowired
private UserVipService userVipService;
@Autowired
@ -1054,7 +1058,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
// 配置通知栏图标
notification.setLogo("icon.png"); //配置通知栏图标需要在客户端开发时嵌入默认为push.png
// 配置通知栏网络图标
notification.setLogoUrl(commonInfoService.findOne(19).getValue() + "/logo.png");
notification.setLogoUrl(fileUrl + "/file/logo.png");
notification.setTitle(title);
notification.setBody(content);
notification.setClickType("url");

View file

@ -33,6 +33,8 @@ public class AliFileUploadController {
@Value("${file.upload.path}")
public String filePath = "";
@Value("${file.upload.url}")
public String fileUrl = "";
private final CommonInfoService commonRepository;
@ -62,12 +64,12 @@ public class AliFileUploadController {
// 关闭OSSClient
ossClient.shutdown();
// String src = commonRepository.findOne(72).getValue()+"/"+completePath;
String src = commonRepository.findOne(19).getValue()+"/img/"+completePath;
String src = fileUrl + "/img/"+completePath;
return Result.success().put("data",src);
}else{
try
{
String http = commonRepository.findOne(19).getValue();
String http = fileUrl;
String[] split = http.split("://");
// 上传文件路径
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
@ -105,11 +107,11 @@ public class AliFileUploadController {
ossClient.putObject(commonRepository.findOne(71).getValue(), completePath, inputStream);
// 关闭OSSClient
ossClient.shutdown();
return commonRepository.findOne(19).getValue()+"/img/"+completePath;
return fileUrl+"/img/"+completePath;
}else{
try
{
String http = commonRepository.findOne(19).getValue();
String http = fileUrl;
String[] split = http.split("://");
// 上传文件路径
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
@ -148,11 +150,11 @@ public class AliFileUploadController {
ossClient.putObject(commonRepository.findOne(71).getValue(), completePath, inputStream);
// 关闭OSSClient
ossClient.shutdown();
url = commonRepository.findOne(19).getValue()+"/img/"+completePath;
url = fileUrl+"/img/"+completePath;
}else{
try
{
String http = commonRepository.findOne(19).getValue();
String http = fileUrl;
String[] split = http.split("://");
// 上传文件路径
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";

View file

@ -5,6 +5,7 @@ import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
@ -32,6 +33,9 @@ public class FileUploadUtils
private static CommonInfoService commonRepository;
@Value("${file.upload.url}")
public static String fileUrl = "";
@Autowired
public void setCommonRepository(CommonInfoService commonRepository) {
FileUploadUtils.commonRepository = commonRepository;
@ -39,7 +43,7 @@ public class FileUploadUtils
public static String getDefaultBaseDir()
{
return commonRepository.findOne(19).getValue();
return fileUrl;
}
/**

View file

@ -61,6 +61,7 @@ import jodd.util.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;
@ -85,6 +86,8 @@ public class WxServiceImpl implements WxService {
private static final String TRADE_TYPE_JSAPI = "JSAPI";
private static final String Wap = "MWEB";
@Value("${file.upload.url}")
public static String fileUrl = "";
@Autowired
private CommonInfoService commonInfoService;
@ -1076,8 +1079,8 @@ public class WxServiceImpl implements WxService {
@Override
public boolean refund(String ordersNo) {
WXConfigUtil config = null;
String h5Url = commonInfoService.findOne(19).getValue().split("://")[1];
String filePath = "/www/wwwroot/" + h5Url + "/service/apiclient_cert.p12";
// String h5Url = commonInfoService.findOne(19).getValue().split("://")[1];
String filePath = fileUrl + "/service/apiclient_cert.p12";
try {
config = new WXConfigUtil(filePath);
} catch (Exception e) {

View file

@ -35,3 +35,4 @@ spring:
file:
upload:
path: /mnt/file/
url: 127.0.0.1:8080/file/

View file

@ -35,3 +35,4 @@ spring:
file:
upload:
path: /mnt/file/
url: 127.0.0.1:8080/file/

View file

@ -35,3 +35,4 @@ spring:
file:
upload:
path: /mnt/file/
url: 127.0.0.1:8080/file/