-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
19,420 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
target | ||
|
||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
pastecode-system/src/main/java/com/mewhz/paste/PasteCodeApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,4 +32,6 @@ public BaseResponse(int responseCode, String responseMessage) { | |
} | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
pastecode-system/src/main/java/com/mewhz/paste/constant/CodeConstant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.mewhz.paste.constant; | ||
|
||
/** | ||
* @author mewhz | ||
*/ | ||
public interface CodeConstant { | ||
|
||
/** | ||
* 代码返回时每页的数量 | ||
*/ | ||
Long CODE_PAGE_NUM = 3L; | ||
} |
33 changes: 33 additions & 0 deletions
33
pastecode-system/src/main/java/com/mewhz/paste/constant/UserConstant.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.mewhz.paste.constant; | ||
|
||
/** | ||
* @author mewhz | ||
*/ | ||
public interface UserConstant { | ||
|
||
/** | ||
* 邮箱存在时提示的语句 | ||
*/ | ||
String EMAIL_ERROR_MESSAGE = "邮箱已存在!"; | ||
|
||
/** | ||
* 用户注册时账号长度 | ||
*/ | ||
Integer USER_ACCOUNT_LENGTH = 8; | ||
|
||
/** | ||
* 注册时第一位为零时重试次数 | ||
*/ | ||
|
||
Integer ACCOUNT_RETRY_NUM = 10; | ||
|
||
/** | ||
* 注册时账号循环次数 | ||
*/ | ||
Integer ACCOUNT_RETRY_CYCLE = 1000; | ||
|
||
/** | ||
* 用户返回时每页的数量 | ||
*/ | ||
Long USER_PAGE_NUM = 5L; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 0 additions & 31 deletions
31
pastecode-system/src/main/java/com/mewhz/paste/controller/CodeInfoController.java
This file was deleted.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
pastecode-system/src/main/java/com/mewhz/paste/controller/HeartController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package com.mewhz.paste.controller; | ||
|
||
import com.mewhz.paste.model.entity.Code; | ||
import com.mewhz.paste.model.entity.User; | ||
import com.mewhz.paste.model.vo.ResultVO; | ||
import com.mewhz.paste.model.vo.UserRegisterVO; | ||
import com.mewhz.paste.service.CodeService; | ||
import com.mewhz.paste.service.UserService; | ||
import lombok.SneakyThrows; | ||
import net.datafaker.Faker; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import javax.annotation.Resource; | ||
import javax.servlet.http.HttpServletResponse; | ||
import java.util.List; | ||
|
||
/** | ||
* @author mewhz | ||
*/ | ||
@RestController | ||
@RequestMapping("/heart") | ||
public class HeartController { | ||
|
||
@Resource | ||
private CodeService codeService; | ||
|
||
// @GetMapping("/login") | ||
// public SaTokenInfo login() { | ||
// StpUtil.login(1001); | ||
// return StpUtil.getTokenInfo(); | ||
// } | ||
// | ||
// @GetMapping("/info") | ||
// public boolean isLogin() { | ||
// return StpUtil.isLogin(); | ||
// } | ||
// | ||
// @GetMapping("/logout") | ||
// public String logout(){ | ||
// StpUtil.logout(); | ||
// return "success"; | ||
// } | ||
// | ||
// @SaCheckLogin | ||
// @GetMapping("/token") | ||
// public String token() { | ||
// return "Hello World"; | ||
// } | ||
|
||
// @Resource | ||
// UserService userService; | ||
// | ||
// @GetMapping("/") | ||
// public void fakerUser() { | ||
// | ||
// for (int i = 0; i < 20; i ++) { | ||
// UserRegisterVO userRegisterVO = new UserRegisterVO(); | ||
// | ||
// Faker faker = new Faker(); | ||
// | ||
// | ||
// userRegisterVO.setUserName(faker.random().hex()); | ||
// userRegisterVO.setUserEmail(faker.random().hex() + "@163.com"); | ||
// userRegisterVO.setUserPassword("123456"); | ||
// | ||
// userService.register(userRegisterVO); | ||
// } | ||
// | ||
// } | ||
|
||
@SneakyThrows | ||
@GetMapping("/download/{codeId}") | ||
public void download(HttpServletResponse response, @PathVariable String codeId) { | ||
response.reset(); | ||
response.setContentType("application/octet-stream"); | ||
response.setHeader("Content-disposition", | ||
"attachment;filename=file_" + System.currentTimeMillis() + ".txt"); | ||
|
||
Code code = codeService.getById(codeId); | ||
|
||
byte[] bytes = code.getCodeText().getBytes(); | ||
|
||
System.out.println(bytes.length); | ||
|
||
response.getOutputStream().write(bytes); | ||
|
||
} | ||
} |
Oops, something went wrong.