微信公众号端服务基本完成

This commit is contained in:
haotianmingyue 2024-12-10 16:19:15 +08:00
parent 1073ab28d9
commit d404295269
8 changed files with 65 additions and 12 deletions

View File

@ -55,7 +55,7 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- <version>5.1.38</version>-->
<version>5.1.38</version>
</dependency>
<!-- 核心模块-->

View File

@ -112,6 +112,7 @@ public class WxAuthController {
sysSignInWx.setVipStartTime(sysSignInApp.getVipStartTime());
sysSignInWx.setVipStopTime(sysSignInApp.getVipStopTime());
sysSignInWx.setStatus(sysSignInApp.getStatus());
sysSignInWx.setCalculateNumber(Math.max(10L, sysSignInApp.getCalculateNumber()));

View File

@ -123,7 +123,20 @@ public class ApiController extends BaseController {
@GetMapping("/userData/{phone}")
public AjaxResult getUserData(@PathVariable String phone) {
SysUser sysUser = sysUserService.selectUserByUserName(phone);
int isBind = 0;
// 若存在手机号说明该微信账号已经绑定过手机号.
if(!sysUser.getPhonenumber().isEmpty()){
System.out.println("用户手机号: "+ sysUser.getPhonenumber());
isBind = 1;
}
System.out.println("用户id: "+ sysUser.getUserId());
SysSignIn sysSignIn = sysSignInService.selectSysSignInByUId(sysUser.getUserId());
sysSignIn.setIsBind(isBind);
return AjaxResult.success(sysSignIn);
}

View File

@ -41,6 +41,9 @@ public class BackController {
public String wxRechargeCallback(HttpServletRequest req, @PathVariable String type) throws Exception {
String result = "failure";
try {
System.out.println("微信支付回调函数开始执行");
Map<String, Object> map = getParamsMap(req);
//获取私钥
String apikey = "fC2ExkJYLY5LI6PrliiZtcp8Egeolp1kc3wyH6hYlhXjg3X8PR1HlQeVPWkxzFNk4ugbtYGLNUQGBsAvMRwZJGUaj94KLnsYfssRciETgBc6CKN1y5hAs29U31XXD7ic";

View File

@ -63,24 +63,25 @@ public class PayController extends BaseController {
String orderTitle;
int predictCount = 1;
if ("1".equals(type)) {
// amount = 1L;
amount = 5000L;
// amount = 1L;
orderTitle = "优惠购买";
predictCount = 50;
} else if ("2".equals(type)) {
amount = 9900L;
// amount = 1L;
orderTitle = "优惠购买";
predictCount = 0;
predictCount = 99;
} else if ("3".equals(type)) {
amount = 29900L;
// amount = 1L;
predictCount = 0;
predictCount = 299;
orderTitle = "优惠购买";
} else if ("4".equals(type)) {
amount = 49900L;
// amount = 1L;
predictCount = 0;
predictCount = 499;
orderTitle = "优惠购买";
} else {
return AjaxResult.error();
@ -117,7 +118,8 @@ public class PayController extends BaseController {
model.setSubject("" + MCHNO + "");
model.setBody(orderTitle + "[" + MCHNO + "]");
model.setNotifyUrl("http://62.234.19.34:8991/wxPay/result/wxRechargeCallback/" + type); //回调地址
// model.setNotifyUrl("http://62.234.19.34:8991/wxPay/result/wxRechargeCallback/" + type); //APP端回调地址
model.setNotifyUrl("https://cesuan.doni.link/wxPay/result/wxRechargeCallback/" + type); //微信端回调地址
model.setReturnUrl("");
model.setDivisionMode(divisionMode); //分账模式
@ -154,6 +156,8 @@ public class PayController extends BaseController {
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("img.jpg", "UTF-8"));
System.out.println("微信支付结束");
return AjaxResult.success(url);
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
//

View File

@ -7,11 +7,11 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/xingming?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# url: jdbc:mysql://172.17.0.3:3306/xingming?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
# url: jdbc:mysql://localhost:3306/xingming?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
url: jdbc:mysql://172.17.0.3:3306/xingming?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&useSSL=false
username: root
# password: dnxxkj
password: root
password: dnxxkj
# password: root
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -19,6 +19,13 @@ ruoyi:
server:
# 服务器的HTTP端口默认为8080
port: 8991
# ssl:
# enabled: true
# key-store-type: PEM
# key: classpath:a.key
# key-store: classpath:a.pem
# key-store-password: classpath:a.key
servlet:
# 应用的访问路径
context-path: /
@ -70,8 +77,8 @@ spring:
# redis 配置
redis:
# 地址
# host: 172.17.0.4
host: localhost
host: 172.17.0.4
# host: localhost
# 端口默认为6379
port: 6379
# 数据库索引
@ -130,3 +137,17 @@ xss:
excludes: /system/notice
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*
wx:
# 微信小程序配置
appId: ${WX_APP_ID:wxa75198269cee70db} # 优先使用环境变量,否则使用默认值
appSecret: ${WX_APP_SECRET:09818c4e6489cc17228ee6b3e97523b9}
# redirectUri: ${WX_REDIRECT_URI:http://你的域名/api/wx/auth/callback}
#
# scope: snsapi_userinfo
apiUrl: https://api.weixin.qq.com

View File

@ -51,6 +51,9 @@ public class SysSignIn extends BaseEntity
@Excel(name = "无限次数结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date vipStopTime;
// 是否绑定手机号
private int isBind;
public void setId(Long id)
{
this.id = id;
@ -124,6 +127,14 @@ public class SysSignIn extends BaseEntity
return vipStopTime;
}
public int getIsBind() {
return isBind;
}
public void setIsBind(int isBind) {
this.isBind = isBind;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)