Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop
This commit is contained in:
commit
9fa54109b8
@ -63,7 +63,7 @@ public class UploadController {
|
||||
if (authUser == null) {
|
||||
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
|
||||
}
|
||||
Setting setting = settingService.getById(SettingEnum.OSS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException(ResultCode.OSS_NOT_EXIST);
|
||||
}
|
||||
|
@ -53,44 +53,61 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
|
||||
@Override
|
||||
public void sendSmsCode(String mobile, VerificationEnums verificationEnums, String uuid) {
|
||||
//获取短信配置
|
||||
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云短信");
|
||||
}
|
||||
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
||||
|
||||
//验证码
|
||||
String code = CommonUtil.getRandomNum();
|
||||
|
||||
switch (verificationEnums) {
|
||||
//如果某个模版需要自定义,则在此处进行调整
|
||||
case LOGIN:
|
||||
case REGISTER:
|
||||
case FIND_USER: {
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
// 验证码内容
|
||||
params.put("code", code);
|
||||
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
||||
Setting setting = settingService.getById(SettingEnum.SMS_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云短信");
|
||||
}
|
||||
SmsSetting smsSetting = new Gson().fromJson(setting.getSettingValue(), SmsSetting.class);
|
||||
this.sendSmsCode(smsSetting.getSignName(), mobile, params, "SMS_205755300");
|
||||
//模版 默认为登录验证
|
||||
String templateCode;
|
||||
|
||||
//如果某个模版需要自定义,则在此处进行调整
|
||||
switch (verificationEnums) {
|
||||
//登录
|
||||
case LOGIN: {
|
||||
templateCode = "SMS_205755300";
|
||||
break;
|
||||
}
|
||||
//注册
|
||||
case REGISTER: {
|
||||
templateCode = "SMS_205755298";
|
||||
break;
|
||||
}
|
||||
//找回密码
|
||||
case FIND_USER: {
|
||||
templateCode = "SMS_205755301";
|
||||
break;
|
||||
}
|
||||
//修改密码
|
||||
case UPDATE_PASSWORD: {
|
||||
Member member = memberService.getById(UserContext.getCurrentUser().getId());
|
||||
if (member == null || StringUtil.isEmpty(member.getMobile())) {
|
||||
return;
|
||||
}
|
||||
String memberMobile = member.getMobile();
|
||||
//准备发送短信参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
cache.put(cacheKey(verificationEnums, memberMobile, uuid), code, 300L);
|
||||
this.sendSmsCode("北京宏业汇成科技有限公司", mobile, params, "SMS_205755297");
|
||||
//更新为用户最新手机号
|
||||
mobile = member.getMobile();
|
||||
templateCode = "SMS_205755297";
|
||||
break;
|
||||
}
|
||||
//如果不是有效的验证码手段,则此处不进行短信操作
|
||||
default:
|
||||
return;
|
||||
}
|
||||
//缓存中写入要验证的信息
|
||||
cache.put(cacheKey(verificationEnums, mobile, uuid), code, 300L);
|
||||
//发送短信
|
||||
this.sendSmsCode(smsSetting.getSignName(), mobile, params, templateCode);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -314,7 +331,7 @@ public class SmsUtilAliImplService implements SmsUtil, AliSmsUtil {
|
||||
*/
|
||||
public com.aliyun.dysmsapi20170525.Client createClient() {
|
||||
try {
|
||||
Setting setting = settingService.getById(SettingEnum.SMS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.SMS_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云短信");
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class AliFileManagerPlugin implements FileManagerPlugin {
|
||||
private OssSetting getSetting() {
|
||||
//如果没有配置,或者没有下次刷新时间,或者下次刷新时间小于当前时间,则从redis 更新一次
|
||||
if (ossSetting == null || nextInitSetting == null || nextInitSetting < System.currentTimeMillis()) {
|
||||
Setting setting = settingService.getById(SettingEnum.OSS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.OSS_SETTING.name());
|
||||
if (setting == null || StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置阿里云OSS存储");
|
||||
}
|
||||
|
@ -12,7 +12,6 @@ import cn.lili.modules.system.service.SettingService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -62,7 +61,7 @@ public class GoodsGalleryServiceImpl extends ServiceImpl<GoodsGalleryMapper, Goo
|
||||
public GoodsGallery getGoodsGallery(String origin) {
|
||||
GoodsGallery goodsGallery = new GoodsGallery();
|
||||
//获取商品系统配置决定是否审核
|
||||
Setting setting = settingService.getById(SettingEnum.GOODS_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
|
||||
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
|
||||
//缩略图
|
||||
String thumbnail = fileManagerPlugin.getUrl(origin, goodsSetting.getAbbreviationPictureWidth(), goodsSetting.getAbbreviationPictureHeight());
|
||||
|
@ -68,7 +68,7 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
|
||||
* @throws Exception
|
||||
*/
|
||||
private Traces getOrderTracesByJson(String logisticsId, String expNo) throws Exception {
|
||||
Setting setting = settingService.getById(SettingEnum.KUAIDI_SETTING.name());
|
||||
Setting setting = settingService.get(SettingEnum.KUAIDI_SETTING.name());
|
||||
if (StrUtil.isBlank(setting.getSettingValue())) {
|
||||
throw new ServiceException("您还未配置快递查询");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user