Commit 6d435a63 authored by xuxin's avatar xuxin

添加代码注释

parent 28818ddf
......@@ -248,13 +248,16 @@ public class AccountController {
}
/**
* 账户充值
* 使用微信进行账户充值
*/
@RequestMapping(path = "/0xwxpayputorder/{amount}", method = RequestMethod.GET)
public UserPaymentDto wechatPayCallback(Principal principal, @PathVariable int amount) {
return paymentService.wxPutPayOrder(principal.getName(), amount);
}
/**
* 使用微信进行账户充值成功后,微信会调用该接口
*/
@RequestMapping(path = "/0xwxpaycallback/{tradno}", method = RequestMethod.GET)
public String wechatPayCallback(@PathVariable String tradno) {
return paymentService.wechatPayCallback(tradno);
......
......@@ -67,8 +67,14 @@ public class Account {
*/
private int permission = -1;
/**
* 注册成功后,当前用户的邀请码,用于邀请别人获取佣金
*/
private Promotion promotion;
/**
* 注册时,其他用户给当前用户的邀请码
*/
private String promotionCode;
private String comment;
......
......@@ -59,8 +59,6 @@ public class AccountRepositoryCustomImpl implements AccountRepositoryCustom {
basicQuery.addCriteria(where("promotion.code").is(code).and("parent").exists(false));
Account account = mongoTemplate.findOne(basicQuery, Account.class);
if (account == null)
return null;
return account;
}
}
......@@ -24,10 +24,7 @@ public class UserPaymentRepositoryCustomImpl implements UserPaymentRepositoryCus
update.set("succeed", result);
UpdateResult operation = mongoTemplate.updateFirst(basicQuery, update, UserPayment.class);
if (operation.getModifiedCount() < 1)
return false;
else
return true;
return operation.getModifiedCount() >= 1;
}
}
......@@ -32,6 +32,7 @@ public class PaymentTask {
long now = System.currentTimeMillis();
Date date_5min = new Date(now - 5 * 60 * 1000);
Date date_10min = new Date(now - 10 * 60 * 1000);
// 查找 5-10 分钟内 支付状态为 false 的订单
List<UserPayment> unfinishedPayments = userPaymentRepository.findAllByPaymentDateBetweenAndSucceed(
ZonedDateTime.ofInstant(date_10min.toInstant(), ZoneId.systemDefault()),
ZonedDateTime.ofInstant(date_5min.toInstant(), ZoneId.systemDefault()),
......@@ -41,8 +42,8 @@ public class PaymentTask {
unfinishedPayments.forEach(
payment -> {
PaymentMethod paymentMethod = payment.getPaymentMethod();
try {
// 自动调用 微信或者支付宝的支付接口来确认 支付状态
if (PaymentMethod.WECHAT.equals(paymentMethod)) {
paymentService.wxCheckOrderStatus(payment.getTradeNo());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment