Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
志
志愿填报
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
单欣鑫
志愿填报
Commits
d3a47c6f
Commit
d3a47c6f
authored
Jun 18, 2025
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.推广码生成错误问题修复
parent
e9479801
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
16 deletions
+56
-16
ImgUpload.java
...ommon/src/main/java/com/ruoyi/common/utils/ImgUpload.java
+1
-1
WeiXinUtils.java
.../main/java/com/ruoyi/common/weixin/utils/WeiXinUtils.java
+46
-6
MallMemberUserServiceImpl.java
...om/ruoyi/mall/service/impl/MallMemberUserServiceImpl.java
+9
-9
No files found.
ruoyi-common/src/main/java/com/ruoyi/common/utils/ImgUpload.java
View file @
d3a47c6f
...
@@ -52,7 +52,7 @@ public class ImgUpload {
...
@@ -52,7 +52,7 @@ public class ImgUpload {
if
(
StringUtils
.
isBlank
(
path
))
{
if
(
StringUtils
.
isBlank
(
path
))
{
path
=
"IMG"
;
path
=
"IMG"
;
}
}
return
auth
.
uploadToken
(
bucketname
,
null
,
3600
,
new
StringMap
().
put
(
"saveKey"
,
path
+
"$(etag)$(ext)"
));
return
auth
.
uploadToken
(
bucketname
,
null
,
3600
,
new
StringMap
().
put
(
"saveKey"
,
"$(etag)$(ext)"
+
path
));
}
}
public
String
upload
(
byte
[]
data
,
String
fileType
)
throws
IOException
{
public
String
upload
(
byte
[]
data
,
String
fileType
)
throws
IOException
{
...
...
ruoyi-common/src/main/java/com/ruoyi/common/weixin/utils/WeiXinUtils.java
View file @
d3a47c6f
package
com
.
ruoyi
.
common
.
weixin
.
utils
;
package
com
.
ruoyi
.
common
.
weixin
.
utils
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.http.HttpUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.ruoyi.common.core.redis.RedisCache
;
import
com.ruoyi.common.core.redis.RedisCache
;
...
@@ -13,7 +14,6 @@ import org.slf4j.LoggerFactory;
...
@@ -13,7 +14,6 @@ import org.slf4j.LoggerFactory;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.io.BufferedInputStream
;
import
java.io.BufferedInputStream
;
import
java.io.PrintWriter
;
import
java.io.PrintWriter
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
...
@@ -140,13 +140,13 @@ public class WeiXinUtils {
...
@@ -140,13 +140,13 @@ public class WeiXinUtils {
* @return 图片链接
* @return 图片链接
*/
*/
public
String
getQRCode
(
Long
memberUserId
,
String
key
){
public
String
getQRCode
(
Long
memberUserId
,
String
key
){
String
qrCode
Url
=
""
;
String
result
Url
=
""
;
try
{
try
{
//获取token
//获取token
String
accessToken
=
this
.
getAccessToken
();
String
accessToken
=
this
.
getAccessToken
();
String
codeUrl
=
"https://api.weixin.qq.com/wxa/getwxacode?access_token="
+
accessToken
;
String
codeUrl
=
"https://api.weixin.qq.com/wxa/getwxacode?access_token="
+
accessToken
;
String
path
=
weiXinConfig
.
getWxPath
()+
memberUserId
;
//post参数
//post参数
String
path
=
weiXinConfig
.
getWxPath
()+
memberUserId
;
JSONObject
jsonObject
=
new
JSONObject
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"path"
,
path
);
jsonObject
.
put
(
"path"
,
path
);
Map
<
String
,
Object
>
lineColor
=
new
HashMap
<>();
Map
<
String
,
Object
>
lineColor
=
new
HashMap
<>();
...
@@ -172,14 +172,54 @@ public class WeiXinUtils {
...
@@ -172,14 +172,54 @@ public class WeiXinUtils {
//获取数据
//获取数据
BufferedInputStream
bis
=
new
BufferedInputStream
(
httpUrlConnection
.
getInputStream
());
BufferedInputStream
bis
=
new
BufferedInputStream
(
httpUrlConnection
.
getInputStream
());
//文件上传,返回小程序码url
//文件上传,返回小程序码url
qrCodeUrl
=
new
ImgUpload
().
streamUpload
(
bis
,
key
);
resultUrl
=
new
ImgUpload
().
streamUpload
(
bis
,
IdUtil
.
getSnowflakeNextIdStr
()+
"_"
+
key
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
return
qrCode
Url
;
return
result
Url
;
}
}
// public String getQRCode(Long memberUserId, String key){
// String qrCodeUrl = "";
// try {
// //获取token
// String accessToken = this.getAccessToken();
// String codeUrl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token="+ accessToken;
// String path = weiXinConfig.getWxPath()+memberUserId;
// //post参数
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("path", path);
// Map<String, Object> lineColor = new HashMap<>();
// lineColor.put("r", 4);
// lineColor.put("g", 157);
// lineColor.put("b", 150);
// jsonObject.put("line_color", lineColor);
// String env_version = "release";// 正式版为 "release",体验版为 "trial",开发版为 "develop"
// jsonObject.put("env_version", env_version);
// String params = jsonObject.toString();
//
// URL url = new URL(codeUrl);
// HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection();
// // 提交模式
// httpUrlConnection.setRequestMethod("POST");
// // 发送POST请求必须设置如下两行
// httpUrlConnection.setDoOutput(true);
// httpUrlConnection.setDoInput(true);
// // 获取URLConnection对象对应的输出流
// PrintWriter printWriter = new PrintWriter(httpUrlConnection.getOutputStream());
// printWriter.write(params);
// printWriter.flush();
// //获取数据
// BufferedInputStream bis = new BufferedInputStream(httpUrlConnection.getInputStream());
// //文件上传,返回小程序码url
// qrCodeUrl = new ImgUpload().streamUpload(bis, key);
//
// } catch (Exception e) {
// e.printStackTrace();
// }
// return qrCodeUrl;
// }
/**
/**
* 获取不限制的小程序码
* 获取不限制的小程序码
*
*
...
...
ruoyi-system/src/main/java/com/ruoyi/mall/service/impl/MallMemberUserServiceImpl.java
View file @
d3a47c6f
...
@@ -1046,15 +1046,15 @@ public class MallMemberUserServiceImpl implements IMallMemberUserService
...
@@ -1046,15 +1046,15 @@ public class MallMemberUserServiceImpl implements IMallMemberUserService
sysUser
.
setPassword
(
SecurityUtils
.
encryptPassword
(
password
));
sysUser
.
setPassword
(
SecurityUtils
.
encryptPassword
(
password
));
sysUserMapper
.
updateUser
(
sysUser
);
sysUserMapper
.
updateUser
(
sysUser
);
}
}
/**
if
(
StringUtils
.
isBlank
(
memberUser
.
getIndexCode
()))
{
* 重新生成二维码
*/
String
qrCode
=
""
;
String
qrCode
=
""
;
// 小程序码
// 小程序码
Long
school
Id
=
memberUser
.
getId
();
Long
user
Id
=
memberUser
.
getId
();
String
key
=
school
Id
+
".png"
;
String
key
=
user
Id
+
".png"
;
qrCode
=
weiXinUtils
.
getSchoolQRCode
(
school
Id
,
key
);
qrCode
=
weiXinUtils
.
getQRCode
(
user
Id
,
key
);
updateMemberUser
.
setIndexCode
(
qrCode
);
updateMemberUser
.
setIndexCode
(
qrCode
);
}
mallMemberUserMapper
.
updateMallMemberUserInfo
(
updateMemberUser
);
mallMemberUserMapper
.
updateMallMemberUserInfo
(
updateMemberUser
);
return
AjaxResult
.
success
();
return
AjaxResult
.
success
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment