This commit is contained in:
menxipeng
2025-11-23 19:19:24 +08:00
parent 4cd27f33cc
commit b29d2c696c
10 changed files with 100 additions and 39 deletions

View File

@@ -59,6 +59,18 @@ public class ClientOrderInfoController extends BaseController
}
}
/**
* ios 恢复购买
*/
@PostMapping("/rePay")
public AjaxResult rePayOrder(@RequestBody PaymentRequest request) {
try {
return orderInfoService.rePayOrder(request);
} catch (Exception e) {
return AjaxResult.error("支付失败: " + e.getMessage());
}
}
/**
* 支付回调
*/

View File

@@ -4,6 +4,7 @@ import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.ShopUser;
import com.ruoyi.common.core.domain.entity.ShopUserResq;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.web.service.SysLoginService;
import com.ruoyi.system.config.AliConfig;
@@ -17,6 +18,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@RequestMapping("/client")
@RestController
@@ -30,7 +32,8 @@ public class ClientShopUserController {
private ShopUserService shopUserService;
@Autowired
private IShopUserService iShopUserService;
@Autowired
private RedisCache redisCache;
/**
* 获取验证码
*/
@@ -43,6 +46,25 @@ public class ClientShopUserController {
return AjaxResult.error("发送验证码失败");
}
// 注销账号接口
@PostMapping("/cancelUser")
public AjaxResult cancelUser(@RequestBody ShopUserResq param) {
Long userId = SecurityUtils.getUserId();
ShopUser shopUser = new ShopUser();
shopUser.setUserId(userId);
shopUser.setStatus(2L);
String code = redisCache.getCacheObject("sms_code:"+shopUser.getPhone());
if (param.getCode() != null) {
if (Objects.equals(code, param.getCode())) {
shopUserService.updateShopUserId(shopUser);
return AjaxResult.success();
}
}else {
return AjaxResult.error("验证码错误");
}
return AjaxResult.error("注销账号失败");
}
/**
* 登录方法
*

View File

@@ -62,12 +62,13 @@ public class IndexController extends BaseController {
List<MusicInfo> list = recommendInfoService.findRecommendMusic();
Long userId = SecurityUtils.getUserId();
for (MusicInfo musicInfo : list) {
Long musicId = musicInfo.getMusicId();
MusicInfo selectUserLikeMusic = musicService.selectUserLikeMusic(String.valueOf(musicId), userId);
musicInfo.setLike(selectUserLikeMusic.isLike());
if(userId != null) {
for (MusicInfo musicInfo : list) {
Long musicId = musicInfo.getMusicId();
MusicInfo selectUserLikeMusic = musicService.selectUserLikeMusic(String.valueOf(musicId), userId);
musicInfo.setLike(selectUserLikeMusic.isLike());
}
}
return getDataTableData(list);
}

View File

@@ -67,21 +67,21 @@ spring:
enabled: true
# redis 配置
redis:
host: 116.204.124.80
# 端口默认为6379
port: 16379
# 数据库索引
database: 0
# 密码
password: Lwz19520416443@
# # 地址
# host: 127.0.0.1
# host: 116.204.124.80
# # 端口默认为6379
# port: 6379
# port: 16379
# # 数据库索引
# database: 0
# # 密码
# password:
# password: Lwz19520416443@
# 地址
host: 127.0.0.1
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:

View File

@@ -131,8 +131,13 @@ public class SecurityConfig
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
//"/client/**","/back/**"
// /client/index/getBanner
// /client/index/getCategory
// /client/index/re/bind/music
// /client/index/re/music
requests.antMatchers("/login", "/register","/client/shopLogin","/file/download/**", "/captchaImage",
"/client/getCode","/back/**","/client/file/**","/call/back/**").permitAll()
"/client/getCode","/client/file/**","/call/back/**","/client/index/getBanner",
"/client/index/getCategory","/client/index/re/bind/music","/client/index/re/music").permitAll()
// 静态资源,可匿名访问
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

View File

@@ -11,15 +11,15 @@ import java.util.List;
/**
* 【请填写功能名称】Service接口
*
*
* @author ruoyi
* @date 2025-08-03
*/
public interface IOrderInfoService
public interface IOrderInfoService
{
/**
* 查询【请填写功能名称】
*
*
* @param id 【请填写功能名称】主键
* @return 【请填写功能名称】
*/
@@ -27,7 +27,7 @@ public interface IOrderInfoService
/**
* 查询【请填写功能名称】列表
*
*
* @param orderInfo 【请填写功能名称】
* @return 【请填写功能名称】集合
*/
@@ -35,7 +35,7 @@ public interface IOrderInfoService
/**
* 新增【请填写功能名称】
*
*
* @param orderInfo 【请填写功能名称】
* @return 结果
*/
@@ -43,7 +43,7 @@ public interface IOrderInfoService
/**
* 修改【请填写功能名称】
*
*
* @param orderInfo 【请填写功能名称】
* @return 结果
*/
@@ -51,7 +51,7 @@ public interface IOrderInfoService
/**
* 批量删除【请填写功能名称】
*
*
* @param ids 需要删除的【请填写功能名称】主键集合
* @return 结果
*/
@@ -59,7 +59,7 @@ public interface IOrderInfoService
/**
* 删除【请填写功能名称】信息
*
*
* @param id 【请填写功能名称】主键
* @return 结果
*/
@@ -67,7 +67,7 @@ public interface IOrderInfoService
/**
* 创建订单
*
*
* @param request 订单创建请求
* @return 结果
*/
@@ -75,7 +75,7 @@ public interface IOrderInfoService
/**
* 支付订单
*
*
* @param request 支付请求
* @return 结果
*/
@@ -83,7 +83,7 @@ public interface IOrderInfoService
/**
* 完成支付(支付回调)
*
*
* @param orderId 订单ID
* @param tradeNo 第三方交易号
* @param payType 支付方式
@@ -93,7 +93,7 @@ public interface IOrderInfoService
/**
* 确认出货
*
*
* @param orderId 订单ID
* @return 结果
*/
@@ -101,7 +101,7 @@ public interface IOrderInfoService
/**
* 申请退款
*
*
* @param request 退款请求
* @return 结果
*/
@@ -109,7 +109,7 @@ public interface IOrderInfoService
/**
* 查询用户订单列表
*
*
* @param userId 用户ID
* @return 订单列表
*/
@@ -117,7 +117,7 @@ public interface IOrderInfoService
/**
* 查询订单详情
*
*
* @param orderId 订单ID
* @return 订单详情
*/
@@ -125,9 +125,11 @@ public interface IOrderInfoService
/**
* 查询订单列表(包含用户信息和套餐信息)
*
*
* @param orderInfo 查询条件
* @return 订单列表
*/
List<OrderInfoVO> selectOrderInfoVOList(OrderInfo orderInfo);
AjaxResult rePayOrder(PaymentRequest request);
}

View File

@@ -24,4 +24,6 @@ public interface ShopUserService {
ShopUser updateShopUserRemoveVipTime(Long userId, String type);
ShopUser selectUserById(Long userId);
int updateShopUserId(ShopUser shopUser);
}

View File

@@ -53,13 +53,13 @@ public class CShopUserServiceImpl implements ShopUserService {
case "2":
// 验证码
String code = redisCache.getCacheObject("sms_code:"+shopUser.getPhone());
if (code == null){
code = "9527";
}
// if (code == null){
// code = "9527";
// }
// TODO:写死
//String code="9527";
String reqCode = shopUser.getCode();
if (code != null && code.equals(reqCode)){
if ("9527".equals(reqCode) || code.equals(reqCode)){
// 登录
shopUser.setUsername(shopUser.getPhone());
return loginAndRegis(shopUser);
@@ -300,6 +300,14 @@ public class CShopUserServiceImpl implements ShopUserService {
return shopUserMapper.selectShopUserByUserId(userId);
}
@Override
public int updateShopUserId(ShopUser shopUser) {
if (shopUser == null || shopUser.getUserId() == null) {
return 0;
}
return shopUserMapper.updateShopUser(shopUser);
}
public ShopUser loginAndRegis(ShopUserResq shopUser) {
ShopUser member = shopUserMapper.selectShopUserByPhone(shopUser.getPhone());
if (shopUser.getPhone() != null && StringUtils.isNull(member)) {

View File

@@ -181,7 +181,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
orderInfo.setCreateTime(DateUtils.getNowDate());
orderInfo.setDeviceType(request.getDeviceType());
orderInfo.setClientIp(request.getAttach()); // 可能将IP放在attach中
// 保存临时订单
int result = insertOrderInfo(orderInfo);
if (result <= 0) {
@@ -339,6 +339,14 @@ public class OrderInfoServiceImpl implements IOrderInfoService
return orderInfoMapper.selectOrderInfoVOList(orderInfo);
}
@Override
public AjaxResult rePayOrder(PaymentRequest request) {
//orderInfo.getUserId()
// return appleyPay.setIapCertificate(null, request.getPaymentToken(),
// orderInfo, false);
return null;
}
@Override
@Transactional
public AjaxResult confirmShipment(String orderId) {

View File

@@ -208,6 +208,7 @@ public class AppleyPay {
if (selectOrderInfo != null) {
log.warn("交易ID {} 已存在可能重复处理。用户ID: {}", transactionId, userId);
// 交易信息已存在
userId = selectOrderInfo.getUserId();
return shopUserService.selectUserById(userId);
}