-
Notifications
You must be signed in to change notification settings - Fork 155
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
46 changed files
with
1,529 additions
and
186 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
16 changes: 16 additions & 0 deletions
16
hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/annotation/HOJAccess.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,16 @@ | ||
package top.hcode.hoj.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
/** | ||
* @Author Himit_ZH | ||
* @Date 2022/5/9 | ||
*/ | ||
@Target({ElementType.TYPE, ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface HOJAccess { | ||
HOJAccessEnum[] value() default {}; | ||
} |
37 changes: 37 additions & 0 deletions
37
hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/annotation/HOJAccessEnum.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,37 @@ | ||
package top.hcode.hoj.annotation; | ||
|
||
/** | ||
* @Author Himit_ZH | ||
* @Date 2022/5/9 | ||
*/ | ||
public enum HOJAccessEnum { | ||
/** | ||
* 公共讨论区 | ||
*/ | ||
PUBLIC_DISCUSSION, | ||
|
||
/** | ||
* 团队讨论区 | ||
*/ | ||
GROUP_DISCUSSION, | ||
|
||
/** | ||
* 比赛评论 | ||
*/ | ||
CONTEST_COMMENT, | ||
|
||
/** | ||
* 公共评测 | ||
*/ | ||
PUBLIC_JUDGE, | ||
|
||
/** | ||
* 团队评测 | ||
*/ | ||
GROUP_JUDGE, | ||
|
||
/** | ||
* 比赛评测 | ||
*/ | ||
CONTEST_JUDGE | ||
} |
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
37 changes: 37 additions & 0 deletions
37
hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/admin/SwitchController.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,37 @@ | ||
package top.hcode.hoj.controller.admin; | ||
|
||
import org.apache.shiro.authz.annotation.RequiresPermissions; | ||
import org.springframework.web.bind.annotation.PutMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import top.hcode.hoj.common.result.CommonResult; | ||
import top.hcode.hoj.pojo.dto.SwitchConfigDto; | ||
import top.hcode.hoj.service.admin.system.ConfigService; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* @Author Himit_ZH | ||
* @Date 2022/5/9 | ||
*/ | ||
@RestController | ||
@RequestMapping("/api/admin/switch") | ||
public class SwitchController { | ||
|
||
@Resource | ||
private ConfigService configService; | ||
|
||
@RequiresPermissions("system_info_admin") | ||
@RequestMapping("/info") | ||
public CommonResult<SwitchConfigDto> getSwitchConfig() { | ||
|
||
return configService.getSwitchConfig(); | ||
} | ||
|
||
@RequiresPermissions("system_info_admin") | ||
@PutMapping("/update") | ||
public CommonResult<Void> setSwitchConfig(@RequestBody SwitchConfigDto config) { | ||
return configService.setSwitchConfig(config); | ||
} | ||
} |
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
27 changes: 27 additions & 0 deletions
27
hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/exception/AccessException.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,27 @@ | ||
package top.hcode.hoj.exception; | ||
|
||
/** | ||
* @Author Himit_ZH | ||
* @Date 2022/5/9 | ||
*/ | ||
public class AccessException extends Exception{ | ||
public AccessException() { | ||
super(); | ||
} | ||
|
||
public AccessException(String message) { | ||
super(message); | ||
} | ||
|
||
public AccessException(String message, Throwable cause) { | ||
super(message, cause); | ||
} | ||
|
||
public AccessException(Throwable cause) { | ||
super(cause); | ||
} | ||
|
||
protected AccessException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { | ||
super(message, cause, enableSuppression, writableStackTrace); | ||
} | ||
} |
Oops, something went wrong.