Skip to content

Commit

Permalink
2020年3月29日17点47分
Browse files Browse the repository at this point in the history
  • Loading branch information
Yang authored and Yang committed Mar 29, 2020
1 parent f507baa commit bc79ffa
Show file tree
Hide file tree
Showing 56 changed files with 1,357 additions and 386 deletions.
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,5 @@
</plugins>
</build>


</project>
79 changes: 79 additions & 0 deletions src/main/java/com/jryyy/forum/config/AliPayConfiguration.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.jryyy.forum.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.io.FileWriter;
import java.io.IOException;

/**
* @author OU
*/

@Data
@Component
@ConfigurationProperties(prefix = "alipay")
public class AliPayConfiguration {
/**
* 日志地址,这里在d盘下要创建这个文件,不然会报错
*/
private static String log_path = "C:/logs/";
/**
* 应用ID,您的APPID,收款账号既是您的APPID对应支付宝账号
*/
private String appID;
/**例:2016082600317257
*商户私钥,您的PKCS8格式RSA2私钥
*/
private String merchantPrivateKey;
/**
* 支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm
* 对应APPID下的支付宝公钥。
*/
private String alipayPublicKey ;
/**
* 服务器异步通知页面路径 需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
* 返回的时候此页面不会返回到用户页面,只会执行你写到控制器里的地址
*/
private String notifyUrl;
/**
* 签名方式
*/
private String signType = "RSA2";
/**
* 字符编码格式
*/
private String charset = "utf-8";
/**
* 支付宝网关
*/
private String gatewayUrl;
private String sysServiceProviderId = "2088102180418544";

/**
* 写日志,方便测试(看网站需求,也可以改成把记录存入数据库)
*
* @param sWord
* 要写入日志里的文本内容
*/
public static void logResult(String sWord) {
FileWriter writer = null;
try {
writer = new FileWriter(log_path + "alipay_log_"
+ System.currentTimeMillis() + ".txt");
writer.write(sWord);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}

}
67 changes: 0 additions & 67 deletions src/main/java/com/jryyy/forum/config/AlipayConfiguration.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public CorsFilter corsFilter() {
//放行哪些原始域
config.addAllowedOrigin("*");
//是否发送Cookie信息
config.setAllowCredentials(true);
config.setAllowCredentials(false);
//放行哪些原始域(请求方式)
config.addAllowedMethod("*");
//放行哪些原始域(头部信息)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
import com.jryyy.forum.constant.GlobalStatus;
import com.jryyy.forum.exception.GlobalException;
import com.jryyy.forum.model.User;
import com.jryyy.forum.utils.security.PassToken;
import com.jryyy.forum.utils.security.SecurityUtils;
import com.jryyy.forum.utils.security.TokenUtils;

import com.jryyy.forum.utils.security.UserLoginToken;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/jryyy/forum/constant/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
*/
public class Constants {

public static final String file_url = "http://47.98.102.73:9896/upload/";

public static final String USER_TOKEN_STRING = "Authorization";

public static final int MAXIMUM_NUMBER_ATTEMPTS = 6;

public static final String DEFAULT = "0";

public static final int TOTAL_WORDS = 3653;

}
4 changes: 3 additions & 1 deletion src/main/java/com/jryyy/forum/constant/GlobalStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ public enum GlobalStatus {

messageSendingFailed("消息发送失败"),
userHasJoinedTheGroup("该用户已加入"),
userIsNotInAGroup("该用户不在群组");
userIsNotInAGroup("该用户不在群组"),

thesaurusIsNotApplied("未申请词库");



Expand Down
69 changes: 50 additions & 19 deletions src/main/java/com/jryyy/forum/constant/KayOrUrl.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.jryyy.forum.constant;

/**
*
* @author OU
*/
public class KayOrUrl {
public static String username(Integer userId) {
return String.format("DOU%d", userId);
}

public static final String unchecked_messages_key = "unchecked_messages_list";

Expand All @@ -18,39 +20,68 @@ public class KayOrUrl {

public static final String GROUP_CHAT_MESSAGE_KEY = "group_chat_message";

public static String userKey(Integer key){ return String.format("key:%d",key); }
public static String userKey(Integer key) {
return String.format("key:%d", key);
}

public static String userKey(String key) {
return String.format("key:%s", key);
}

public static String userTokenKey(Integer key) {
return String.format("%d_token_key", key);
}

public static String userTokenKey(String key) {
return String.format("%s_token_key", key);
}

public static String modifyPasswordCodeKey(String key) {
return String.format("%s_password_key", key);
}

public static String userKey(String key){ return String.format("key:%s",key); }
public static String lockKey(String key) {
return String.format("%s_lock_key", key);
}

public static String userTokenKey(Integer key){
return String.format("%d_token_key",key);
public static String lockKey(Integer key) {
return String.format("%d_lock_key", key);
}

public static String userTokenKey(String key){
return String.format("%s_token_key",key);
public static String registrationCodeKey(String key) {
return String.format("%s_registration_key", key);
}

public static String modifyPasswordCodeKey(String key){
return String.format("%s_password_key",key);
public static String userMessageKey(Integer toKey, Integer fromKey) {
return String.format("%d:%d", toKey, fromKey);
}

public static String lockKey(String key){
return String.format("%s_lock_key",key);
public static String groupMessageKey(Integer groupId) {
return String.format("Group:%d", groupId);
}

public static String lockKey(Integer key){
return String.format("%d_lock_key",key);
public static String unrecordedWordsKey(Integer userId) {
return String.format("unrecordedWordsKey:%d", userId);
}

public static String registrationCodeKey(String key){return String.format("%s_registration_key",key); }
public static String memorizingWordsKey(Integer userId) {
return String.format("memorizingWordsKey:%d", userId);
}

public static String userMessageKey(Integer toKey,Integer fromKey){return String.format("%d:%d",toKey,fromKey);}
public static String memorizedWordsKey(Integer userId) {
return String.format("memorizedWords:%d", userId);
}

public static String groupMessageKey(Integer groupId){return String.format("Group:%d",groupId);}
public static String userAvatarUrl(Integer userId) {
return String.format("/user/%d/avatar/", userId);
}

public static String userAvatarUrl(Integer userId){return String.format("/user/%d/avatar/",userId);}
public static String userBgImgUrl(Integer userId) {
return String.format("/user/%d/bgImg/", userId);
}

public static String userBgImgUrl(Integer userId){return String.format("/user/%d/bgImg/",userId);}
public static String zoneImageUrl(Integer userId) {
return String.format("zone/image/%d/", userId);
}

public static String zoneImageUrl(Integer userId){return String.format("zone/image/%d/",userId);}
}
21 changes: 21 additions & 0 deletions src/main/java/com/jryyy/forum/constant/WordWeight.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.jryyy.forum.constant;

/**
* @author OU
*/
public class WordWeight {

public static final int default_level_weighting = 0;

public static final int one_level_weighting = 1;

public static final int two_level_weighting = 2;

public static final int three__level_weighting = 3;

public static final int four__level_weighting = 4;

public static final int FIVE_LEVEL_WEIGHTING = 5;

public static final int SIX_LEVEL_WEIGHTING = 6;
}
13 changes: 7 additions & 6 deletions src/main/java/com/jryyy/forum/controller/AdminController.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
package com.jryyy.forum.controller;

import com.jryyy.forum.utils.security.UserRoleCode;
import com.jryyy.forum.model.Response;
import com.jryyy.forum.service.AdminService;
import com.jryyy.forum.utils.security.UserLoginToken;
import org.springframework.beans.factory.annotation.Autowired;
import com.jryyy.forum.utils.security.UserRoleCode;
import org.springframework.web.bind.annotation.*;

/**
* 管理员控制层
* @author JrYYY
*/

@RestController
@RequestMapping("/admin")
@UserLoginToken(role = UserRoleCode.ADMIN)
public class AdminController {

@Autowired
AdminService adminService;
private final AdminService adminService;

public AdminController(AdminService adminService) {
this.adminService = adminService;
}

/**
* 解锁用户
* @param id 用户id
*/
@PutMapping("/{id}/unlock")
public Response unlock(@PathVariable("id") long id) {
// userService.unlock(id);
return new Response();
}

Expand All @@ -34,7 +36,6 @@ public Response unlock(@PathVariable("id") long id) {
*
* @param id 用户id
*/

@PutMapping("/{id}/lock/{day}")
public Response lock(@PathVariable("id") long id, @PathVariable("day") int day) {
// userService.lock(id);
Expand Down
24 changes: 24 additions & 0 deletions src/main/java/com/jryyy/forum/controller/AliPayController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.jryyy.forum.controller;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
* @author OU
*/
@RestController
@RequestMapping("/pay")
public class AliPayController {


@PostMapping("/notify")
public void aliPayNotify(HttpServletRequest request, HttpServletResponse response) {

}


}
Loading

0 comments on commit bc79ffa

Please sign in to comment.