|
@@ -1,6 +1,7 @@
|
|
|
package com.caimei.www.controller.authorized.document;
|
|
|
|
|
|
import com.caimei.www.pojo.JsonModel;
|
|
|
+import com.caimei.www.pojo.document.OssAuthorization;
|
|
|
import com.caimei.www.service.page.DocumentAuthService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -24,15 +25,6 @@ public class DocumentAuthController {
|
|
|
this.documentAuthService = documentAuthService;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 获取cookie数据,判断是否登录
|
|
|
- */
|
|
|
- @GetMapping("authorization")
|
|
|
- public JsonModel getAuthorizationCookie(@CookieValue(value = "authorizationMobile", required = false) String authorizationMobile) {
|
|
|
- return documentAuthService.getAuthorizationCookie(authorizationMobile);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取图形验证码
|
|
|
*/
|
|
@@ -56,15 +48,19 @@ public class DocumentAuthController {
|
|
|
* oss手机短信验证码登录
|
|
|
*/
|
|
|
@PostMapping("/mobileCodeLogin")
|
|
|
- public ResponseEntity<JsonModel> mobileCodeLogin(String mobile, String code) {
|
|
|
- return documentAuthService.mobileCodeLogin(mobile, code);
|
|
|
+ public ResponseEntity<JsonModel> mobileCodeLogin(OssAuthorization authorization) {
|
|
|
+ return documentAuthService.mobileCodeLogin(authorization);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 资料列表
|
|
|
*/
|
|
|
@GetMapping("/dataList")
|
|
|
- public JsonModel dataList(String name, Integer pageNum, Integer pageSize) {
|
|
|
+ public JsonModel dataList(@CookieValue(value = "authorizationMobile", required = false) String mobile, String name, Integer pageNum, Integer pageSize) {
|
|
|
+ Boolean isLogin = documentAuthService.getAuthorizationCookie(mobile);
|
|
|
+ if (!isLogin) {
|
|
|
+ return JsonModel.error(-99, "请登录");
|
|
|
+ }
|
|
|
return documentAuthService.dataList(name, pageNum, pageSize);
|
|
|
}
|
|
|
|
|
@@ -72,7 +68,11 @@ public class DocumentAuthController {
|
|
|
* 资料详情
|
|
|
*/
|
|
|
@GetMapping("/dataDetails")
|
|
|
- public JsonModel dataDetails(Integer pdfId) {
|
|
|
+ public JsonModel dataDetails(@CookieValue(value = "authorizationMobile", required = false) String mobile, Integer pdfId) {
|
|
|
+ Boolean isLogin = documentAuthService.getAuthorizationCookie(mobile);
|
|
|
+ if (!isLogin) {
|
|
|
+ return JsonModel.error(-99, "请登录");
|
|
|
+ }
|
|
|
if (pdfId == null) {
|
|
|
return JsonModel.error("参数异常");
|
|
|
}
|