From 8f5ca1d337950be2a20cdb1a91a29a86fde1b07d Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期二, 12 十一月 2019 09:39:36 +0800
Subject: [PATCH] 红包封禁功能
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 48 insertions(+), 8 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
index 27c7547..56a045e 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java
@@ -58,6 +58,7 @@
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
import com.yeshi.fanli.vo.integral.DailySignVO;
import com.yeshi.fanli.vo.integral.ExchangeTipVO;
import com.yeshi.fanli.vo.integral.IntegralDetailVO;
@@ -312,6 +313,7 @@
* // 鏈鍙杋d
* @param out
*/
+ @RequestSerializableByKey(key = "'receiveGoldCoin-'+#uid")
@RequestMapping(value = "receiveGoldCoin", method = RequestMethod.POST)
public void receiveGoldCoin(AcceptData acceptData, Long uid, Integer type, String ids, String gids,
PrintWriter out) {
@@ -390,6 +392,28 @@
out.print(JsonUtil.loadTrueResult(data));
}
+ @RequestMapping(value = "getExchangeDetail")
+ public void getExchangeDetail(AcceptData acceptData, Long id, String callback, PrintWriter out) {
+ if (id == null || id <= 0) {
+ out.print(JsonUtil.loadFalseResult(1, "鍏戞崲ID鏈夎"));
+ return;
+ }
+ IntegralExchange exchange = integralExchangeService.selectByPrimaryKey(id);
+ if (exchange != null) {
+ GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
+ Gson gson = gsonBuilder.create();
+ if (StringUtil.isNullOrEmpty(callback))
+ out.print(JsonUtil.loadTrueResult(gson.toJson(exchange)));
+ else
+ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(gson.toJson(exchange))));
+ } else {
+ if (StringUtil.isNullOrEmpty(callback))
+ out.print(JsonUtil.loadFalseResult("鏈壘鍒�"));
+ else
+ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("鏈壘鍒�")));
+ }
+ }
+
/**
* 鍏戞崲閲戝竵妫�楠�
*
@@ -398,8 +422,8 @@
* @param id
* @param out
*/
- @RequestMapping(value = "verifyExchange", method = RequestMethod.POST)
- public void verifyExchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
+ @RequestMapping(value = "verifyExchange")
+ public void verifyExchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
try {
ExchangeTipVO exchange = integralExchangeService.verifyExchange(uid, id);
@@ -407,9 +431,17 @@
Gson gson = gsonBuilder.create();
JSONObject data = new JSONObject();
data.put("result", gson.toJson(exchange));
- out.print(JsonUtil.loadTrueResult(data));
+ if (StringUtil.isNullOrEmpty(callback)) {
+ out.print(JsonUtil.loadTrueResult(data));
+ } else {
+ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
+ }
} catch (IntegralExchangeException e) {
- out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+ if (StringUtil.isNullOrEmpty(callback)) {
+ out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+ } else {
+ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, e.getMsg())));
+ }
}
}
@@ -421,8 +453,9 @@
* @param id
* @param out
*/
- @RequestMapping(value = "exchange", method = RequestMethod.POST)
- public void exchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
+ @RequestSerializableByKey(key = "'integralexchange-'+#uid")
+ @RequestMapping(value = "exchange")
+ public void exchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
try {
IntegralExchange exchange = integralExchangeService.exchange(uid, id);
@@ -434,9 +467,15 @@
JSONObject data = new JSONObject();
data.put("result", gson.toJson(exchange));
data.put("goldCoin", extraVO.getGoldCoin() + "鏋�");
- out.print(JsonUtil.loadTrueResult(data));
+ if (StringUtil.isNullOrEmpty(callback))
+ out.print(JsonUtil.loadTrueResult(data));
+ else
+ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
} catch (IntegralExchangeException e) {
- out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+ if (StringUtil.isNullOrEmpty(callback))
+ out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
+ else
+ out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, e.getMsg())));
}
}
@@ -472,6 +511,7 @@
* @param id
* @param out
*/
+ @RequestSerializableByKey(key = "'exchangeInviteCode-'+#uid")
@RequestMapping(value = "exchangeInviteCode", method = RequestMethod.POST)
public void exchangeInviteCode(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
try {
--
Gitblit v1.8.0