|
@@ -1,6 +1,8 @@
|
|
|
package com.ruoyi.wx.web.controller;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.date.DateField;
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.github.binarywang.wxpay.bean.notify.OriginNotifyResponse;
|
|
|
import com.github.binarywang.wxpay.bean.notify.SignatureHeader;
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Result;
|
|
@@ -150,6 +152,10 @@ public class WxPayController {
|
|
|
wxRecharge.setUserId(wxUser.getId());
|
|
|
wxRecharge.setUserName(wxUser.getUsername());
|
|
|
wxRechargeService.insertWxRecharge(wxRecharge);
|
|
|
+ wxUser.setUserLevel(dto.getVipLv());
|
|
|
+ wxUser.setVipStartTime(new Date());
|
|
|
+ wxUser.setVipEndTime(defDate(new Date(), dto.getVipLv()));
|
|
|
+ wxUserService.updateWxUser(wxUser);
|
|
|
result.put("appId", orderV3.getAppId());
|
|
|
result.put("timeStamp", orderV3.getTimeStamp());
|
|
|
result.put("nonceStr", orderV3.getNonceStr());
|
|
@@ -211,4 +217,22 @@ public class WxPayController {
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
+
|
|
|
+ private Date defDate(Date now, Integer offset) {
|
|
|
+ Date defDate = new Date();
|
|
|
+ switch (offset) {
|
|
|
+ case 1:
|
|
|
+ defDate = DateUtil.offset(now, DateField.MONTH, 1);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ defDate = DateUtil.offset(now, DateField.MONTH, 3);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ defDate = DateUtil.offset(now, DateField.MONTH, 12);
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return defDate;
|
|
|
+ }
|
|
|
}
|