From ca3f24a94f908ae2c5fca25e6d78cdca00c69e85 Mon Sep 17 00:00:00 2001
From: nolan <799753704@qq.com>
Date: Mon, 21 Mar 2022 18:21:49 +0800
Subject: [PATCH] first commit
---
hl-wechat/pom.xml | 19 +
.../java/com/ruoyi/hl/config/VideoConfig.java | 10 +
.../java/com/ruoyi/hl/config/WxConfig.java | 58 +++
.../com/ruoyi/hl/controller/WxController.java | 44 +++
.../hl/forest/clients/MiniWeChatClients.java | 76 ++++
.../interceptor/UnlimitedInterceptor.java | 38 ++
.../interceptor/WriteLogInterceptor.java | 29 ++
.../hl/forest/ptoto/WxAuthAccessTokenRes.java | 13 +
.../hl/forest/ptoto/WxGetUnlimitedRes.java | 9 +
.../forest/ptoto/WxMiniCode2SessionRes.java | 17 +
.../ruoyi/hl/forest/ptoto/WxMiniTokenRes.java | 10 +
.../ptoto/WxPublicCode2UserInfoRes.java | 17 +
.../hl/forest/ptoto/WxPublickTokenRes.java | 10 +
.../java/com/ruoyi/hl/forest/ptoto/WxRes.java | 13 +
.../hl/forest/ptoto/WxSendTemplateRes.java | 9 +
.../ruoyi/hl/forest/ptoto/WxUserInfoRes.java | 26 ++
.../java/com/ruoyi/hl/service/WxService.java | 48 +++
.../com/ruoyi/hl/service/WxTokenService.java | 111 ++++++
hl-wechat/src/main/resources/application.yml | 123 +++++++
.../java/com/ruoyi/hl/config/VideoConfig.java | 10 +
.../java/com/ruoyi/hl/config/WxConfig.java | 58 +++
.../com/ruoyi/hl/controller/WxController.java | 41 +++
.../hl/forest/clients/MiniWeChatClients.java | 76 ++++
.../interceptor/UnlimitedInterceptor.java | 37 ++
.../interceptor/WriteLogInterceptor.java | 29 ++
.../hl/forest/ptoto/WxAuthAccessTokenRes.java | 13 +
.../hl/forest/ptoto/WxGetUnlimitedRes.java | 9 +
.../forest/ptoto/WxMiniCode2SessionRes.java | 17 +
.../ruoyi/hl/forest/ptoto/WxMiniTokenRes.java | 10 +
.../ptoto/WxPublicCode2UserInfoRes.java | 17 +
.../hl/forest/ptoto/WxPublickTokenRes.java | 10 +
.../java/com/ruoyi/hl/forest/ptoto/WxRes.java | 13 +
.../hl/forest/ptoto/WxSendTemplateRes.java | 9 +
.../ruoyi/hl/forest/ptoto/WxUserInfoRes.java | 26 ++
.../java/com/ruoyi/hl/service/WxService.java | 43 +++
.../com/ruoyi/hl/service/WxTokenService.java | 108 ++++++
.../controller/ilisteners/PutProcessData.java | 10 +
.../ruoyi/web/controller/mapper/FileDao.java | 2 +
.../ruoyi/web/controller/mapper/VideoDao.java | 12 +
.../controller/upload/BFileController.java | 104 ++++++
.../upload/BVideoAllowController.java | 104 ++++++
.../controller/upload/BVideosController.java | 104 ++++++
.../upload/ShortLinkController.java | 44 +++
.../controller/upload/VideosController.java | 2 +
.../com/ruoyi/web/serveice/UploadService.java | 2 +
.../common/config/CloudStorageConfig.java | 237 ++++++++++++
.../com/ruoyi/common/config/ToolConfig.java | 50 +++
.../com/ruoyi/common/utils/BytesUtil.java | 78 ++++
.../ilisteners/PutObjectProgressListener.java | 79 ++++
.../web/ilisteners/PutProcessData.java | 10 +
.../framework/web/service/AliOSSService.java | 2 +
.../java/com/ruoyi/system/domain/BFile.java | 81 +++++
.../com/ruoyi/system/domain/BVideoAllow.java | 109 ++++++
.../java/com/ruoyi/system/domain/BVideos.java | 137 +++++++
.../com/ruoyi/system/mapper/BFileMapper.java | 61 ++++
.../system/mapper/BVideoAllowMapper.java | 61 ++++
.../ruoyi/system/mapper/BVideosMapper.java | 61 ++++
.../ruoyi/system/service/IBFileService.java | 61 ++++
.../system/service/IBVideoAllowService.java | 61 ++++
.../ruoyi/system/service/IBVideosService.java | 61 ++++
.../system/service/impl/BFileServiceImpl.java | 93 +++++
.../service/impl/BVideoAllowServiceImpl.java | 93 +++++
.../service/impl/BVideosServiceImpl.java | 93 +++++
.../resources/mapper/system/BFileMapper.xml | 66 ++++
.../mapper/system/BVideoAllowMapper.xml | 76 ++++
.../resources/mapper/system/BVideosMapper.xml | 86 +++++
ruoyi-ui/src/api/system/allow.js | 44 +++
ruoyi-ui/src/api/system/file.js | 44 +++
ruoyi-ui/src/api/system/videos.js | 44 +++
ruoyi-ui/src/views/system/allow/index.vue | 310 ++++++++++++++++
ruoyi-ui/src/views/system/file/index.vue | 282 ++++++++++++++
ruoyi-ui/src/views/system/manage/files.vue | 279 ++++++++++++++
.../src/views/system/manage/selectFiles.vue | 343 ++++++++++++++++++
ruoyi-ui/src/views/system/videos/index.vue | 336 +++++++++++++++++
74 files changed, 4928 insertions(+)
create mode 100644 hl-wechat/pom.xml
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/config/VideoConfig.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/config/WxConfig.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/controller/WxController.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/WriteLogInterceptor.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxAuthAccessTokenRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxGetUnlimitedRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniCode2SessionRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniTokenRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublicCode2UserInfoRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublickTokenRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxSendTemplateRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/forest/ptoto/WxUserInfoRes.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/service/WxService.java
create mode 100644 hl-wechat/src/main/java/com/ruoyi/hl/service/WxTokenService.java
create mode 100644 hl-wechat/src/main/resources/application.yml
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/config/VideoConfig.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/config/WxConfig.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/controller/WxController.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/interceptor/WriteLogInterceptor.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxAuthAccessTokenRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxGetUnlimitedRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniCode2SessionRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxMiniTokenRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublicCode2UserInfoRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxPublickTokenRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxSendTemplateRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/forest/ptoto/WxUserInfoRes.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/service/WxService.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/hl/service/WxTokenService.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/ilisteners/PutProcessData.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/mapper/FileDao.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/mapper/VideoDao.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BFileController.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideoAllowController.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/BVideosController.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/ShortLinkController.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/upload/VideosController.java
create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/serveice/UploadService.java
create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/config/CloudStorageConfig.java
create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/config/ToolConfig.java
create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/BytesUtil.java
create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/ilisteners/PutObjectProgressListener.java
create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/ilisteners/PutProcessData.java
create mode 100644 ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/AliOSSService.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/BFile.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/BVideoAllow.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/BVideos.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/BFileMapper.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/BVideoAllowMapper.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/mapper/BVideosMapper.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IBFileService.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IBVideoAllowService.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/IBVideosService.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BFileServiceImpl.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BVideoAllowServiceImpl.java
create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BVideosServiceImpl.java
create mode 100644 ruoyi-system/src/main/resources/mapper/system/BFileMapper.xml
create mode 100644 ruoyi-system/src/main/resources/mapper/system/BVideoAllowMapper.xml
create mode 100644 ruoyi-system/src/main/resources/mapper/system/BVideosMapper.xml
create mode 100644 ruoyi-ui/src/api/system/allow.js
create mode 100644 ruoyi-ui/src/api/system/file.js
create mode 100644 ruoyi-ui/src/api/system/videos.js
create mode 100644 ruoyi-ui/src/views/system/allow/index.vue
create mode 100644 ruoyi-ui/src/views/system/file/index.vue
create mode 100644 ruoyi-ui/src/views/system/manage/files.vue
create mode 100644 ruoyi-ui/src/views/system/manage/selectFiles.vue
create mode 100644 ruoyi-ui/src/views/system/videos/index.vue
diff --git a/hl-wechat/pom.xml b/hl-wechat/pom.xml
new file mode 100644
index 0000000..62bab8f
--- /dev/null
+++ b/hl-wechat/pom.xml
@@ -0,0 +1,19 @@
+
+
+
+ ruoyi
+ com.ruoyi
+ 3.8.1
+
+ 4.0.0
+
+ hl-wechat
+
+
+ 8
+ 8
+
+
+
\ No newline at end of file
diff --git a/hl-wechat/src/main/java/com/ruoyi/hl/config/VideoConfig.java b/hl-wechat/src/main/java/com/ruoyi/hl/config/VideoConfig.java
new file mode 100644
index 0000000..dc4f51e
--- /dev/null
+++ b/hl-wechat/src/main/java/com/ruoyi/hl/config/VideoConfig.java
@@ -0,0 +1,10 @@
+package com.ruoyi.system.config;
+
+import lombok.Data;
+import org.springframework.beans.factory.annotation.Value;
+
+@Data
+public class VideoConfig {
+ @Value("video.baseUrl")
+ private String baseUrl;
+}
diff --git a/hl-wechat/src/main/java/com/ruoyi/hl/config/WxConfig.java b/hl-wechat/src/main/java/com/ruoyi/hl/config/WxConfig.java
new file mode 100644
index 0000000..27229b6
--- /dev/null
+++ b/hl-wechat/src/main/java/com/ruoyi/hl/config/WxConfig.java
@@ -0,0 +1,58 @@
+package com.ruoyi.system.config;
+
+
+import lombok.Getter;
+import lombok.Setter;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class WxConfig {
+
+ @Value("${wx.public.secret}")
+ @Getter
+ @Setter
+ private String publicSecret;
+
+ @Value("${wx.public.appid}")
+ @Getter
+ @Setter
+ private String publicAppid;
+
+
+ @Value("${wx.public.redirect_uri}")
+ @Getter
+ @Setter
+ private String redirectUrl;
+
+ @Getter
+ private String authUrl="https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=snsapi_base&state=%s#wechat_redirect";
+
+
+
+
+
+
+ public enum SignType {
+ MD5, HMACSHA256;
+ }
+ public enum ResultCode{
+ FAIL,SUCCESS
+ }
+
+ public static final String HMACSHA256 = "HMAC-SHA256";
+ public static final String MD5 = "MD5";
+
+ public static final String FIELD_SIGN = "sign";
+ public static final String FIELD_SIGN_TYPE = "sign_type";
+
+
+ //获取程序码的请求接口
+ public static final int UNLIMITED_TYPE_IMAGE=1;//byte[]
+ public static final int UNLIMITED_TYPE_FAIL=3;//错误
+ public static final int UNLIMITED_TYPE_JSON=2;//json
+
+
+
+
+}
diff --git a/hl-wechat/src/main/java/com/ruoyi/hl/controller/WxController.java b/hl-wechat/src/main/java/com/ruoyi/hl/controller/WxController.java
new file mode 100644
index 0000000..9a31f18
--- /dev/null
+++ b/hl-wechat/src/main/java/com/ruoyi/hl/controller/WxController.java
@@ -0,0 +1,44 @@
+package com.ruoyi.system.controller;
+
+import cn.hutool.core.util.StrUtil;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.system.config.WxConfig;
+import com.ruoyi.system.forest.clients.MiniWeChatClients;
+import com.ruoyi.system.forest.ptoto.WxPublicCode2UserInfoRes;
+import com.ruoyi.system.service.WxService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/wx")
+public class WxController {
+
+ @Autowired
+ private MiniWeChatClients weChatClients;
+
+ @Autowired
+ private WxService wxService;
+
+ @Autowired
+ private WxConfig wxConfig;
+
+
+ @RequestMapping("/getAuth/{id}")
+ public AjaxResult open(@PathVariable String id){
+ return AjaxResult.success(String.format(wxConfig.getAuthUrl(),wxConfig.getPublicAppid(),wxConfig.getRedirectUrl(),id ));
+ }
+
+ /*@RequestMapping("/code2videourl/{code}/{id}")
+ public AjaxResult code2videourl(@PathVariable String id,@PathVariable String code){
+ String openid="a";
+ WxPublicCode2UserInfoRes wxPublicCode2UserInfoRes=weChatClients.code2userinfo(wxConfig.getPublicAppid(),wxConfig.getPublicSecret(),code);
+ if (wxPublicCode2UserInfoRes.getErrcode()!=0){
+ return AjaxResult.error("获取openid错误");
+ }
+ openid=wxPublicCode2UserInfoRes.getOpenid();
+ return wxService.getOwnVideo(id,openid);
+ }*/
+}
diff --git a/hl-wechat/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java b/hl-wechat/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java
new file mode 100644
index 0000000..3defbea
--- /dev/null
+++ b/hl-wechat/src/main/java/com/ruoyi/hl/forest/clients/MiniWeChatClients.java
@@ -0,0 +1,76 @@
+package com.ruoyi.system.forest.clients;
+
+
+import com.dtflys.forest.annotation.*;
+import com.ruoyi.system.forest.interceptor.UnlimitedInterceptor;
+import com.ruoyi.system.forest.interceptor.WriteLogInterceptor;
+import com.ruoyi.system.forest.ptoto.WxMiniCode2SessionRes;
+import com.ruoyi.system.forest.ptoto.WxMiniTokenRes;
+import com.ruoyi.system.forest.ptoto.WxPublicCode2UserInfoRes;
+import com.ruoyi.system.forest.ptoto.WxUserInfoRes;
+
+import java.util.Map;
+
+@BaseRequest(baseURL = "${wechat_clients_url}")
+public interface MiniWeChatClients {
+
+ /**
+ * 获取access_token
+ * @param appid
+ * @param secret
+ * @return
+ */
+ @GetRequest(url = "/cgi-bin/token?grant_type=client_credential&appid=${appid}&secret=${secret}",
+ dataType ="json",interceptor = WriteLogInterceptor.class
+ )
+ WxMiniTokenRes token(@Var("appid") String appid, @Var("secret") String secret);
+
+ /**
+ * 获取信息
+ *
+ * @return
+ */
+ @GetRequest(url = "/cgi-bin/user/info?access_token=${token}&openid=${openid}&lang=zh_CN",
+ dataType ="json",interceptor = WriteLogInterceptor.class
+ )
+ WxUserInfoRes userInfo(@Var("token") String token, @Var("openid") String openid);
+
+
+ /**
+ * 获取用户信息
+ * @param appid
+ * @param secret
+ * @param code
+ * @return
+ */
+ @GetRequest(
+ url = "/sns/jscode2session?appid=${appid}&secret=${secret}&js_code=${code}&grant_type=authorization_code",
+ interceptor = WriteLogInterceptor.class,dataType = "json"
+ )
+ WxMiniCode2SessionRes code2session(@Var("appid") String appid, @Var("secret") String secret, @Var("code") String code);
+
+ /**
+ * 获取公众号用户信息
+ * @param appid
+ * @param secret
+ * @param code
+ * @return
+ */
+ @GetRequest(
+ url = "/sns/oauth2/access_token?appid=${appid}&secret=${secret}&code=${code}&grant_type=authorization_code",
+ interceptor = WriteLogInterceptor.class,dataType = "json"
+ )
+ WxPublicCode2UserInfoRes code2userinfo(@Var("appid") String appid, @Var("secret") String secret, @Var("code") String code);
+
+
+ /**
+ * 获取分享码
+ * @param token
+ * @param params
+ */
+ @PostRequest(url = "/wxa/getwxacodeunlimit?access_token=${token}",
+ contentType = "application/json",
+ interceptor = UnlimitedInterceptor.class)
+ byte[] getUnlimited(@Var("token")String token, @Body Map params);
+
+}
diff --git a/hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java b/hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java
new file mode 100644
index 0000000..f3bdaff
--- /dev/null
+++ b/hl-wechat/src/main/java/com/ruoyi/hl/forest/interceptor/UnlimitedInterceptor.java
@@ -0,0 +1,38 @@
+package com.ruoyi.system.forest.interceptor;
+
+
+import com.dtflys.forest.exceptions.ForestRuntimeException;
+import com.dtflys.forest.http.ForestRequest;
+import com.dtflys.forest.http.ForestResponse;
+import com.dtflys.forest.interceptor.Interceptor;
+
+
+import com.ruoyi.common.utils.BytesUtil;
+import com.ruoyi.system.config.WxConfig;
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class UnlimitedInterceptor implements Interceptor