From 898bf7fa7eb1ba538d0af7f3c8f016dd29c4ac2c Mon Sep 17 00:00:00 2001
From: Administrator <Administrator@MS-20170306HGUF>
Date: 星期一, 24 二月 2020 14:16:56 +0800
Subject: [PATCH] 原热销
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/IntegralControllerV2.java | 59 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 48 insertions(+), 11 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 2f992c1..b9313d7 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
@@ -39,6 +39,7 @@
import com.yeshi.fanli.entity.integral.IntegralTask.TaskUniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskClass.UniqueKeyEnum;
import com.yeshi.fanli.entity.integral.IntegralTaskRecord;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
import com.yeshi.fanli.exception.integral.IntegralExchangeException;
import com.yeshi.fanli.exception.integral.IntegralTaskRecordException;
import com.yeshi.fanli.log.LogHelper;
@@ -344,7 +345,7 @@
JSONObject data = new JSONObject();
data.put("goldCoin", goldCoin);
out.print(JsonUtil.loadTrueResult(data));
- } catch (IntegralTaskRecordException e) {
+ } catch (IntegralTaskRecordException e) {
out.print(JsonUtil.loadFalseResult(e.getMsg()));
}
}
@@ -392,6 +393,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("鏈壘鍒�")));
+ }
+ }
+
/**
* 鍏戞崲閲戝竵妫�楠�
*
@@ -400,8 +423,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);
@@ -409,9 +432,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())));
+ }
}
}
@@ -424,8 +455,8 @@
* @param out
*/
@RequestSerializableByKey(key = "'integralexchange-'+#uid")
- @RequestMapping(value = "exchange", method = RequestMethod.POST)
- public void exchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
+ @RequestMapping(value = "exchange")
+ public void exchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
try {
IntegralExchange exchange = integralExchangeService.exchange(uid, id);
@@ -437,9 +468,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())));
}
}
@@ -504,7 +541,7 @@
}
try {
- List<CodePublishRecord> list = codePublishRecordService.listValid((page - 1) * Constant.PAGE_SIZE,
+ List<CodePublishRecord> list = codePublishRecordService.listValid(null, (page - 1) * Constant.PAGE_SIZE,
Constant.PAGE_SIZE);
if (list == null) {
list = new ArrayList<CodePublishRecord>();
@@ -515,7 +552,7 @@
JSONObject data = new JSONObject();
data.put("count", count);
data.put("list", getGson().toJson(list));
- data.put("helpLink", configService.get("publish_list_help_link"));
+ data.put("helpLink", configService.get(ConfigKeyEnum.publishListHelpLink.getKey()));
out.print(JsonUtil.loadTrueResult(data));
} catch (Exception e) {
out.print(JsonUtil.loadFalseResult(1, "鑾峰彇澶辫触"));
--
Gitblit v1.8.0