Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
8a493daf
Commit
8a493daf
authored
Aug 30, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
137be25f
585358a5
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
170 additions
and
270 deletions
+170
-270
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
...rc/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
+3
-0
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
+3
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
...c/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
+3
-3
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
+67
-13
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
...pi/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
+92
-168
ch-wx-api/src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
.../src/main/java/com/wwdz/ch/wx/manager/WxLoginManager.java
+2
-27
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/WxLoginService.java
.../src/main/java/com/wwdz/ch/wx/service/WxLoginService.java
+0
-39
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
...pi/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
+0
-17
No files found.
ch-wx-api/src/main/java/com/wwdz/ch/wx/entity/vo/ItemResponseVo.java
View file @
8a493daf
...
@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.entity.vo;
...
@@ -3,6 +3,7 @@ package com.wwdz.ch.wx.entity.vo;
import
com.xxdxxs.entity.Entity
;
import
com.xxdxxs.entity.Entity
;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
@Data
@Data
...
@@ -26,4 +27,6 @@ public class ItemResponseVo implements Entity {
...
@@ -26,4 +27,6 @@ public class ItemResponseVo implements Entity {
private
Boolean
isDeleted
;
private
Boolean
isDeleted
;
private
String
itemNickname
;
private
String
itemNickname
;
private
Integer
timeType
;
private
Integer
timeType
;
private
List
<
Map
<
String
,
Object
>>
imagesList
;
private
List
<
Map
<
String
,
Object
>>
videosList
;
}
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FavoritesServiceImpl.java
View file @
8a493daf
...
@@ -455,7 +455,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -455,7 +455,7 @@ public class FavoritesServiceImpl implements FavoritesService {
String
[]
image
=
item
.
getImages
().
split
(
";"
);
String
[]
image
=
item
.
getImages
().
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
if
(
image
[
0
].
contains
(
"_"
))
{
if
(
image
[
0
].
contains
(
"_"
))
{
homePageMap
=
get
ImageMap
(
image
[
0
]);
homePageMap
=
get
Aspect
(
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"type"
,
2
);
}
}
...
@@ -464,7 +464,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -464,7 +464,7 @@ public class FavoritesServiceImpl implements FavoritesService {
String
[]
vedioImage
=
item
.
getVideos
().
split
(
";"
);
String
[]
vedioImage
=
item
.
getVideos
().
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
if
(
vedioImage
[
0
].
contains
(
","
))
{
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
homePageMap
=
get
ImageMap
(
video
[
1
]);
homePageMap
=
get
Aspect
(
video
[
1
]);
homePageMap
.
put
(
"url"
,
video
[
1
]);
homePageMap
.
put
(
"url"
,
video
[
1
]);
homePageMap
.
put
(
"type"
,
1
);
homePageMap
.
put
(
"type"
,
1
);
}
}
...
@@ -478,7 +478,7 @@ public class FavoritesServiceImpl implements FavoritesService {
...
@@ -478,7 +478,7 @@ public class FavoritesServiceImpl implements FavoritesService {
* @param image
* @param image
* @return
* @return
*/
*/
private
Map
<
String
,
Object
>
get
ImageMap
(
String
image
)
{
private
Map
<
String
,
Object
>
get
Aspect
(
String
image
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
infoImage
=
_image
[
1
].
split
(
"\\."
);
String
[]
infoImage
=
_image
[
1
].
split
(
"\\."
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/FootPrintServiceImpl.java
View file @
8a493daf
...
@@ -153,7 +153,7 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -153,7 +153,7 @@ public class FootPrintServiceImpl implements FootPrintService {
String
[]
image
=
item
.
getImages
().
split
(
";"
);
String
[]
image
=
item
.
getImages
().
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
if
(
image
[
0
].
contains
(
"_"
))
{
if
(
image
[
0
].
contains
(
"_"
))
{
homePageMap
=
get
ImageMap
(
image
[
0
]);
homePageMap
=
get
Aspect
(
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"type"
,
2
);
}
}
...
@@ -162,7 +162,7 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -162,7 +162,7 @@ public class FootPrintServiceImpl implements FootPrintService {
String
[]
vedioImage
=
item
.
getVideos
().
split
(
";"
);
String
[]
vedioImage
=
item
.
getVideos
().
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
if
(
vedioImage
[
0
].
contains
(
","
))
{
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
homePageMap
=
get
ImageMap
(
video
[
1
]);
homePageMap
=
get
Aspect
(
video
[
1
]);
homePageMap
.
put
(
"url"
,
video
[
1
]);
homePageMap
.
put
(
"url"
,
video
[
1
]);
homePageMap
.
put
(
"type"
,
1
);
homePageMap
.
put
(
"type"
,
1
);
}
}
...
@@ -176,7 +176,7 @@ public class FootPrintServiceImpl implements FootPrintService {
...
@@ -176,7 +176,7 @@ public class FootPrintServiceImpl implements FootPrintService {
* @param image
* @param image
* @return
* @return
*/
*/
private
Map
<
String
,
Object
>
get
ImageMap
(
String
image
)
{
private
Map
<
String
,
Object
>
get
Aspect
(
String
image
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
infoImage
=
_image
[
1
].
split
(
"\\."
);
String
[]
infoImage
=
_image
[
1
].
split
(
"\\."
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/ItemServiceImpl.java
View file @
8a493daf
...
@@ -15,8 +15,8 @@ import com.wwdz.ch.db.es.ItemEsDao;
...
@@ -15,8 +15,8 @@ import com.wwdz.ch.db.es.ItemEsDao;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.AgentTranceResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.entity.vo.ItemResponseVo
;
import
com.wwdz.ch.wx.manager.WxLoginManager
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.wwdz.ch.wx.service.WxLoginService
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.wwdz.ch.wx.util.StringUtil
;
import
com.xxdxxs.utils.CommonUtils
;
import
com.xxdxxs.utils.CommonUtils
;
import
com.xxdxxs.utils.DateUtils
;
import
com.xxdxxs.utils.DateUtils
;
...
@@ -57,7 +57,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -57,7 +57,7 @@ public class ItemServiceImpl implements ItemService {
@Autowired
@Autowired
private
FavoritesDao
favoritesDao
;
private
FavoritesDao
favoritesDao
;
@Autowired
@Autowired
private
WxLogin
Service
wxLoginService
;
private
WxLogin
Manager
wxLoginManager
;
@Autowired
@Autowired
private
QiniuStorage
qiniuStorage
;
private
QiniuStorage
qiniuStorage
;
@Autowired
@Autowired
...
@@ -178,7 +178,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -178,7 +178,7 @@ public class ItemServiceImpl implements ItemService {
item
.
setSort
(
100
);
item
.
setSort
(
100
);
item
.
setImages
(
dto
.
getImages
());
item
.
setImages
(
dto
.
getImages
());
if
(
StringUtils
.
isNotBlank
(
dto
.
getVideos
()))
{
if
(
StringUtils
.
isNotBlank
(
dto
.
getVideos
()))
{
item
.
setVideos
(
getV
edi
osImage
(
dto
.
getVideos
()));
item
.
setVideos
(
getV
ide
osImage
(
dto
.
getVideos
()));
}
}
item
.
setPrice
(
Long
.
parseLong
(
dto
.
getPrice
())
*
100
);
item
.
setPrice
(
Long
.
parseLong
(
dto
.
getPrice
())
*
100
);
item
.
setDetail
(
dto
.
getDetail
());
item
.
setDetail
(
dto
.
getDetail
());
...
@@ -266,6 +266,10 @@ public class ItemServiceImpl implements ItemService {
...
@@ -266,6 +266,10 @@ public class ItemServiceImpl implements ItemService {
}
}
itemResponseVo
.
setVideos
(
stringBuilder
.
substring
(
0
,
stringBuilder
.
length
()
-
1
));
itemResponseVo
.
setVideos
(
stringBuilder
.
substring
(
0
,
stringBuilder
.
length
()
-
1
));
}
}
// 设置图片列表
itemResponseVo
.
setImagesList
(
getImagesMapList
(
item
.
getImages
()));
// 设置视频列表
itemResponseVo
.
setVideosList
(
StringUtils
.
isNotBlank
(
item
.
getVideos
())
?
getVideosMapList
(
item
.
getVideos
())
:
new
ArrayList
<>());
// 设置分类id和名称
// 设置分类id和名称
itemResponseVo
.
setCid
(
item
.
getCid
());
itemResponseVo
.
setCid
(
item
.
getCid
());
Category
category
=
categoryDao
.
findById
(
item
.
getCid
());
Category
category
=
categoryDao
.
findById
(
item
.
getCid
());
...
@@ -415,7 +419,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -415,7 +419,7 @@ public class ItemServiceImpl implements ItemService {
item
.
setImages
(
dto
.
getImages
());
item
.
setImages
(
dto
.
getImages
());
item
.
setVideos
(
""
);
item
.
setVideos
(
""
);
if
(
StringUtils
.
isNotBlank
(
dto
.
getVideos
()))
{
if
(
StringUtils
.
isNotBlank
(
dto
.
getVideos
()))
{
item
.
setVideos
(
getV
edi
osImage
(
dto
.
getVideos
()));
item
.
setVideos
(
getV
ide
osImage
(
dto
.
getVideos
()));
}
}
item
.
setPrice
(
Long
.
parseLong
(
dto
.
getPrice
())
*
100
);
item
.
setPrice
(
Long
.
parseLong
(
dto
.
getPrice
())
*
100
);
item
.
setDetail
(
dto
.
getDetail
());
item
.
setDetail
(
dto
.
getDetail
());
...
@@ -460,7 +464,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -460,7 +464,7 @@ public class ItemServiceImpl implements ItemService {
String
keyName
=
CommConsts
.
UPLOAD_PRE_WXACODE_DIRECTORY
+
page
+
"/"
+
scene
+
"."
+
MediaTypeEnum
.
IMAGE_JPG
.
getExt
();
String
keyName
=
CommConsts
.
UPLOAD_PRE_WXACODE_DIRECTORY
+
page
+
"/"
+
scene
+
"."
+
MediaTypeEnum
.
IMAGE_JPG
.
getExt
();
FileInfo
fileInfo
=
(
FileInfo
)
qiniuStorage
.
checkFile
(
keyName
);
FileInfo
fileInfo
=
(
FileInfo
)
qiniuStorage
.
checkFile
(
keyName
);
if
(
Objects
.
isNull
(
fileInfo
))
{
if
(
Objects
.
isNull
(
fileInfo
))
{
InputStream
inputStream
=
wxLogin
Service
.
getWxacodeStream
(
page
,
scene
);
InputStream
inputStream
=
wxLogin
Manager
.
getWxacodeStream
(
page
,
scene
);
if
(
Objects
.
isNull
(
inputStream
))
{
if
(
Objects
.
isNull
(
inputStream
))
{
return
Result
.
failed
(
"获取微信小程序流失败"
);
return
Result
.
failed
(
"获取微信小程序流失败"
);
}
}
...
@@ -482,7 +486,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -482,7 +486,7 @@ public class ItemServiceImpl implements ItemService {
@Override
@Override
public
Result
getWxLink
(
String
pageUrl
)
{
public
Result
getWxLink
(
String
pageUrl
)
{
try
{
try
{
String
link
=
wxLogin
Service
.
getLink
(
pageUrl
);
String
link
=
wxLogin
Manager
.
getLink
(
pageUrl
);
if
(
StringUtils
.
isBlank
(
link
))
{
if
(
StringUtils
.
isBlank
(
link
))
{
return
Result
.
failed
(
"获取微信小程序链接失败"
);
return
Result
.
failed
(
"获取微信小程序链接失败"
);
}
}
...
@@ -537,8 +541,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -537,8 +541,8 @@ public class ItemServiceImpl implements ItemService {
}
}
}
}
private
String
getV
edi
osImage
(
String
vedios
)
{
private
String
getV
ide
osImage
(
String
vedios
)
{
String
v
edi
o
=
""
;
String
v
ide
o
=
""
;
String
[]
images
=
vedios
.
split
(
";"
);
String
[]
images
=
vedios
.
split
(
";"
);
StringBuffer
stringBuffer
=
new
StringBuffer
();
StringBuffer
stringBuffer
=
new
StringBuffer
();
Arrays
.
stream
(
images
).
parallel
().
forEach
(
image
->
{
Arrays
.
stream
(
images
).
parallel
().
forEach
(
image
->
{
...
@@ -560,8 +564,8 @@ public class ItemServiceImpl implements ItemService {
...
@@ -560,8 +564,8 @@ public class ItemServiceImpl implements ItemService {
logger
.
error
(
"视频图片上传失败"
,
e
);
logger
.
error
(
"视频图片上传失败"
,
e
);
}
}
});
});
v
edi
o
=
stringBuffer
.
toString
();
v
ide
o
=
stringBuffer
.
toString
();
return
v
edi
o
;
return
v
ide
o
;
}
}
/**
/**
...
@@ -597,7 +601,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -597,7 +601,7 @@ public class ItemServiceImpl implements ItemService {
String
[]
image
=
es
.
getImages
().
split
(
";"
);
String
[]
image
=
es
.
getImages
().
split
(
";"
);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
if
(
image
[
0
].
contains
(
"_"
))
{
if
(
image
[
0
].
contains
(
"_"
))
{
homePageMap
=
get
ImageMap
(
image
[
0
]);
homePageMap
=
get
Aspect
(
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"url"
,
image
[
0
]);
homePageMap
.
put
(
"type"
,
2
);
homePageMap
.
put
(
"type"
,
2
);
}
}
...
@@ -606,7 +610,7 @@ public class ItemServiceImpl implements ItemService {
...
@@ -606,7 +610,7 @@ public class ItemServiceImpl implements ItemService {
String
[]
vedioImage
=
es
.
getVideos
().
split
(
";"
);
String
[]
vedioImage
=
es
.
getVideos
().
split
(
";"
);
if
(
vedioImage
[
0
].
contains
(
","
))
{
if
(
vedioImage
[
0
].
contains
(
","
))
{
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
String
[]
video
=
vedioImage
[
0
].
split
(
","
);
homePageMap
=
get
ImageMap
(
video
[
1
]);
homePageMap
=
get
Aspect
(
video
[
1
]);
homePageMap
.
put
(
"url"
,
video
[
1
]);
homePageMap
.
put
(
"url"
,
video
[
1
]);
homePageMap
.
put
(
"type"
,
1
);
homePageMap
.
put
(
"type"
,
1
);
}
}
...
@@ -614,13 +618,63 @@ public class ItemServiceImpl implements ItemService {
...
@@ -614,13 +618,63 @@ public class ItemServiceImpl implements ItemService {
return
homePageMap
;
return
homePageMap
;
}
}
/**
* 获取图片对象列表
*
* @param images
* @return
*/
private
List
<
Map
<
String
,
Object
>>
getImagesMapList
(
String
images
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
String
[]
image
=
images
.
split
(
";"
);
for
(
int
i
=
0
;
i
<
image
.
length
;
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
image
[
i
].
contains
(
"_"
))
{
map
=
getAspect
(
image
[
i
]);
}
else
{
map
.
put
(
"width"
,
"0"
);
map
.
put
(
"type"
,
"0"
);
}
map
.
put
(
"url"
,
image
[
i
]);
map
.
put
(
"type"
,
2
);
list
.
add
(
map
);
}
return
list
;
}
/**
* 获取视频对象列表
*
* @param videos
* @return
*/
private
List
<
Map
<
String
,
Object
>>
getVideosMapList
(
String
videos
)
{
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
String
[]
video
=
videos
.
split
(
";"
);
for
(
int
i
=
0
;
i
<
video
.
length
;
i
++)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
video
[
i
].
contains
(
","
))
{
String
[]
image
=
video
[
i
].
split
(
","
);
map
=
getAspect
(
image
[
1
]);
map
.
put
(
"url"
,
image
[
0
]);
}
else
{
map
.
put
(
"width"
,
"0"
);
map
.
put
(
"type"
,
"0"
);
map
.
put
(
"url"
,
video
[
i
]);
}
map
.
put
(
"type"
,
1
);
list
.
add
(
map
);
}
return
list
;
}
/**
/**
* 获取图片的长宽
* 获取图片的长宽
*
*
* @param image
* @param image
* @return
* @return
*/
*/
private
Map
<
String
,
Object
>
get
ImageMap
(
String
image
)
{
private
Map
<
String
,
Object
>
get
Aspect
(
String
image
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
_image
=
image
.
split
(
"_"
);
String
[]
infoImage
=
_image
[
1
].
split
(
"\\."
);
String
[]
infoImage
=
_image
[
1
].
split
(
"\\."
);
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/impl/UserServiceImpl.java
View file @
8a493daf
This diff is collapsed.
Click to expand it.
ch-wx-api/src/main/java/com/wwdz/ch/wx/
impl/WxLoginServiceImpl
.java
→
ch-wx-api/src/main/java/com/wwdz/ch/wx/
manager/WxLoginManager
.java
View file @
8a493daf
package
com.wwdz.ch.wx.
impl
;
package
com.wwdz.ch.wx.
manager
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.api.WxMaService
;
import
cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl
;
import
cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl
;
...
@@ -7,8 +7,6 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
...
@@ -7,8 +7,6 @@ import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.wwdz.ch.core.util.OkHttpUtil
;
import
com.wwdz.ch.wx.entity.request.UserRequestDto
;
import
com.wwdz.ch.wx.entity.request.UserRequestDto
;
import
com.wwdz.ch.wx.service.WxLoginService
;
import
com.wwdz.ch.wx.util.RedisUtil
;
import
com.xxdxxs.utils.JsonUtils
;
import
com.xxdxxs.utils.JsonUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -21,7 +19,7 @@ import java.util.HashMap;
...
@@ -21,7 +19,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
@Service
@Service
public
class
WxLogin
ServiceImpl
implements
WxLoginService
{
public
class
WxLogin
Manager
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxMaServiceImpl
.
class
);
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxMaServiceImpl
.
class
);
private
static
final
String
appid
=
"wx5b4409448bf2c72b"
;
private
static
final
String
appid
=
"wx5b4409448bf2c72b"
;
...
@@ -33,11 +31,8 @@ public class WxLoginServiceImpl implements WxLoginService {
...
@@ -33,11 +31,8 @@ public class WxLoginServiceImpl implements WxLoginService {
@Autowired
@Autowired
private
WxMaService
wxMaService
;
private
WxMaService
wxMaService
;
@Autowired
private
RedisUtil
redisUtil
;
@Override
public
String
getPhone
(
UserRequestDto
dto
)
{
public
String
getPhone
(
UserRequestDto
dto
)
{
String
phone
=
""
;
String
phone
=
""
;
if
(
dto
.
getType
()
==
1
)
{
if
(
dto
.
getType
()
==
1
)
{
...
@@ -88,27 +83,9 @@ public class WxLoginServiceImpl implements WxLoginService {
...
@@ -88,27 +83,9 @@ public class WxLoginServiceImpl implements WxLoginService {
return
phone
;
return
phone
;
}
}
@Override
public
String
getAccessToken
()
{
public
String
getAccessToken
()
{
logger
.
info
(
"开始获取access_token----------------"
);
logger
.
info
(
"开始获取access_token----------------"
);
try
{
try
{
// if (redisUtil.hasKey(CacheCodeConstants.WX_ACCESS_TOKEN)) {
// logger.info("从redis获取access_token成功");
// return redisUtil.get(CacheCodeConstants.WX_ACCESS_TOKEN).toString();
// } else {
// String accessTokenUrl = String.format(GET_ACCESS_TOKEN_URL, appid, secret);
// String res = OkHttpUtil.builder().url(accessTokenUrl)
// .get().sync();
// logger.info("获取access_token结果:" + res);
// if (!res.contains("access_token")) {
// logger.error("获取accessToken出错,返回结果是:" + res);
// return null;
// }
// String accessToken = JsonUtils.getValueByPath(res, "access_token");
// String expiresIn = JsonUtils.getValueByPath(res, "expires_in");
// redisUtil.set(CacheCodeConstants.WX_ACCESS_TOKEN, accessToken, Long.parseLong(expiresIn));
// return accessToken;
// }
String
accessTokenUrl
=
String
.
format
(
GET_ACCESS_TOKEN_URL
,
appid
,
secret
);
String
accessTokenUrl
=
String
.
format
(
GET_ACCESS_TOKEN_URL
,
appid
,
secret
);
String
res
=
OkHttpUtil
.
builder
().
url
(
accessTokenUrl
)
String
res
=
OkHttpUtil
.
builder
().
url
(
accessTokenUrl
)
.
get
().
sync
();
.
get
().
sync
();
...
@@ -124,7 +101,6 @@ public class WxLoginServiceImpl implements WxLoginService {
...
@@ -124,7 +101,6 @@ public class WxLoginServiceImpl implements WxLoginService {
}
}
}
}
@Override
public
InputStream
getWxacodeStream
(
String
page
,
String
scene
)
{
public
InputStream
getWxacodeStream
(
String
page
,
String
scene
)
{
try
{
try
{
String
accessToken
=
getAccessToken
();
String
accessToken
=
getAccessToken
();
...
@@ -141,7 +117,6 @@ public class WxLoginServiceImpl implements WxLoginService {
...
@@ -141,7 +117,6 @@ public class WxLoginServiceImpl implements WxLoginService {
}
}
}
}
@Override
public
String
getLink
(
String
pageUrl
)
{
public
String
getLink
(
String
pageUrl
)
{
try
{
try
{
String
accessToken
=
getAccessToken
();
String
accessToken
=
getAccessToken
();
...
...
ch-wx-api/src/main/java/com/wwdz/ch/wx/service/WxLoginService.java
deleted
100644 → 0
View file @
137be25f
package
com.wwdz.ch.wx.service
;
import
com.wwdz.ch.wx.entity.request.UserRequestDto
;
import
java.io.InputStream
;
public
interface
WxLoginService
{
/**
* 获取微信用户手机号
*
* @param dto
* @return
*/
String
getPhone
(
UserRequestDto
dto
);
/**
* 获取微信用户授权access_token
*
* @return
*/
String
getAccessToken
();
/**
* 获取微信小程序小程序码图片流
*
* @param path
* @param scene
* @return
*/
InputStream
getWxacodeStream
(
String
path
,
String
scene
);
/**
* 获取微信小程序短链接
*
* @param pageUrl
* @return
*/
String
getLink
(
String
pageUrl
);
}
ch-wx-api/src/main/java/com/wwdz/ch/wx/web/WxItemController.java
View file @
8a493daf
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.core.type.Result
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.entity.request.ItemRequestDto
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.wwdz.ch.wx.service.ItemService
;
import
com.wwdz.ch.wx.service.WxLoginService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -15,8 +14,6 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -15,8 +14,6 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
@RestController
@RestController
...
@@ -26,8 +23,6 @@ public class WxItemController {
...
@@ -26,8 +23,6 @@ public class WxItemController {
@Autowired
@Autowired
private
ItemService
itemService
;
private
ItemService
itemService
;
@Autowired
private
WxLoginService
wxLoginService
;
@ApiOperation
(
value
=
"藏品名称联想"
)
@ApiOperation
(
value
=
"藏品名称联想"
)
@PostMapping
(
"/findNames"
)
@PostMapping
(
"/findNames"
)
...
@@ -139,18 +134,6 @@ public class WxItemController {
...
@@ -139,18 +134,6 @@ public class WxItemController {
return
itemService
.
cancel
(
dto
);
return
itemService
.
cancel
(
dto
);
}
}
@ApiOperation
(
value
=
"小程序授权码"
)
@PostMapping
(
"/getAccessToken"
)
public
Result
getAccessToken
()
{
String
accessToken
=
wxLoginService
.
getAccessToken
();
if
(
StringUtils
.
isBlank
(
accessToken
))
{
return
Result
.
failed
(
"获取access_token失败"
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"access_token"
,
accessToken
);
return
Result
.
success
(
map
);
}
@ApiOperation
(
value
=
"小程序码"
)
@ApiOperation
(
value
=
"小程序码"
)
@GetMapping
(
"/getWxacode"
)
@GetMapping
(
"/getWxacode"
)
public
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
)
{
public
Result
getWxacode
(
String
page
,
String
scene
,
HttpServletResponse
response
)
{
...
...
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